-
Notifications
You must be signed in to change notification settings - Fork 93
Description
Found this after adding more pytest tests to the UI in connection with #1096. The pytest-specific tests for testing the module fixture (fs_module) fail with a lot of internal errors under macOS and Python 3.13:
Log from macOS/Python 3.13 CI test
Run echo "$(python -m pytest pyfakefs/pytest_tests/pytest_plugin_failing_helper.py)" > ./testresult.txt
============================= test session starts ==============================
platform darwin -- Python 3.13.0, pytest-8.3.4, pluggy-1.5.0
rootdir: /Users/runner/work/pyfakefs/pyfakefs
configfile: pyproject.toml
plugins: pyfakefs-5.8.dev0
collected 27 items
pyfakefs/pytest_tests/hook_test/pytest_hook_test.py .... [ 14%]
pyfakefs/pytest_tests/ns_package/test/ns_package/test/test_file.py . [ 18%]
pyfakefs/pytest_tests/pytest_check_failed_plugin_test.py . [ 22%]
pyfakefs/pytest_tests/pytest_fixture_param_test.py X.. [ 33%]
pyfakefs/pytest_tests/pytest_fixture_test.py X... [ 48%]
pyfakefs/pytest_tests/pytest_module_fixture_test.py .
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/_pytest/main.py", line 283, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> ~~~~^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/_pytest/main.py", line 337, in _main
INTERNALERROR> config.hook.pytest_runtestloop(session=session)
INTERNALERROR> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pluggy/_hooks.py", line 513, in call
INTERNALERROR> return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR> ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR> raise exception.with_traceback(exception.traceback)
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pluggy/_callers.py", line 122, in _multicall
INTERNALERROR> teardown.throw(exception) # type: ignore[union-attr]
INTERNALERROR> ~~~~~~~~~~~~~~^^^^^^^^^^^
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/_pytest/logging.py", line 803, in pytest_runtestloop
INTERNALERROR> return (yield) # Run all the tests.
INTERNALERROR> ^^^^^
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pluggy/_callers.py", line 122, in _multicall
INTERNALERROR> teardown.throw(exception) # type: ignore[union-attr]
INTERNALERROR> ~~~~~~~~~~~~~~^^^^^^^^^^^
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/_pytest/terminal.py", line 673, in pytest_runtestloop
INTERNALERROR> result = yield
INTERNALERROR> ^^^^^
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pluggy/_callers.py", line 103, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/_pytest/main.py", line 362, in pytest_runtestloop
INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pluggy/_hooks.py", line 513, in call
INTERNALERROR> return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR> ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR> raise exception.with_traceback(exception.traceback)
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pluggy/_callers.py", line 122, in _multicall
Traceback (most recent call last):
INTERNALERROR> teardown.throw(exception) # type: ignore[union-attr]
File "/Users/runner/work/pyfakefs/pyfakefs/pyfakefs/fake_filesystem.py", line 1750, in get_object_from_normpath
INTERNALERROR> ~~~~~~~~~~~~~~^^^^^^^^^^^
target = target.get_entry(component) # type: ignore
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/_pytest/warnings.py", line 112, in pytest_runtest_protocol
File "/Users/runner/work/pyfakefs/pyfakefs/pyfakefs/fake_file.py", line 566, in get_entry
INTERNALERROR> return (yield)
return self.entries[to_string(pathname_name)]
INTERNALERROR> ^^^^^
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pluggy/_callers.py", line 122, in _multicall
KeyError: 'Users'
INTERNALERROR> teardown.throw(exception) # type: ignore[union-attr]
INTERNALERROR> ~~~~~~~~~~~~~~^^^^^^^^^^^
During handling of the above exception, another exception occurred:
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/_pytest/assertion/init.py", line 176, in pytest_runtest_protocol
INTERNALERROR> return (yield)
Traceback (most recent call last):
INTERNALERROR> ^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/_pytest/config/init.py", line 175, in main
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pluggy/_callers.py", line 122, in _multicall
ret: ExitCode | int = config.hook.pytest_cmdline_main(config=config)
INTERNALERROR> teardown.throw(exception) # type: ignore[union-attr]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
INTERNALERROR> ~~~~~~~~~~~~~~^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pluggy/_hooks.py", line 513, in call
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/_pytest/unittest.py", line 429, in pytest_runtest_protocol
INTERNALERROR> res = yield
INTERNALERROR> ^^^^^
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pluggy/_callers.py", line 122, in _multicall
INTERNALERROR> teardown.throw(exception) # type: ignore[union-attr]
INTERNALERROR> ~~~~~~~~~~~~~~^^^^^^^^^^^
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/_pytest/faulthandler.py", line 88, in pytest_runtest_protocol
INTERNALERROR> return (yield)
INTERNALERROR> ^^^^^
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pluggy/_callers.py", line 103, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/_pytest/runner.py", line 112, in pytest_runtest_protocol
INTERNALERROR> ihook.pytest_runtest_logstart(nodeid=item.nodeid, location=item.location)
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pluggy/_callers.py", line 139, in _multicall
raise exception.with_traceback(exception.traceback)
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(*args)
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/_pytest/main.py", line 330, in pytest_cmdline_main
return wrap_session(config, _main)
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/_pytest/main.py", line 315, in wrap_session
os.chdir(session.startpath)
~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "/Users/runner/work/pyfakefs/pyfakefs/pyfakefs/fake_os.py", line 1456, in wrapped
return f(*args, **kwargs)
File "/Users/runner/work/pyfakefs/pyfakefs/pyfakefs/fake_os.py", line 457, in chdir
self.filesystem.confirmdir(path)
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/Users/runner/work/pyfakefs/pyfakefs/pyfakefs/fake_filesystem.py", line 3022, in confirmdir
self.resolve(
~~~~~~~~~~~~^
target_directory,
^^^^^^^^^^^^^^^^^
...<2 lines>...
check_owner=check_owner,
^^^^^^^^^^^^^^^^^^^^^^^^
),
^
File "/Users/runner/work/pyfakefs/pyfakefs/pyfakefs/fake_filesystem.py", line 1834, in resolve
return self.get_object_from_normpath(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
self.resolve_path(file_path, allow_fd),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<2 lines>...
check_owner,
^^^^^^^^^^^^
)
^
File "/Users/runner/work/pyfakefs/pyfakefs/pyfakefs/fake_filesystem.py", line 1761, in get_object_from_normpath
self.raise_os_error(errno.ENOENT, path)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
File "/Users/runner/work/pyfakefs/pyfakefs/pyfakefs/fake_filesystem.py", line 489, in raise_os_error
raise OSError(err_no, message, filename)
FileNotFoundError: [Errno 2] No such file or directory in the fake filesystem: '/Users/runner/work/pyfakefs/pyfakefs'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/runner/hostedtoolcache/Python/3.13.0/arm64/bin/pytest", line 8, in
sys.exit(console_main())
~~~~~~~~~~~~^^
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/_pytest/config/init.py", line 201, in console_main
code = main()
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/_pytest/config/init.py", line 181, in main
config._ensure_unconfigure()
~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/_pytest/config/init.py", line 1123, in _ensure_unconfigure
self.hook.pytest_unconfigure(config=self)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pluggy/_hooks.py", line 513, in call
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pluggy/_callers.py", line 139, in _multicall
raise exception.with_traceback(exception.traceback)
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(*args)
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/_pytest/faulthandler.py", line 47, in pytest_unconfigure
os.close(config.stash[fault_handler_stderr_fd_key])
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/runner/work/pyfakefs/pyfakefs/pyfakefs/fake_os.py", line 1456, in wrapped
return f(*args, **kwargs)
File "/Users/runner/work/pyfakefs/pyfakefs/pyfakefs/fake_os.py", line 327, in close
file_handle = self.filesystem.get_open_file(fd)
File "/Users/runner/work/pyfakefs/pyfakefs/pyfakefs/fake_filesystem.py", line 945, in get_open_file
return self.get_open_files(file_des)[0]
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
File "/Users/runner/work/pyfakefs/pyfakefs/pyfakefs/fake_filesystem.py", line 967, in get_open_files
self.raise_os_error(errno.EBADF, str(file_des))
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/runner/work/pyfakefs/pyfakefs/pyfakefs/fake_filesystem.py", line 489, in raise_os_error
raise OSError(err_no, message, filename)
OSError: [Errno 9] Bad file descriptor in the fake filesystem: '9'
INTERNALERROR> ^^^^^^^^^^^^^
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/functools.py", line 1037, in get
INTERNALERROR> val = self.func(instance)
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/_pytest/nodes.py", line 764, in location
INTERNALERROR> relfspath = self.session._node_location_to_relpath(path)
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/_pytest/main.py", line 643, in _node_location_to_relpath
INTERNALERROR> return self._bestrelpathcache[node_path]
INTERNALERROR> ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/_pytest/main.py", line 485, in missing
INTERNALERROR> r = bestrelpath(self.path, path)
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/_pytest/pathlib.py", line 1021, in bestrelpath
INTERNALERROR> reldirectory = directory.relative_to(base)
INTERNALERROR> File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/pathlib/_local.py", line 385, in relative_to
INTERNALERROR> raise ValueError(f"{str(self)!r} is not in the subpath of {str(other)!r}")
INTERNALERROR> ValueError: '/Users/runner/work/pyfakefs/pyfakefs' is not in the subpath of '/Users/runner/work/pyfakefs/pyfakefs'
Error: Process completed with exit code 1.
For now, I've excluded the tests for this combination, but they have to be fixed.