(self)
| 2660 | |
| 2661 | @unittest.skipUnless(sys.platform == "win32", 'test specific to Windows') |
| 2662 | def test_dir_order_with_pathext_extension(self): |
| 2663 | cmd = self.file # with .exe extension |
| 2664 | search_path = os.pathsep.join([os.fsdecode(self.other_dir), |
| 2665 | os.fsdecode(self.dir)]) |
| 2666 | # full match in the second directory |
| 2667 | self.assertNormEqual(shutil.which(cmd, path=search_path), self.filepath) |
| 2668 | self.assertNormEqual(shutil.which(cmd, path=search_path, mode=os.F_OK), |
| 2669 | self.filepath) |
| 2670 | |
| 2671 | cmd2 = cmd + self.to_text_type('.com') # with .exe.com extension |
| 2672 | other_file_path = os.path.join(self.other_dir, cmd2) |
| 2673 | self.create_file(other_file_path) |
| 2674 | |
| 2675 | # pathext match in the first directory |
| 2676 | self.assertNormEqual(shutil.which(cmd, path=search_path), other_file_path) |
| 2677 | self.assertNormEqual(shutil.which(cmd, path=search_path, mode=os.F_OK), |
| 2678 | other_file_path) |
| 2679 | # full match in the first directory |
| 2680 | self.assertNormEqual(shutil.which(cmd2, path=search_path), other_file_path) |
| 2681 | self.assertNormEqual(shutil.which(cmd2, path=search_path, mode=os.F_OK), |
| 2682 | other_file_path) |
| 2683 | |
| 2684 | # full match in the first directory |
| 2685 | search_path = os.pathsep.join([os.fsdecode(self.dir), |
| 2686 | os.fsdecode(self.other_dir)]) |
| 2687 | self.assertEqual(shutil.which(cmd, path=search_path), self.filepath) |
| 2688 | self.assertEqual(shutil.which(cmd, path=search_path, mode=os.F_OK), |
| 2689 | self.filepath) |
| 2690 | |
| 2691 | @unittest.skipUnless(sys.platform == "win32", 'test specific to Windows') |
| 2692 | def test_dir_order_without_pathext_extension(self): |
nothing calls this directly
no test coverage detected