MCPcopy Index your code
hub / github.com/python/cpython / test_failed_symlink

Method test_failed_symlink

Lib/test/test_venv.py:597–608  ·  view source on GitHub ↗

Test handling of failed symlinks on Windows.

(self)

Source from the content-addressed store, hash-verified

595 @unittest.skipUnless(os.name == 'nt' and can_symlink(),
596 'symlinks on Windows')
597 def test_failed_symlink(self):
598 """
599 Test handling of failed symlinks on Windows.
600 """
601 rmtree(self.env_dir)
602 env_dir = os.path.join(os.path.realpath(self.env_dir), 'venv')
603 with patch('os.symlink') as mock_symlink:
604 mock_symlink.side_effect = OSError()
605 builder = venv.EnvBuilder(clear=True, symlinks=True)
606 _, err = self.run_with_capture(builder.create, env_dir)
607 filepath_regex = r"'[A-Z]:\\\\(?:[^\\\\]+\\\\)*[^\\\\]+'"
608 self.assertRegex(err, rf"Unable to symlink {filepath_regex} to {filepath_regex}")
609
610 @requireVenvCreate
611 def test_multiprocessing(self):

Callers

nothing calls this directly

Calls 6

rmtreeFunction · 0.90
patchFunction · 0.90
run_with_captureMethod · 0.80
assertRegexMethod · 0.80
joinMethod · 0.45
realpathMethod · 0.45

Tested by

no test coverage detected