-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failures in nested functions beyond one level raise AssertionError
.
#44
Labels
bug
Something isn't working
Comments
TracebackTraceback (most recent call last):
File "/home/josh/.pyenv/versions/pytest-rich-3.10.6/bin/pytest", line 8, in <module>
sys.exit(console_main())
File "/home/josh/.pyenv/versions/3.10.6/envs/pytest-rich-3.10.6/lib/python3.10/site-packages/_pytest/config/__init__.py", line 190, in console_main
code = main()
File "/home/josh/.pyenv/versions/3.10.6/envs/pytest-rich-3.10.6/lib/python3.10/site-packages/_pytest/config/__init__.py", line 167, in main
ret: Union[ExitCode, int] = config.hook.pytest_cmdline_main(
File "/home/josh/.pyenv/versions/3.10.6/envs/pytest-rich-3.10.6/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
File "/home/josh/.pyenv/versions/3.10.6/envs/pytest-rich-3.10.6/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/home/josh/.pyenv/versions/3.10.6/envs/pytest-rich-3.10.6/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
return outcome.get_result()
File "/home/josh/.pyenv/versions/3.10.6/envs/pytest-rich-3.10.6/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
raise ex[1].with_traceback(ex[2])
File "/home/josh/.pyenv/versions/3.10.6/envs/pytest-rich-3.10.6/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
res = hook_impl.function(*args)
File "/home/josh/.pyenv/versions/3.10.6/envs/pytest-rich-3.10.6/lib/python3.10/site-packages/_pytest/main.py", line 317, in pytest_cmdline_main
return wrap_session(config, _main)
File "/home/josh/.pyenv/versions/3.10.6/envs/pytest-rich-3.10.6/lib/python3.10/site-packages/_pytest/main.py", line 305, in wrap_session
config.hook.pytest_sessionfinish(
File "/home/josh/.pyenv/versions/3.10.6/envs/pytest-rich-3.10.6/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
File "/home/josh/.pyenv/versions/3.10.6/envs/pytest-rich-3.10.6/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/home/josh/.pyenv/versions/3.10.6/envs/pytest-rich-3.10.6/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
return outcome.get_result()
File "/home/josh/.pyenv/versions/3.10.6/envs/pytest-rich-3.10.6/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
raise ex[1].with_traceback(ex[2])
File "/home/josh/.pyenv/versions/3.10.6/envs/pytest-rich-3.10.6/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
res = hook_impl.function(*args)
File "/home/josh/projects/pytest-rich/src/pytest_rich/terminal.py", line 213, in pytest_sessionfinish
self.console.print(tb)
File "/home/josh/.pyenv/versions/3.10.6/envs/pytest-rich-3.10.6/lib/python3.10/site-packages/rich/console.py", line 1694, in print
extend(render(renderable, render_options))
File "/home/josh/.pyenv/versions/3.10.6/envs/pytest-rich-3.10.6/lib/python3.10/site-packages/rich/console.py", line 1326, in render
for render_output in iter_render:
File "/home/josh/projects/pytest-rich/src/pytest_rich/traceback.py", line 84, in __rich_console__
self._render_chain(self.chain, options),
File "/home/josh/.pyenv/versions/3.10.6/envs/pytest-rich-3.10.6/lib/python3.10/site-packages/rich/console.py", line 510, in _replace
return Group(*renderables, fit=fit)
File "/home/josh/projects/pytest-rich/src/pytest_rich/traceback.py", line 211, in _render_chain
assert entry.reprfuncargs is not None |
AssertionError
.
Expected outcomeHandle the nested failures similar to the builtin pytest terminal reporter: _______________________________________________ test_nested_failure ________________________________________________
def test_nested_failure():
def inner():
assert False
> inner()
tests/example/test_basic.py:53:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def inner():
> assert False
E assert False
tests/example/test_basic.py:51: AssertionError
___________________________________________ test_doubly_nested_failures ____________________________________________
def test_doubly_nested_failures():
def inner():
def inner_inner():
assert False
inner_inner()
> inner()
tests/example/test_basic.py:63:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/example/test_basic.py:61: in inner
inner_inner()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def inner_inner():
> assert False
E assert False
tests/example/test_basic.py:59: AssertionError
___________________________________________ test_triply_nested_failures ____________________________________________
def test_triply_nested_failures():
def inner():
def inner_inner():
def inner_inner_inner():
assert False
inner_inner_inner()
inner_inner()
> inner()
tests/example/test_basic.py:76:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/example/test_basic.py:74: in inner
inner_inner()
tests/example/test_basic.py:72: in inner_inner
inner_inner_inner()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def inner_inner_inner():
> assert False
E assert False |
Problem lines: pytest-rich/src/pytest_rich/traceback.py Lines 211 to 214 in a21a521
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Failures in nested functions beyond one level raise
AssertionError
.Basic reproduction:
The first function
test_nested_failures
fails as expected and prints the failure to the console, the other two raise anAssertionError
and the test run quits.The text was updated successfully, but these errors were encountered: