File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -504,6 +504,21 @@ def test_unicode_in_batch_file(self):
504
504
)
505
505
self .assertEqual (out .strip (), '0' )
506
506
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
+
507
522
@requireVenvCreate
508
523
def test_multiprocessing (self ):
509
524
"""
Original file line number Diff line number Diff line change @@ -393,7 +393,7 @@ def setup_python(self, context):
393
393
os .symlink (src , dest )
394
394
to_unlink .append (dest )
395
395
except OSError :
396
- logger .warning ('Unable to symlink %r to %r' , src , dst )
396
+ logger .warning ('Unable to symlink %r to %r' , src , dest )
397
397
do_copies = True
398
398
for f in to_unlink :
399
399
try :
You can’t perform that action at this time.
0 commit comments