MCPcopy Create free account
hub / github.com/python/cpython / test_pathext_applied_on_files_in_path

Method test_pathext_applied_on_files_in_path

Lib/test/test_shutil.py:2594–2604  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2592 # See GH-75586
2593 @unittest.skipUnless(sys.platform == "win32", 'test specific to Windows')
2594 def test_pathext_applied_on_files_in_path(self):
2595 ext = '.xyz'
2596 cmd = self.to_text_type(TESTFN2)
2597 cmdext = cmd + self.to_text_type(ext)
2598 filepath = os.path.join(self.dir, cmdext)
2599 self.create_file(filepath)
2600 with os_helper.EnvironmentVarGuard() as env:
2601 env["PATH"] = os.fsdecode(self.dir)
2602 env["PATHEXT"] = ext
2603 self.assertEqual(shutil.which(cmd), filepath)
2604 self.assertEqual(shutil.which(cmdext), filepath)
2605
2606 # See GH-75586
2607 @unittest.skipUnless(sys.platform == "win32", 'test specific to Windows')

Callers

nothing calls this directly

Calls 3

create_fileMethod · 0.95
joinMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected