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

Method test_same_dir_without_pathext_extension

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

Source from the content-addressed store, hash-verified

2639
2640 @unittest.skipUnless(sys.platform == "win32", 'test specific to Windows')
2641 def test_same_dir_without_pathext_extension(self):
2642 cmd = self.file[:-4] # without .exe extension
2643 # pathext match
2644 self.assertNormEqual(shutil.which(cmd, path=self.dir), self.filepath)
2645 self.assertNormEqual(shutil.which(cmd, path=self.dir, mode=os.F_OK),
2646 self.filepath)
2647
2648 # without extension
2649 other_file_path = os.path.join(self.dir, cmd)
2650 self.create_file(other_file_path)
2651
2652 # pathext match if mode contains X_OK
2653 self.assertNormEqual(shutil.which(cmd, path=self.dir), self.filepath)
2654 # full match
2655 self.assertNormEqual(shutil.which(cmd, path=self.dir, mode=os.F_OK),
2656 other_file_path)
2657 self.assertNormEqual(shutil.which(self.file, path=self.dir), self.filepath)
2658 self.assertNormEqual(shutil.which(self.file, path=self.dir, mode=os.F_OK),
2659 self.filepath)
2660
2661 @unittest.skipUnless(sys.platform == "win32", 'test specific to Windows')
2662 def test_dir_order_with_pathext_extension(self):

Callers

nothing calls this directly

Calls 3

assertNormEqualMethod · 0.95
create_fileMethod · 0.95
joinMethod · 0.45

Tested by

no test coverage detected