nvim-neotest / neotest-python

MIT License
126 stars 38 forks source link

Output parsing fails with `xfail(strict = True)` #5

Closed tbung closed 2 years ago

tbung commented 2 years ago

When using pytest's xfail with the option strict set, the output fails if the test XPASSes. The test is reported as passed. Output is attached below.

I can look into whats happening in a couple of days but do not have the time right now.

============================= test session starts ==============================
platform darwin -- Python 3.10.4, pytest-7.1.2, pluggy-1.0.0
rootdir: /Users/tillb/Projects/failure-detection-benchmark/main, configfile: pyproject.toml
plugins: anyio-3.6.1, syrupy-2.3.0, hydra-core-1.2.0
collected 2 items

fd_shifts/tests/test_config.py .F
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/Users/tillb/.mamba/envs/fd-shifts/lib/python3.10/site-packages/_pytest/main.py", line 268, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/Users/tillb/.mamba/envs/fd-shifts/lib/python3.10/site-packages/_pytest/main.py", line 322, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/Users/tillb/.mamba/envs/fd-shifts/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/tillb/.mamba/envs/fd-shifts/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/tillb/.mamba/envs/fd-shifts/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/Users/tillb/.mamba/envs/fd-shifts/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/Users/tillb/.mamba/envs/fd-shifts/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/Users/tillb/.mamba/envs/fd-shifts/lib/python3.10/site-packages/_pytest/main.py", line 347, in pytest_runtestloop
INTERNALERROR>     item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR>   File "/Users/tillb/.mamba/envs/fd-shifts/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/tillb/.mamba/envs/fd-shifts/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/tillb/.mamba/envs/fd-shifts/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/Users/tillb/.mamba/envs/fd-shifts/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/Users/tillb/.mamba/envs/fd-shifts/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/Users/tillb/.mamba/envs/fd-shifts/lib/python3.10/site-packages/_pytest/runner.py", line 111, in pytest_runtest_protocol
INTERNALERROR>     runtestprotocol(item, nextitem=nextitem)
INTERNALERROR>   File "/Users/tillb/.mamba/envs/fd-shifts/lib/python3.10/site-packages/_pytest/runner.py", line 130, in runtestprotocol
INTERNALERROR>     reports.append(call_and_report(item, "call", log))
INTERNALERROR>   File "/Users/tillb/.mamba/envs/fd-shifts/lib/python3.10/site-packages/_pytest/runner.py", line 223, in call_and_report
INTERNALERROR>     hook.pytest_runtest_logreport(report=report)
INTERNALERROR>   File "/Users/tillb/.mamba/envs/fd-shifts/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/tillb/.mamba/envs/fd-shifts/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/tillb/.mamba/envs/fd-shifts/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/Users/tillb/.mamba/envs/fd-shifts/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/Users/tillb/.mamba/envs/fd-shifts/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/Users/tillb/.local/share/nvim/site/pack/packer/start/neotest-python/neotest_python/pytest.py", line 61, in pytest_runtest_logreport
INTERNALERROR>     exc_repr.toterminal
INTERNALERROR> AttributeError: 'str' object has no attribute 'toterminal'

=================== 1 failed, 1 passed, 2 warnings in 0.46s ====================
rcarriga commented 2 years ago

Thanks for the report :smile: Should be working as expected now

tbung commented 2 years ago

It does! Thank you! 🎉