pytest-dev / pytest-forked

extracted --boxed from pytest-xdist to ensure backward compat
MIT License
67 stars 21 forks source link

AttributeError: module 'py' has no attribute 'process' #88

Open sylvorg opened 9 months ago

sylvorg commented 9 months ago

Hello!

I'm getting the following traceback when trying to use pytest-forked, but when looking through the output of dir(py) right before ff = py.process.ForkedFunc(runforked), py does indeed seem to have process, so I'm not sure what the issue could be. This occurs even if I remove the other plugins.

Test session starts (platform: linux, Python 3.11.6, pytest 7.4.3, pytest-sugar 0.9.7)
cachedir: .pytest_cache
Using --randomly-seed=1335576925
rootdir: /build/ndwvj7bzh8lycisww50x36vxv404551b-source
configfile: pyproject.toml
plugins: custom-exit-code-0.3.0, drop-dup-tests-0.3.0, forked-1.6.0, hy-1.0.0.0, ignore-1.0.0.0, lazy-fixture-0.6.3, order-1.1.0, randomly-3.13.0, repeat-0.9.2, sugar-0.9.7, xdist-3.3.1
8 workers [379 items]  m
scheduling tests via LoadScheduling
INTERNALERROR> def worker_internal_error(self, node, formatted_error):
INTERNALERROR>         """
INTERNALERROR>         pytest_internalerror() was called on the worker.
INTERNALERROR>
INTERNALERROR>         pytest_internalerror() arguments are an excinfo and an excrepr, which can't
INTERNALERROR>         be serialized, so we go with a poor man's solution of raising an exception
INTERNALERROR>         here ourselves using the formatted message.
INTERNALERROR>         """
INTERNALERROR>         self._active_nodes.remove(node)
INTERNALERROR>         try:
INTERNALERROR> >           assert False, formatted_error
INTERNALERROR> E           AssertionError: Traceback (most recent call last):
INTERNALERROR> E               File "/nix/store/swm9wcfarf9kbswclnwdjvlszwpymnr4-python3.11-pytest-7.4.3/lib/python3.11/site-packages/_pytest/main.py", line 271, in wrap_session
INTERNALERROR> E                 session.exitstatus = doit(config, session) or 0
INTERNALERROR> E                                      ^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/swm9wcfarf9kbswclnwdjvlszwpymnr4-python3.11-pytest-7.4.3/lib/python3.11/site-packages/_pytest/main.py", line 325, in _main
INTERNALERROR> E                 config.hook.pytest_runtestloop(session=session)
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_hooks.py", line 493, in __call__
INTERNALERROR> E                 return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
INTERNALERROR> E                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_manager.py", line 115, in _hookexec
INTERNALERROR> E                 return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> E                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_callers.py", line 152, in _multicall
INTERNALERROR> E                 return outcome.get_result()
INTERNALERROR> E                        ^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_result.py", line 114, in get_result
INTERNALERROR> E                 raise exc.with_traceback(exc.__traceback__)
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_callers.py", line 77, in _multicall
INTERNALERROR> E                 res = hook_impl.function(*args)
INTERNALERROR> E                       ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/h4p9m98gf6kcpm0ipy4csw1lppg6hhvb-python3.11-pytest-xdist-3.3.1/lib/python3.11/site-packages/xdist/remote.py", line 157, in pytest_runtestloop
INTERNALERROR> E                 self.run_one_test()
INTERNALERROR> E               File "/nix/store/h4p9m98gf6kcpm0ipy4csw1lppg6hhvb-python3.11-pytest-xdist-3.3.1/lib/python3.11/site-packages/xdist/remote.py", line 174, in run_one_test
INTERNALERROR> E                 self.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_hooks.py", line 493, in __call__
INTERNALERROR> E                 return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
INTERNALERROR> E                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_manager.py", line 115, in _hookexec
INTERNALERROR> E                 return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> E                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_callers.py", line 152, in _multicall
INTERNALERROR> E                 return outcome.get_result()
INTERNALERROR> E                        ^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_result.py", line 114, in get_result
INTERNALERROR> E                 raise exc.with_traceback(exc.__traceback__)
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_callers.py", line 77, in _multicall
INTERNALERROR> E                 res = hook_impl.function(*args)
INTERNALERROR> E                       ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/g6776z6nxpvqch54dgdh3r6hjc48kf4m-python3.11-pytest-forked-1.6.0/lib/python3.11/site-packages/pytest_forked/__init__.py", line 51, in pytest_runtest_protocol
INTERNALERROR> E                 reports = forked_run_report(item)
INTERNALERROR> E                           ^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/g6776z6nxpvqch54dgdh3r6hjc48kf4m-python3.11-pytest-forked-1.6.0/lib/python3.11/site-packages/pytest_forked/__init__.py", line 73, in forked_run_report
INTERNALERROR> E                 ff = py.process.ForkedFunc(runforked)
INTERNALERROR> E                      ^^^^^^^^^^
INTERNALERROR> E             AttributeError: module 'py' has no attribute 'process'
INTERNALERROR> E           assert False
INTERNALERROR>
INTERNALERROR> /nix/store/h4p9m98gf6kcpm0ipy4csw1lppg6hhvb-python3.11-pytest-xdist-3.3.1/lib/python3.11/site-packages/xdist/dsession.py:197: AssertionError
INTERNALERROR> def worker_internal_error(self, node, formatted_error):
INTERNALERROR>         """
INTERNALERROR>         pytest_internalerror() was called on the worker.
INTERNALERROR>
INTERNALERROR>         pytest_internalerror() arguments are an excinfo and an excrepr, which can't
INTERNALERROR>         be serialized, so we go with a poor man's solution of raising an exception
INTERNALERROR>         here ourselves using the formatted message.
INTERNALERROR>         """
INTERNALERROR>         self._active_nodes.remove(node)
INTERNALERROR>         try:
INTERNALERROR> >           assert False, formatted_error
INTERNALERROR> E           AssertionError: Traceback (most recent call last):
INTERNALERROR> E               File "/nix/store/swm9wcfarf9kbswclnwdjvlszwpymnr4-python3.11-pytest-7.4.3/lib/python3.11/site-packages/_pytest/main.py", line 271, in wrap_session
INTERNALERROR> E                 session.exitstatus = doit(config, session) or 0
INTERNALERROR> E                                      ^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/swm9wcfarf9kbswclnwdjvlszwpymnr4-python3.11-pytest-7.4.3/lib/python3.11/site-packages/_pytest/main.py", line 325, in _main
INTERNALERROR> E                 config.hook.pytest_runtestloop(session=session)
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_hooks.py", line 493, in __call__
INTERNALERROR> E                 return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
INTERNALERROR> E                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_manager.py", line 115, in _hookexec
INTERNALERROR> E                 return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> E                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_callers.py", line 152, in _multicall
INTERNALERROR> E                 return outcome.get_result()
INTERNALERROR> E                        ^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_result.py", line 114, in get_result
INTERNALERROR> E                 raise exc.with_traceback(exc.__traceback__)
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_callers.py", line 77, in _multicall
INTERNALERROR> E                 res = hook_impl.function(*args)
INTERNALERROR> E                       ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/h4p9m98gf6kcpm0ipy4csw1lppg6hhvb-python3.11-pytest-xdist-3.3.1/lib/python3.11/site-packages/xdist/remote.py", line 157, in pytest_runtestloop
INTERNALERROR> E                 self.run_one_test()
INTERNALERROR> E               File "/nix/store/h4p9m98gf6kcpm0ipy4csw1lppg6hhvb-python3.11-pytest-xdist-3.3.1/lib/python3.11/site-packages/xdist/remote.py", line 174, in run_one_test
INTERNALERROR> E                 self.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_hooks.py", line 493, in __call__
INTERNALERROR> E                 return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
INTERNALERROR> E                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_manager.py", line 115, in _hookexec
INTERNALERROR> E                 return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> E                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_callers.py", line 152, in _multicall
INTERNALERROR> E                 return outcome.get_result()
INTERNALERROR> E                        ^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_result.py", line 114, in get_result
INTERNALERROR> E                 raise exc.with_traceback(exc.__traceback__)
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_callers.py", line 77, in _multicall
INTERNALERROR> E                 res = hook_impl.function(*args)
INTERNALERROR> E                       ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/g6776z6nxpvqch54dgdh3r6hjc48kf4m-python3.11-pytest-forked-1.6.0/lib/python3.11/site-packages/pytest_forked/__init__.py", line 51, in pytest_runtest_protocol
INTERNALERROR> E                 reports = forked_run_report(item)
INTERNALERROR> E                           ^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/g6776z6nxpvqch54dgdh3r6hjc48kf4m-python3.11-pytest-forked-1.6.0/lib/python3.11/site-packages/pytest_forked/__init__.py", line 73, in forked_run_report
INTERNALERROR> E                 ff = py.process.ForkedFunc(runforked)
INTERNALERROR> E                      ^^^^^^^^^^
INTERNALERROR> E             AttributeError: module 'py' has no attribute 'process'
INTERNALERROR> E           assert False
INTERNALERROR>
INTERNALERROR> /nix/store/h4p9m98gf6kcpm0ipy4csw1lppg6hhvb-python3.11-pytest-xdist-3.3.1/lib/python3.11/site-packages/xdist/dsession.py:197: AssertionError
INTERNALERROR> def worker_internal_error(self, node, formatted_error):
INTERNALERROR>         """
INTERNALERROR>         pytest_internalerror() was called on the worker.
INTERNALERROR>
INTERNALERROR>         pytest_internalerror() arguments are an excinfo and an excrepr, which can't
INTERNALERROR>         be serialized, so we go with a poor man's solution of raising an exception
INTERNALERROR>         here ourselves using the formatted message.
INTERNALERROR>         """
INTERNALERROR>         self._active_nodes.remove(node)
INTERNALERROR>         try:
INTERNALERROR> >           assert False, formatted_error
INTERNALERROR> E           AssertionError: Traceback (most recent call last):
INTERNALERROR> E               File "/nix/store/swm9wcfarf9kbswclnwdjvlszwpymnr4-python3.11-pytest-7.4.3/lib/python3.11/site-packages/_pytest/main.py", line 271, in wrap_session
INTERNALERROR> E                 session.exitstatus = doit(config, session) or 0
INTERNALERROR> E                                      ^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/swm9wcfarf9kbswclnwdjvlszwpymnr4-python3.11-pytest-7.4.3/lib/python3.11/site-packages/_pytest/main.py", line 325, in _main
INTERNALERROR> E                 config.hook.pytest_runtestloop(session=session)
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_hooks.py", line 493, in __call__
INTERNALERROR> E                 return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
INTERNALERROR> E                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_manager.py", line 115, in _hookexec
INTERNALERROR> E                 return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> E                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_callers.py", line 152, in _multicall
INTERNALERROR> E                 return outcome.get_result()
INTERNALERROR> E                        ^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_result.py", line 114, in get_result
INTERNALERROR> E                 raise exc.with_traceback(exc.__traceback__)
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_callers.py", line 77, in _multicall
INTERNALERROR> E                 res = hook_impl.function(*args)
INTERNALERROR> E                       ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/h4p9m98gf6kcpm0ipy4csw1lppg6hhvb-python3.11-pytest-xdist-3.3.1/lib/python3.11/site-packages/xdist/remote.py", line 157, in pytest_runtestloop
INTERNALERROR> E                 self.run_one_test()
INTERNALERROR> E               File "/nix/store/h4p9m98gf6kcpm0ipy4csw1lppg6hhvb-python3.11-pytest-xdist-3.3.1/lib/python3.11/site-packages/xdist/remote.py", line 174, in run_one_test
INTERNALERROR> E                 self.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_hooks.py", line 493, in __call__
INTERNALERROR> E                 return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
INTERNALERROR> E                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_manager.py", line 115, in _hookexec
INTERNALERROR> E                 return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> E                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_callers.py", line 152, in _multicall
INTERNALERROR> E                 return outcome.get_result()
INTERNALERROR> E                        ^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_result.py", line 114, in get_result
INTERNALERROR> E                 raise exc.with_traceback(exc.__traceback__)
INTERNALERROR> E               File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_callers.py", line 77, in _multicall
INTERNALERROR> E                 res = hook_impl.function(*args)
INTERNALERROR> E                       ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/g6776z6nxpvqch54dgdh3r6hjc48kf4m-python3.11-pytest-forked-1.6.0/lib/python3.11/site-packages/pytest_forked/__init__.py", line 51, in pytest_runtest_protocol
INTERNALERROR> E                 reports = forked_run_report(item)
INTERNALERROR> E                           ^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> E               File "/nix/store/g6776z6nxpvqch54dgdh3r6hjc48kf4m-python3.11-pytest-forked-1.6.0/lib/python3.11/site-packages/pytest_forked/__init__.py", line 73, in forked_run_report
INTERNALERROR> E                 ff = py.process.ForkedFunc(runforked)
INTERNALERROR> E                      ^^^^^^^^^^
INTERNALERROR> E             AttributeError: module 'py' has no attribute 'process'
INTERNALERROR> E           assert False
INTERNALERROR>
INTERNALERROR> /nix/store/h4p9m98gf6kcpm0ipy4csw1lppg6hhvb-python3.11-pytest-xdist-3.3.1/lib/python3.11/site-packages/xdist/dsession.py:197: AssertionError
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/nix/store/swm9wcfarf9kbswclnwdjvlszwpymnr4-python3.11-pytest-7.4.3/lib/python3.11/site-packages/_pytest/main.py", line 271, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>                          ^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/nix/store/swm9wcfarf9kbswclnwdjvlszwpymnr4-python3.11-pytest-7.4.3/lib/python3.11/site-packages/_pytest/main.py", line 325, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_hooks.py", line 493, in __call__
INTERNALERROR>     return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_manager.py", line 115, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_callers.py", line 152, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_result.py", line 114, in get_result
INTERNALERROR>     raise exc.with_traceback(exc.__traceback__)
INTERNALERROR>   File "/nix/store/vbsly1jzi08w10ppkai06jhgk60i5dc8-python3.11-pluggy-1.3.0/lib/python3.11/site-packages/pluggy/_callers.py", line 77, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>           ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/nix/store/h4p9m98gf6kcpm0ipy4csw1lppg6hhvb-python3.11-pytest-xdist-3.3.1/lib/python3.11/site-packages/xdist/dsession.py", line 122, in pytest_runtestloop
INTERNALERROR>     self.loop_once()
INTERNALERROR>   File "/nix/store/h4p9m98gf6kcpm0ipy4csw1lppg6hhvb-python3.11-pytest-xdist-3.3.1/lib/python3.11/site-packages/xdist/dsession.py", line 145, in loop_once
INTERNALERROR>     call(**kwargs)
INTERNALERROR>   File "/nix/store/h4p9m98gf6kcpm0ipy4csw1lppg6hhvb-python3.11-pytest-xdist-3.3.1/lib/python3.11/site-packages/xdist/dsession.py", line 184, in worker_workerfinished
INTERNALERROR>     assert not crashitem, (crashitem, node)
INTERNALERROR> AssertionError: ('tests/test_with_cwd.hy::test_with_cwd', <WorkerController gw5>)
INTERNALERROR> assert not 'tests/test_with_cwd.hy::test_with_cwd'

