10👍
Use -l
/--showlocals
option:
pytest --showlocals # show local variables in tracebacks pytest -l # show local variables (shortcut)
example:
def foo():
a = 1
> assert 0
E assert 0
a = 1
test_foo.py:8: AssertionError
Source:stackexchange.com