Skip to content

Commit 28cd431

Browse files
committed
fix invalid variable name in test_venv.py
1 parent 8b6c7c7 commit 28cd431

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

Lib/test/test_venv.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,21 @@ def test_unicode_in_batch_file(self):
504504
)
505505
self.assertEqual(out.strip(), '0')
506506

507+
@unittest.skipUnless(os.name == 'nt' and can_symlink(),
508+
'symlinks on Windows')
509+
def test_failed_symlink(self):
510+
"""
511+
Test handling of failed symlinks on Windows.
512+
"""
513+
rmtree(self.env_dir)
514+
env_dir = os.path.join(os.path.realpath(self.env_dir), 'venv')
515+
with patch('os.symlink') as mock_symlink:
516+
mock_symlink.side_effect = OSError()
517+
builder = venv.EnvBuilder(clear=True, symlinks=True)
518+
_, err = self.run_with_capture(builder.create, env_dir)
519+
filepath_regex = r"'.+\/[^\/]+'"
520+
self.assertRegex(err, rf"Unable to symlink {filepath_regex} to {filepath_regex}",)
521+
507522
@requireVenvCreate
508523
def test_multiprocessing(self):
509524
"""

Lib/venv/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ def setup_python(self, context):
393393
os.symlink(src, dest)
394394
to_unlink.append(dest)
395395
except OSError:
396-
logger.warning('Unable to symlink %r to %r', src, dst)
396+
logger.warning('Unable to symlink %r to %r', src, dest)
397397
do_copies = True
398398
for f in to_unlink:
399399
try:

0 commit comments

Comments
 (0)