Thank you kindly for the help!

nicoddemus commented 9 months ago

Hi @sylvorg,

Can you post the output of pip --list?

but when looking through the output of dir(py) right before ff = py.process.ForkedFunc(runforked), py does indeed seem to have process

How are you verifying this, using a debugger? If so, see if you can get the file path of py: I suspect it might be resolving to pytest's internal py shim, instead of the installed py package.

sylvorg commented 9 months ago

Can you post the output of pip --list?

I'm actually using a nix-shell for this, so I'm not quite sure how to do that, unfortunately.

How are you verifying this...

I forked the repository and added a raise ValueError(dir(py)) right before the line; should I do that again with py.__file__ or similar?

nicoddemus commented 9 months ago

I'm actually using a nix-shell for this, so I'm not quite sure how to do that, unfortunately.

Are you executing this with a virtualenv active? If not can you detail how?

I forked the repository and added a raise ValueError(dir(py)) right before the line; should I do that again with py.file or similar?

Yes.

sylvorg commented 9 months ago

Are you executing this with a virtualenv active? If not can you detail how?

Sorry, my setup is a little complicated with a lot of interlinking functions, so could you give me an example of what exactly you need, like the packages in the shell, the command I'm using the run it, etc. ?

As for the py module, I'm getting /nix/store/lgz5z1nv7q9x82blqnqhmrxp3hfmh6gj-python3.11-py-1.11.0/lib/python3.11/site-packages/py/__init__.py as the path, and the following as the contents:

