pytest-dev / pytest-forked

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

Mac: Bad file descriptor #78

Open Dreamsorcerer opened 1 year ago

Dreamsorcerer commented 1 year ago

Not sure why this has suddenly changed, but tests are now erroring on Mac OSX runners. Worst part is that the process doesn't end after this error, so the CI doesn't fail until it timeouts after 15 minutes.

See test results here (I've also verified on a separate PR, so it's not related to the coverage version bump): https://github.com/aio-libs/aiohttp-devtools/actions/runs/3783707241/jobs/6439936092

INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/_pytest/main.py", line 269, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/_pytest/main.py", line 323, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR>     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/_pytest/main.py", line 348, in pytest_runtestloop
INTERNALERROR>     item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR>     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/pytest_forked/__init__.py", line 51, in pytest_runtest_protocol
INTERNALERROR>     reports = forked_run_report(item)
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/pytest_forked/__init__.py", line 73, in forked_run_report
INTERNALERROR>     ff = py.process.ForkedFunc(runforked)
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/py/_process/forkedfunc.py", line 50, in __init__
INTERNALERROR>     self._child(nice_level, child_on_start, child_on_exit)
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/py/_process/forkedfunc.py", line 74, in _child
INTERNALERROR>     stdout.close()
INTERNALERROR> OSError: [Errno 9] Bad file descriptor
Dreamsorcerer commented 1 year ago

Bizarrely, in some cases the tests pass without this error: https://github.com/aio-libs/aiohttp-devtools/actions/runs/3825358870/jobs/6508384673 But, rerunning the failed tests continues to produce the same error result. i.e. In that test run, the 3.8 and 3.10 tests seem to keep failing. But, some have already passed, and another PR has just passed on all checks... Not sure what's going on here.

Dreamsorcerer commented 1 year ago

Taking note that the error comes from py, maybe it's worth replacing that library, as it's not being developed anymore.

webknjaz commented 1 year ago

@Dreamsorcerer that library is where pytest started (which is why there's still a py.test alias for it).