Skip to content

Make workaround for a recursion more robust #1153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ The released versions correspond to PyPI releases.
### Fixes
* fixed handling of dynamic imports from code in the fake filesystem in Python > 3.11
(see [#1121](../../issues/1121))
* fixed workaround for recursion with pytest under Windows to ignore capitalization
of pytest executable (see [#1096](../../issues/1096))

### Infrastructure
* adapt test for increased default buffer size in Python 3.14a6
Expand Down
6 changes: 4 additions & 2 deletions pyfakefs/fake_filesystem_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
FakeFilesystem,
)
from pyfakefs.fake_os import use_original_os
from pyfakefs.helpers import IS_PYPY
from pyfakefs.helpers import IS_PYPY, IS_WIN
from pyfakefs.legacy_packages import pathlib2, scandir
from pyfakefs.mox3_stubout import StubOutForTesting

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

with use_original_os():
# workaround for updatecache problem with pytest under Windows, see #1096
if not filename.endswith(r"pytest.exe\__main__.py"):
if not IS_WIN or not filename.lower().endswith(
r"pytest.exe\__main__.py"
):
return self.linecache_updatecache(filename, module_globals)
return []

Expand Down
Loading