Skip to content

Commit 694b658

Browse files
committed
Make workaround for a recursion more robust
- ignore the pytest executable capitalization - fixes #1096 (again)
1 parent c74cd55 commit 694b658

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CHANGES.md

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ The released versions correspond to PyPI releases.
1717
### Fixes
1818
* fixed handling of dynamic imports from code in the fake filesystem in Python > 3.11
1919
(see [#1121](../../issues/1121))
20+
* fixed workaround for recursion with pytest under Windows to ignore capitalization
21+
of pytest executable (see [#1096](../../issues/1096))
2022

2123
### Infrastructure
2224
* adapt test for increased default buffer size in Python 3.14a6

pyfakefs/fake_filesystem_unittest.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
FakeFilesystem,
8787
)
8888
from pyfakefs.fake_os import use_original_os
89-
from pyfakefs.helpers import IS_PYPY
89+
from pyfakefs.helpers import IS_PYPY, IS_WIN
9090
from pyfakefs.legacy_packages import pathlib2, scandir
9191
from pyfakefs.mox3_stubout import StubOutForTesting
9292

@@ -153,7 +153,9 @@ def updatecache(filename, module_globals=None):
153153

154154
with use_original_os():
155155
# workaround for updatecache problem with pytest under Windows, see #1096
156-
if not filename.endswith(r"pytest.exe\__main__.py"):
156+
if not IS_WIN or not filename.lower().endswith(
157+
r"pytest.exe\__main__.py"
158+
):
157159
return self.linecache_updatecache(filename, module_globals)
158160
return []
159161

0 commit comments

Comments
 (0)