"""
pylib: rapid testing and development utils

this module uses apipkg.py for lazy-loading sub modules
and classes.  The initpkg-dictionary  below specifies
name->value mappings where value can be another namespace
dictionary or an import path.

(c) Holger Krekel and others, 2004-2014
"""
from py._error import error

try:
    from py._vendored_packages import apipkg
    lib_not_mangled_by_packagers = True
    vendor_prefix = '._vendored_packages.'
except ImportError:
    import apipkg
    lib_not_mangled_by_packagers = False
    vendor_prefix = ''

try:
    from ._version import version as __version__
except ImportError:
    # broken installation, we don't even try
    __version__ = "unknown"

apipkg.initpkg(__name__, attr={'_apipkg': apipkg, 'error': error}, exportdefs={
    # access to all standard lib modules
    'std': '._std:std',

    '_pydir' : '.__metainfo:pydir',
    'version': 'py:__version__', # backward compatibility

    # pytest-2.0 has a flat namespace, we use alias modules
    # to keep old references compatible
    'test' : 'pytest',

    # hook into the top-level standard library
    'process' : {
        '__doc__'        : '._process:__doc__',
        'cmdexec'        : '._process.cmdexec:cmdexec',
        'kill'           : '._process.killproc:kill',
        'ForkedFunc'     : '._process.forkedfunc:ForkedFunc',
    },

    'apipkg' : {
        'initpkg'   : vendor_prefix + 'apipkg:initpkg',
        'ApiModule' : vendor_prefix + 'apipkg:ApiModule',
    },

    'iniconfig' : {
        'IniConfig'      : vendor_prefix + 'iniconfig:IniConfig',
        'ParseError'     : vendor_prefix + 'iniconfig:ParseError',
    },

    'path' : {
        '__doc__'        : '._path:__doc__',
        'svnwc'          : '._path.svnwc:SvnWCCommandPath',
        'svnurl'         : '._path.svnurl:SvnCommandPath',
        'local'          : '._path.local:LocalPath',
        'SvnAuth'        : '._path.svnwc:SvnAuth',
    },

    # python inspection/code-generation API
    'code' : {
        '__doc__'           : '._code:__doc__',
        'compile'           : '._code.source:compile_',
        'Source'            : '._code.source:Source',
        'Code'              : '._code.code:Code',
        'Frame'             : '._code.code:Frame',
        'ExceptionInfo'     : '._code.code:ExceptionInfo',
        'Traceback'         : '._code.code:Traceback',
        'getfslineno'       : '._code.source:getfslineno',
        'getrawcode'        : '._code.code:getrawcode',
        'patch_builtins'    : '._code.code:patch_builtins',
        'unpatch_builtins'  : '._code.code:unpatch_builtins',
        '_AssertionError'   : '._code.assertion:AssertionError',
        '_reinterpret_old'  : '._code.assertion:reinterpret_old',
        '_reinterpret'      : '._code.assertion:reinterpret',
        '_reprcompare'      : '._code.assertion:_reprcompare',
        '_format_explanation' : '._code.assertion:_format_explanation',
    },

    # backports and additions of builtins
    'builtin' : {
        '__doc__'        : '._builtin:__doc__',
        'enumerate'      : '._builtin:enumerate',
        'reversed'       : '._builtin:reversed',
        'sorted'         : '._builtin:sorted',
        'any'            : '._builtin:any',
        'all'            : '._builtin:all',
        'set'            : '._builtin:set',
        'frozenset'      : '._builtin:frozenset',
        'BaseException'  : '._builtin:BaseException',
        'GeneratorExit'  : '._builtin:GeneratorExit',
        '_sysex'         : '._builtin:_sysex',
        'print_'         : '._builtin:print_',
        '_reraise'       : '._builtin:_reraise',
        '_tryimport'     : '._builtin:_tryimport',
        'exec_'          : '._builtin:exec_',
        '_basestring'    : '._builtin:_basestring',
        '_totext'        : '._builtin:_totext',
        '_isbytes'       : '._builtin:_isbytes',
        '_istext'        : '._builtin:_istext',
        '_getimself'     : '._builtin:_getimself',
        '_getfuncdict'   : '._builtin:_getfuncdict',
        '_getcode'       : '._builtin:_getcode',
        'builtins'       : '._builtin:builtins',
        'execfile'       : '._builtin:execfile',
        'callable'       : '._builtin:callable',
        'bytes'       : '._builtin:bytes',
        'text'       : '._builtin:text',
    },

    # input-output helping
    'io' : {
        '__doc__'             : '._io:__doc__',
        'dupfile'             : '._io.capture:dupfile',
        'TextIO'              : '._io.capture:TextIO',
        'BytesIO'             : '._io.capture:BytesIO',
        'FDCapture'           : '._io.capture:FDCapture',
        'StdCapture'          : '._io.capture:StdCapture',
        'StdCaptureFD'        : '._io.capture:StdCaptureFD',
        'TerminalWriter'      : '._io.terminalwriter:TerminalWriter',
        'ansi_print'          : '._io.terminalwriter:ansi_print',
        'get_terminal_width'  : '._io.terminalwriter:get_terminal_width',
        'saferepr'            : '._io.saferepr:saferepr',
    },

    # small and mean xml/html generation
    'xml' : {
        '__doc__'            : '._xmlgen:__doc__',
        'html'               : '._xmlgen:html',
        'Tag'                : '._xmlgen:Tag',
        'raw'                : '._xmlgen:raw',
        'Namespace'          : '._xmlgen:Namespace',
        'escape'             : '._xmlgen:escape',
    },

    'log' : {
        # logging API ('producers' and 'consumers' connected via keywords)
        '__doc__'            : '._log:__doc__',
        '_apiwarn'           : '._log.warning:_apiwarn',
        'Producer'           : '._log.log:Producer',
        'setconsumer'        : '._log.log:setconsumer',
        '_setstate'          : '._log.log:setstate',
        '_getstate'          : '._log.log:getstate',
        'Path'               : '._log.log:Path',
        'STDOUT'             : '._log.log:STDOUT',
        'STDERR'             : '._log.log:STDERR',
        'Syslog'             : '._log.log:Syslog',
    },

})
Flamefire commented 7 months ago

I ran into this issue too and found that py is going away/deprecated and it picks up a small shim which doesn't has process: https://github.com/pytest-dev/pytest/blob/main/src/py.py

sylvorg commented 7 months ago

Hello, @Flamefire! Sorry for not responding earlier; had finals to deal with! šŸ˜… Did you manage to find a solution or similar for this? Or are you avoiding pytest-forked at the moment?

Flamefire commented 7 months ago

Hello, @Flamefire! Sorry for not responding earlier; had finals to deal with! šŸ˜… Did you manage to find a solution or similar for this? Or are you avoiding pytest-forked at the moment?

Yes: Basically pip install py, see https://github.com/pytest-dev/pytest/issues/12206

mtelka commented 3 months ago

Since py is in maintenance mode, isn't the way to go to stop to use it?

The-Compiler commented 3 months ago

Indeed, hence why this issue is open?

mtelka commented 3 months ago

Because py is still used?

The-Compiler commented 3 months ago

Yes, and that's why this issue exists and is open. Not sure what your point is?

nicoddemus commented 3 months ago

@mtelka

Since py is in maintenance mode, isn't the way to go to stop to use it?

Indeed it would be nice to not depend on py anymore, a quick search shows it is being used only in two places:

https://github.com/pytest-dev/pytest-forked/blob/b2742322d39ebda97d5170922520f3bb9c73f614/src/pytest_forked/__init__.py#L21

https://github.com/pytest-dev/pytest-forked/blob/b2742322d39ebda97d5170922520f3bb9c73f614/src/pytest_forked/__init__.py#L73

The former seems easy to replace by checking if the object implements __fspath__ or something similar, the latter could be reimplemented in terms of multiprocessing from stdlib.

PRs are welcome in case anybody wants to set aside some time to work on this.