Check operation with pytest-xdist
https://pypi.org/project/pytest-xdist/
Passes, but spews a bunch of warnings:
$ pytest -k test0 --tui -n auto
================================================================ test session starts =================================================================
platform darwin -- Python 3.10.5, pytest-7.2.0.dev264+g6ad32a9c5, pluggy-1.0.0 -- /Users/jwr003/coding/pytest-tui/venv/bin/python
cachedir: .pytest_cache
metadata: {'Python': '3.10.5', 'Platform': 'macOS-12.5.1-x86_64-i386-64bit', 'Packages': {'pytest': '7.2.0.dev264+g6ad32a9c5', 'py': '1.11.0', 'pluggy': '1.0.0'}, 'Plugins': {'xdist': '2.5.0', 'forked': '1.4.0', 'rerunfailures': '10.2', 'html': '3.1.1', 'clarity': '1.0.1', 'Faker': '13.15.1', 'metadata': '2.0.2', 'tui': '1.5.1'}, 'JAVA_HOME': '/Users/jwr003/Library/Java/JavaVirtualMachines/corretto-11.0.12/Contents/Home'}
rootdir: /Users/jwr003/coding/pytest-tui, configfile: pytest.ini
plugins: xdist-2.5.0, forked-1.4.0, rerunfailures-10.2, html-3.1.1, clarity-1.0.1, Faker-13.15.1, metadata-2.0.2, tui-1.5.1
[gw0] darwin Python 3.10.5 cwd: /Users/jwr003/coding/pytest-tui
[gw1] darwin Python 3.10.5 cwd: /Users/jwr003/coding/pytest-tui
[gw2] darwin Python 3.10.5 cwd: /Users/jwr003/coding/pytest-tui
[gw3] darwin Python 3.10.5 cwd: /Users/jwr003/coding/pytest-tui
[gw4] darwin Python 3.10.5 cwd: /Users/jwr003/coding/pytest-tui
[gw5] darwin Python 3.10.5 cwd: /Users/jwr003/coding/pytest-tui
[gw6] darwin Python 3.10.5 cwd: /Users/jwr003/coding/pytest-tui
[gw7] darwin Python 3.10.5 cwd: /Users/jwr003/coding/pytest-tui
[gw1] Python 3.10.5 (main, Jul 28 2022, 23:09:23) [Clang 13.1.6 (clang-1316.0.21.2.5)]
[gw0] Python 3.10.5 (main, Jul 28 2022, 23:09:23) [Clang 13.1.6 (clang-1316.0.21.2.5)]
[gw2] Python 3.10.5 (main, Jul 28 2022, 23:09:23) [Clang 13.1.6 (clang-1316.0.21.2.5)]
[gw3] Python 3.10.5 (main, Jul 28 2022, 23:09:23) [Clang 13.1.6 (clang-1316.0.21.2.5)]
[gw4] Python 3.10.5 (main, Jul 28 2022, 23:09:23) [Clang 13.1.6 (clang-1316.0.21.2.5)]
[gw5] Python 3.10.5 (main, Jul 28 2022, 23:09:23) [Clang 13.1.6 (clang-1316.0.21.2.5)]
[gw6] Python 3.10.5 (main, Jul 28 2022, 23:09:23) [Clang 13.1.6 (clang-1316.0.21.2.5)]
[gw7] Python 3.10.5 (main, Jul 28 2022, 23:09:23) [Clang 13.1.6 (clang-1316.0.21.2.5)]
gw0 [8] / gw1 [8] / gw2 [8] / gw3 [8] / gw4 [8] / gw5 [8] / gw6 [8] / gw7 [8]
scheduling tests via LoadScheduling
demo-tests/test_0.py::test0_pass_1
demo-tests/test_0.py::test0_pass_3_error_in_fixture
demo-tests/test_0.py::test0_skip
demo-tests/test_0.py::test0_fail_1
demo-tests/test_0.py::test0_xpass
demo-tests/test_0.py::test0_xfail
demo-tests/test_0.py::test0_pass_2_logs
demo-tests/test_0.py::test0_warning
[gw7] [ 12%] PASSED demo-tests/test_0.py::test0_warning
[gw4] [ 25%] PASSED demo-tests/test_0.py::test0_skip
[gw6] [ 37%] XPASS demo-tests/test_0.py::test0_xpass
[gw0] [ 50%] PASSED demo-tests/test_0.py::test0_pass_2_logs
[gw1] [ 62%] PASSED demo-tests/test_0.py::test0_pass_1
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 "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/execnet/gateway_base.py", line 1400, in _save
INTERNALERROR> E dispatch = self._dispatch[tp]
INTERNALERROR> E KeyError: <class 'types.SimpleNamespace'>
INTERNALERROR> E
INTERNALERROR> E During handling of the above exception, another exception occurred:
INTERNALERROR> E
INTERNALERROR> E Traceback (most recent call last):
INTERNALERROR> E File "/Users/jwr003/coding/pytest/src/_pytest/main.py", line 270, in wrap_session
INTERNALERROR> E session.exitstatus = doit(config, session) or 0
INTERNALERROR> E File "/Users/jwr003/coding/pytest/src/_pytest/main.py", line 324, in _main
INTERNALERROR> E config.hook.pytest_runtestloop(session=session)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR> E return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR> E return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR> E return outcome.get_result()
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR> E raise ex[1].with_traceback(ex[2])
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR> E res = hook_impl.function(*args)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/xdist/remote.py", line 94, in pytest_runtestloop
INTERNALERROR> E self.run_one_test(torun)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/xdist/remote.py", line 110, in run_one_test
INTERNALERROR> E self.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR> E return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR> E return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR> E return outcome.get_result()
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR> E raise ex[1].with_traceback(ex[2])
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR> E res = hook_impl.function(*args)
INTERNALERROR> E File "/Users/jwr003/coding/pytest/src/_pytest/runner.py", line 112, in pytest_runtest_protocol
INTERNALERROR> E runtestprotocol(item, nextitem=nextitem)
INTERNALERROR> E File "/Users/jwr003/coding/pytest/src/_pytest/runner.py", line 125, in runtestprotocol
INTERNALERROR> E rep = call_and_report(item, "setup", log)
INTERNALERROR> E File "/Users/jwr003/coding/pytest/src/_pytest/runner.py", line 224, in call_and_report
INTERNALERROR> E hook.pytest_runtest_logreport(report=report)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR> E return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR> E return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR> E return outcome.get_result()
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR> E raise ex[1].with_traceback(ex[2])
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR> E res = hook_impl.function(*args)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/xdist/remote.py", line 163, in pytest_runtest_logreport
INTERNALERROR> E self.sendevent("testreport", data=data)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/xdist/remote.py", line 48, in sendevent
INTERNALERROR> E self.channel.send((name, kwargs))
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/execnet/gateway_base.py", line 729, in send
INTERNALERROR> E self.gateway._send(Message.CHANNEL_DATA, self.id, dumps_internal(item))
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/execnet/gateway_base.py", line 1371, in dumps_internal
INTERNALERROR> E return _Serializer().save(obj)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/execnet/gateway_base.py", line 1389, in save
INTERNALERROR> E self._save(obj)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/execnet/gateway_base.py", line 1407, in _save
INTERNALERROR> E dispatch(self, obj)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/execnet/gateway_base.py", line 1494, in save_tuple
INTERNALERROR> E self._save(item)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/execnet/gateway_base.py", line 1407, in _save
INTERNALERROR> E dispatch(self, obj)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/execnet/gateway_base.py", line 1490, in save_dict
INTERNALERROR> E self._write_setitem(key, value)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/execnet/gateway_base.py", line 1484, in _write_setitem
INTERNALERROR> E self._save(value)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/execnet/gateway_base.py", line 1407, in _save
INTERNALERROR> E dispatch(self, obj)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/execnet/gateway_base.py", line 1490, in save_dict
INTERNALERROR> E self._write_setitem(key, value)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/execnet/gateway_base.py", line 1484, in _write_setitem
INTERNALERROR> E self._save(value)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/execnet/gateway_base.py", line 1405, in _save
INTERNALERROR> E raise DumpError("can't serialize {}".format(tp))
INTERNALERROR> E execnet.gateway_base.DumpError: can't serialize <class 'types.SimpleNamespace'>
INTERNALERROR> E assert False
INTERNALERROR>
INTERNALERROR> venv/lib/python3.10/site-packages/xdist/dsession.py:192: 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 "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/execnet/gateway_base.py", line 1400, in _save
INTERNALERROR> E dispatch = self._dispatch[tp]
INTERNALERROR> E KeyError: <class 'types.SimpleNamespace'>
INTERNALERROR> E
INTERNALERROR> E During handling of the above exception, another exception occurred:
INTERNALERROR> E
INTERNALERROR> E Traceback (most recent call last):
INTERNALERROR> E File "/Users/jwr003/coding/pytest/src/_pytest/main.py", line 270, in wrap_session
INTERNALERROR> E session.exitstatus = doit(config, session) or 0
INTERNALERROR> E File "/Users/jwr003/coding/pytest/src/_pytest/main.py", line 324, in _main
INTERNALERROR> E config.hook.pytest_runtestloop(session=session)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR> E return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR> E return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR> E return outcome.get_result()
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR> E raise ex[1].with_traceback(ex[2])
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR> E res = hook_impl.function(*args)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/xdist/remote.py", line 94, in pytest_runtestloop
INTERNALERROR> E self.run_one_test(torun)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/xdist/remote.py", line 110, in run_one_test
INTERNALERROR> E self.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR> E return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR> E return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR> E return outcome.get_result()
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR> E raise ex[1].with_traceback(ex[2])
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR> E res = hook_impl.function(*args)
INTERNALERROR> E File "/Users/jwr003/coding/pytest/src/_pytest/runner.py", line 112, in pytest_runtest_protocol
INTERNALERROR> E runtestprotocol(item, nextitem=nextitem)
INTERNALERROR> E File "/Users/jwr003/coding/pytest/src/_pytest/runner.py", line 131, in runtestprotocol
INTERNALERROR> E reports.append(call_and_report(item, "call", log))
INTERNALERROR> E File "/Users/jwr003/coding/pytest/src/_pytest/runner.py", line 224, in call_and_report
INTERNALERROR> E hook.pytest_runtest_logreport(report=report)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR> E return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR> E return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR> E return outcome.get_result()
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR> E raise ex[1].with_traceback(ex[2])
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR> E res = hook_impl.function(*args)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/xdist/remote.py", line 163, in pytest_runtest_logreport
INTERNALERROR> E self.sendevent("testreport", data=data)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/xdist/remote.py", line 48, in sendevent
INTERNALERROR> E self.channel.send((name, kwargs))
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/execnet/gateway_base.py", line 729, in send
INTERNALERROR> E self.gateway._send(Message.CHANNEL_DATA, self.id, dumps_internal(item))
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/execnet/gateway_base.py", line 1371, in dumps_internal
INTERNALERROR> E return _Serializer().save(obj)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/execnet/gateway_base.py", line 1389, in save
INTERNALERROR> E self._save(obj)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/execnet/gateway_base.py", line 1407, in _save
INTERNALERROR> E dispatch(self, obj)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/execnet/gateway_base.py", line 1494, in save_tuple
INTERNALERROR> E self._save(item)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/execnet/gateway_base.py", line 1407, in _save
INTERNALERROR> E dispatch(self, obj)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/execnet/gateway_base.py", line 1490, in save_dict
INTERNALERROR> E self._write_setitem(key, value)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/execnet/gateway_base.py", line 1484, in _write_setitem
INTERNALERROR> E self._save(value)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/execnet/gateway_base.py", line 1407, in _save
INTERNALERROR> E dispatch(self, obj)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/execnet/gateway_base.py", line 1490, in save_dict
INTERNALERROR> E self._write_setitem(key, value)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/execnet/gateway_base.py", line 1484, in _write_setitem
INTERNALERROR> E self._save(value)
INTERNALERROR> E File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/execnet/gateway_base.py", line 1405, in _save
INTERNALERROR> E raise DumpError("can't serialize {}".format(tp))
INTERNALERROR> E execnet.gateway_base.DumpError: can't serialize <class 'types.SimpleNamespace'>
INTERNALERROR> E assert False
INTERNALERROR>
INTERNALERROR> venv/lib/python3.10/site-packages/xdist/dsession.py:192: AssertionError
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/Users/jwr003/coding/pytest/src/_pytest/main.py", line 270, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File "/Users/jwr003/coding/pytest/src/_pytest/main.py", line 324, in _main
INTERNALERROR> config.hook.pytest_runtestloop(session=session)
INTERNALERROR> File "/Users/jwr003/coding/pytest-tui/venv/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/jwr003/coding/pytest-tui/venv/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/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/xdist/dsession.py", line 117, in pytest_runtestloop
INTERNALERROR> self.loop_once()
INTERNALERROR> File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/xdist/dsession.py", line 140, in loop_once
INTERNALERROR> call(**kwargs)
INTERNALERROR> File "/Users/jwr003/coding/pytest-tui/venv/lib/python3.10/site-packages/xdist/dsession.py", line 179, in worker_workerfinished
INTERNALERROR> assert not crashitem, (crashitem, node)
INTERNALERROR> AssertionError: ('demo-tests/test_0.py::test0_xfail', <WorkerController gw5>)
INTERNALERROR> assert not 'demo-tests/test_0.py::test0_xfail'
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=0 mode='r' encoding='UTF-8'>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=0 mode='r' encoding='UTF-8'>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=0 mode='r' encoding='UTF-8'>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=0 mode='r' encoding='UTF-8'>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=0 mode='r' encoding='UTF-8'>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=0 mode='r' encoding='UTF-8'>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=0 mode='r' encoding='UTF-8'>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=0 mode='r' encoding='UTF-8'>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
====================================================== 4 passed, 1 xpassed, 1 warning in 4.65s =======================================================
For me similar output (can't serialize <class 'types.SimpleNamespace'>) but it bails after 20 passing tests (out of 284) and doesn't show anything under Passes in tui view. That's with xdist's -n 12. Without -n 12 it completes, although clicking on Failures just shows blank window.
@brownterryn - can you give me some info about your execution environment? Python version, Pytest version, etc. If you just run pytest -VV you can paste me the output.
Hmm, for the above report pytest -VV was
This is pytest version 8.0.0, imported from /usr/local/lib/python3.12/site-packages/pytest/__init__.py
setuptools registered plugins:
anyio-4.2.0 at /usr/local/lib/python3.12/site-packages/anyio/pytest_plugin.py
pytest-xdist-3.5.0 at /usr/local/lib/python3.12/site-packages/xdist/plugin.py
pytest-xdist-3.5.0 at /usr/local/lib/python3.12/site-packages/xdist/looponfail.py
pytest-parallel-0.1.1 at /usr/local/lib/python3.12/site-packages/pytest_parallel/__init__.py
pytest-cov-4.1.0 at /usr/local/lib/python3.12/site-packages/pytest_cov/plugin.py
thought I'd rebuild and remove pytest-parallel because I don't think it's being used, now pytest -VV fails with
...
File "/usr/local/lib/python3.12/site-packages/_pytest/assertion/rewrite.py", line 175, in exec_module
exec(co, module.__dict__)
File "/usr/local/lib/python3.12/site-packages/pytest_tui/plugin.py", line 16, in <module>
from pytest_tui.__main__ import tui_launch
File "/usr/local/lib/python3.12/site-packages/_pytest/assertion/rewrite.py", line 175, in exec_module
exec(co, module.__dict__)
File "/usr/local/lib/python3.12/site-packages/pytest_tui/__main__.py", line 10, in <module>
from pytest_tui.tui1 import main as tui1
File "/usr/local/lib/python3.12/site-packages/_pytest/assertion/rewrite.py", line 175, in exec_module
exec(co, module.__dict__)
File "/usr/local/lib/python3.12/site-packages/pytest_tui/tui1.py", line 10, in <module>
from textual.widgets import ScrollView, TreeClick
File "/usr/local/lib/python3.12/site-packages/textual/widgets/__init__.py", line 101, in __getattr__
raise ImportError(f"Package 'textual.widgets' has no class '{widget_class}'")
ImportError: Package 'textual.widgets' has no class 'ScrollView'
pip's fault? Don't know. Running in docker container hence install to /usr/local/lib vs. venv.
p.s. not aware of anything else using textual and no pinned textual requirement so not sure how it would have found an incompatible version, if that's what it's done
p.p.s. tui's not listed in the -VV plugins list because I'd just pip installed in the container as a one off
That's due to the Textual dependency that pytest-tui imposes. I wrote the TUI part of this plugin at a time when Textual was relatively immature, and they did not support a scroll widget yet, so I had to write my own. That has since changed (a lot of stuff has changed in Textual), but I haven't updated this repo yet to make use of their new code. It'd basically be an entire rewrite from the ground up.
What does your pip list show you? If it shows textual anything > 0.1.18, you will want to do a pip uninstall -y textual and then a pip install textual==0.1.18. That should probably do it, but if not, you can REALLY and create a new venv and then pip install -r reqts/requirements.txt, and use that venv for running pytest-tui.
So ImportError: Package 'textual.widgets' has no class 'ScrollView' was a red-herring diversion of course, I re-built the container with textual==0.1.18 and got this
This is pytest version 7.4.4, imported from /usr/local/lib/python3.12/site-packages/pytest/__init__.py
setuptools registered plugins:
anyio-4.2.0 at /usr/local/lib/python3.12/site-packages/anyio/pytest_plugin.py
pytest-xdist-3.5.0 at /usr/local/lib/python3.12/site-packages/xdist/plugin.py
pytest-xdist-3.5.0 at /usr/local/lib/python3.12/site-packages/xdist/looponfail.py
pytest-metadata-2.0.4 at /usr/local/lib/python3.12/site-packages/pytest_metadata/plugin.py
pytest-instafail-0.5.0 at /usr/local/lib/python3.12/site-packages/pytest_instafail.py
pytest-cov-5.0.0 at /usr/local/lib/python3.12/site-packages/pytest_cov/plugin.py
Faker-18.3.1 at /usr/local/lib/python3.12/site-packages/faker/contrib/pytest/plugin.py
pytest-tui-2.1.0 at /usr/local/lib/python3.12/site-packages/pytest_tui/plugin.py
pytest-json-report-1.5.0 at /usr/local/lib/python3.12/site-packages/pytest_jsonreport/plugin.py
but similar outcome to original report. pytest -k run_re --tui -vv runs something like 27 tests, 3 fail, tui works although less caught in the errors view than I would expect / need. But pytest -k run_re --tui -n 10 -vv doesn't run tests properly and tui, well, I guess correctly reflects that. Same can't serialize <class 'types.SimpleNamespace'> an related output you saw in you're original report.
So I guess basically I'm just reporting that as suspected there are issues with xdist and that maybe they're worse than just a lot of weird output, in some cases.
Can you call your tests with the -n 0 option? This essentially disables xdist (sets number of worker threads to 0), so you lose the advantage of speed, but it shouldn't crash.
If you can send me a copy of your tests, and the output of pip list, I can take a look at it laster tonite. I've had a task to look into a library called chili that supposedly handles the serialization better...maybe that would help.
Here's a simple reproducible example
# mylib.py
import random
import time
def my_func():
time.sleep(3)
if random.random() < 0.1:
return 1
# test_mylib.py
import pytest
from mylib import my_func
@pytest.mark.parametrize("n", range(50))
def test_test1(n):
assert my_func() is None
pytest -n 15 --tui
I think you didn't see the incomplete run issues because they only arise when a test fails.
Yeah I was able to reproduce it last night. I am not sure there's much to do about it. I export the test run's internal result representations using pickle, which often has issues with complex data structures. But I have also tried it with just about every other library out there that supposedly improves on pickle. None of them work. Including that new Chili serialization lib I looked at last night.
Do you have a burning need for this? I've had precisely two people in the world be interested in pytest-tui, and you're one of them. :-)
😆 no I'm good thanks - I'm surprised there's not more interest because on a couple of projects I'm finding when a lot of tests are failing pytest output is cumbersome - I guess not a problem if you don't get behind on test maintenance, but you know, inherited problems.
Well, of course the big hitter for post-testrun reporting is pytest-html (which I've contributed to). I didn't even intend to have an HTML report in pytest-tui when I originally wrote it - it was supposed to be a TUI only. But even fewer people than 2 were interested in that. :-) Ah well, it's been a great learning experience. BTW I have another pytest plugin (pytest-oof) that provides much if what I provide here, including the HTML report...it's just much cleaner code, basically a rewrite of the guts of pytest-tui, and sort of "productizes" the test results aspect for use as an import or a pytest hook. I'm sure the same issue would occur there, though.