pytest-tornasync icon indicating copy to clipboard operation
pytest-tornasync copied to clipboard

Tests fail when pytest-timeout is installed - or maybe there's another cause

Open juliangilbey opened this issue 4 years ago • 1 comments

Here's the output I'm getting when running the test suite:

.../pytest-tornasync $ pytest-3
============================= test session starts ==============================
platform linux -- Python 3.9.1+, pytest-6.0.2, py-1.10.0, pluggy-0.13.0
PyQt5 5.15.2 -- Qt runtime 5.15.2 -- Qt compiled 5.15.2
rootdir: /home/jdg/debian/spyder-packages/pytest-tornasync/build-area/pytest-tornasync-0.6.0+git20190716.9f1bdee, configfile: pytest.ini, testpaths: test
plugins: lazy-fixture-0.5.1, hypothesis-5.43.3, qt-3.2.2, anyio-0.0.0, mock-1.10.4, timeout-1.4.1, cov-2.10.1, xvfb-1.2.0, flaky-3.7.0
collected 10 items                                                             

test/test_plugin.py ..EEExsE
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/usr/lib/python3/dist-packages/_pytest/main.py", line 240, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/usr/lib/python3/dist-packages/_pytest/main.py", line 296, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/usr/lib/python3/dist-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 92, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 83, in <lambda>
INTERNALERROR>     self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR>   File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/usr/lib/python3/dist-packages/_pytest/main.py", line 321, in pytest_runtestloop
INTERNALERROR>     item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR>   File "/usr/lib/python3/dist-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 92, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 83, in <lambda>
INTERNALERROR>     self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR>   File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 182, in _multicall
INTERNALERROR>     next(gen)  # first yield
INTERNALERROR>   File "/usr/lib/python3/dist-packages/pytest_timeout.py", line 102, in pytest_runtest_protocol
INTERNALERROR>     func_only = get_func_only_setting(item)
INTERNALERROR>   File "/usr/lib/python3/dist-packages/pytest_timeout.py", line 264, in get_func_only_setting
INTERNALERROR>     settings = get_params(item, marker=marker)
INTERNALERROR>   File "/usr/lib/python3/dist-packages/pytest_timeout.py", line 279, in get_params
INTERNALERROR>     settings = _parse_marker(item.get_closest_marker(name="timeout"))
INTERNALERROR>   File "/usr/lib/python3/dist-packages/pytest_timeout.py", line 309, in _parse_marker
INTERNALERROR>     raise TypeError("Invalid keyword argument for timeout marker: %s" % kw)
INTERNALERROR> TypeError: Invalid keyword argument for timeout marker: seconds

======== 2 passed, 1 skipped, 1 xfailed, 2 warnings, 4 errors in 0.04s =========

It looks as though it may be interpreting @pytest.mark.timeout(seconds=10) using the pytest-timeout plugin rather than your plugin. Any suggestions?

Thanks!

juliangilbey avatar Feb 08 '21 21:02 juliangilbey

Oh dear. I removed the pytest-timeout plugin and that made things differently bad:

test/test_plugin.py:95
  /tmp/autopkgtest.jdEbbc/build.5FP/src/test/test_plugin.py:95: PytestUnknownMarkWarning: Unknown pytest.mark.timeout - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/mark.html
    @pytest.mark.timeout(seconds=0.1)

-- Docs: https://docs.pytest.org/en/stable/warnings.html

juliangilbey avatar Feb 09 '21 13:02 juliangilbey