Skip to content

Commit bbf82ce

Browse files
gh-156376: Fix test_environ_path_cwd when NoDefaultCurrentDirectoryInExePath is set
1 parent 9c37326 commit bbf82ce

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎Lib/test/test_shutil.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2729,7 +2729,9 @@ def test_environ_path_cwd(self):
27292729
self.assertIsNone(rv)
27302730

27312731
# look in current directory
2732-
with os_helper.change_cwd(self.dir):
2732+
with os_helper.change_cwd(self.dir), \
2733+
unittest.mock.patch('shutil._win_path_needs_curdir',
2734+
return_value=True):
27332735
rv = shutil.which(self.file)
27342736
self.assertEqual(rv, expected_cwd)
27352737

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix ``test_shutil.test_environ_path_cwd`` on Windows, which relied on the
2+
user's ``NoDefaultCurrentDirectoryInExePath`` environment setting and was
3+
therefore non-deterministic.

0 commit comments

Comments
 (0)