-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
ExceptionGroup traceback of session fixture unlimitedly grows from test to test #12204
Comments
Interesting, thanks for the report. ProblemFirst, this is actually not specific to ExceptionGroup, this happens for every exception, it's just that we haven't implemented pretty-printing for ExceptionGroup yet so it's more visible. But with So what happens is, when the session fixture is first requested by the first test, it is executed, raises, and the exception is cached as the result of the fixture. When the next test requests the fixture, we see the cached exception and re-raise it. But in python, exception objects are mutable; whenever you Example
import traceback
def bad():
1 / 0
cache = None
def foo():
global cache
if cache is not None:
raise cache
try:
bad()
except Exception as exc:
cache = exc
raise
try:
foo()
except Exception:
traceback.print_exc()
print('\n')
try:
foo()
except Exception:
traceback.print_exc()
print('\n')
try:
foo()
except Exception:
traceback.print_exc() Output:
SolutionThe solution is to keep the original traceback, and re-raise with it. Turns out, this is how it was done in pytest < 8.0, before I mindlessly broke it in #11208 / 9d0ddb4. So I need to revert this. BTW, there is another place where we do this raising of cached exception thing, in |
…nger and longer Fix pytest-dev#12204.
My session fixture can raise
ExceptionGroup
and I see huge traceback which grows unlimitedly from test to test.pip list:
Operation system: macOS 14.3
Python: 3.12.0
Example:
With such code I get 495 lines of logs:
Details
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 345, in from_call
| result: Optional[TResult] = func()
| ^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 266, in
| lambda: ihook(item=item, **kwds), when=when, reraise=reraise
| ^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_hooks.py", line 493, in call
| return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_manager.py", line 115, in _hookexec
| return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 113, in _multicall
| raise exception.with_traceback(exception.traceback)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/unraisableexception.py", line 85, in pytest_runtest_setup
| yield from unraisable_exception_runtest_hook()
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/unraisableexception.py", line 65, in unraisable_exception_runtest_hook
| yield
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/logging.py", line 833, in pytest_runtest_setup
| yield from self._runtest_for(item, "setup")
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/logging.py", line 822, in _runtest_for
| yield
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/capture.py", line 877, in pytest_runtest_setup
| return (yield)
| ^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/threadexception.py", line 82, in pytest_runtest_setup
| yield from thread_exception_runtest_hook()
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/threadexception.py", line 63, in thread_exception_runtest_hook
| yield
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 77, in _multicall
| res = hook_impl.function(*args)
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 161, in pytest_runtest_setup
| item.session._setupstate.setup(item)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 517, in setup
| raise exc
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 514, in setup
| col.setup()
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/python.py", line 1839, in setup
| self._request._fillfixtures()
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 693, in _fillfixtures
| item.funcargs[argname] = self.getfixturevalue(argname)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 547, in getfixturevalue
| fixturedef = self._get_active_fixturedef(argname)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 566, in _get_active_fixturedef
| self._compute_fixture_value(fixturedef)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 652, in _compute_fixture_value
| fixturedef.execute(request=subrequest)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 1095, in execute
| result = ihook.pytest_fixture_setup(fixturedef=self, request=request)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_hooks.py", line 493, in call
| return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_manager.py", line 115, in _hookexec
| return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 113, in _multicall
| raise exception.with_traceback(exception.traceback)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/setuponly.py", line 36, in pytest_fixture_setup
| return (yield)
| ^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 77, in _multicall
| res = hook_impl.function(*args)
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 1149, in pytest_fixture_setup
| result = call_fixture_func(fixturefunc, request, kwargs)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 923, in call_fixture_func
| fixture_result = fixturefunc(**kwargs)
| ^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/Projects/test/tests/test_foo.py", line 6, in f1
| raise ExceptionGroup('', [ValueError('foo')])
| ExceptionGroup: (1 sub-exception)
+-+---------------- 1 ----------------
| ValueError: foo
+------------------------------------
_________________________ ERROR at setup of test_smth2 _________________________
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 345, in from_call
| result: Optional[TResult] = func()
| ^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 266, in
| lambda: ihook(item=item, **kwds), when=when, reraise=reraise
| ^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_hooks.py", line 493, in call
| return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_manager.py", line 115, in _hookexec
| return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 113, in _multicall
| raise exception.with_traceback(exception.traceback)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/unraisableexception.py", line 85, in pytest_runtest_setup
| yield from unraisable_exception_runtest_hook()
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/unraisableexception.py", line 65, in unraisable_exception_runtest_hook
| yield
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/logging.py", line 833, in pytest_runtest_setup
| yield from self._runtest_for(item, "setup")
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/logging.py", line 822, in _runtest_for
| yield
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/capture.py", line 877, in pytest_runtest_setup
| return (yield)
| ^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/threadexception.py", line 82, in pytest_runtest_setup
| yield from thread_exception_runtest_hook()
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/threadexception.py", line 63, in thread_exception_runtest_hook
| yield
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 77, in _multicall
| res = hook_impl.function(*args)
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 161, in pytest_runtest_setup
| item.session._setupstate.setup(item)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 517, in setup
| raise exc
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 514, in setup
| col.setup()
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/python.py", line 1839, in setup
| self._request._fillfixtures()
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 693, in _fillfixtures
| item.funcargs[argname] = self.getfixturevalue(argname)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 547, in getfixturevalue
| fixturedef = self._get_active_fixturedef(argname)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 566, in _get_active_fixturedef
| self._compute_fixture_value(fixturedef)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 652, in _compute_fixture_value
| fixturedef.execute(request=subrequest)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 1085, in execute
| raise exc
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 345, in from_call
| result: Optional[TResult] = func()
| ^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 266, in
| lambda: ihook(item=item, **kwds), when=when, reraise=reraise
| ^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_hooks.py", line 493, in call
| return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_manager.py", line 115, in _hookexec
| return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 113, in _multicall
| raise exception.with_traceback(exception.traceback)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/unraisableexception.py", line 85, in pytest_runtest_setup
| yield from unraisable_exception_runtest_hook()
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/unraisableexception.py", line 65, in unraisable_exception_runtest_hook
| yield
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/logging.py", line 833, in pytest_runtest_setup
| yield from self._runtest_for(item, "setup")
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/logging.py", line 822, in _runtest_for
| yield
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/capture.py", line 877, in pytest_runtest_setup
| return (yield)
| ^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/threadexception.py", line 82, in pytest_runtest_setup
| yield from thread_exception_runtest_hook()
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/threadexception.py", line 63, in thread_exception_runtest_hook
| yield
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 77, in _multicall
| res = hook_impl.function(*args)
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 161, in pytest_runtest_setup
| item.session._setupstate.setup(item)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 517, in setup
| raise exc
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 514, in setup
| col.setup()
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/python.py", line 1839, in setup
| self._request._fillfixtures()
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 693, in _fillfixtures
| item.funcargs[argname] = self.getfixturevalue(argname)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 547, in getfixturevalue
| fixturedef = self._get_active_fixturedef(argname)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 566, in _get_active_fixturedef
| self._compute_fixture_value(fixturedef)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 652, in _compute_fixture_value
| fixturedef.execute(request=subrequest)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 1095, in execute
| result = ihook.pytest_fixture_setup(fixturedef=self, request=request)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_hooks.py", line 493, in call
| return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_manager.py", line 115, in _hookexec
| return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 113, in _multicall
| raise exception.with_traceback(exception.traceback)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/setuponly.py", line 36, in pytest_fixture_setup
| return (yield)
| ^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 77, in _multicall
| res = hook_impl.function(*args)
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 1149, in pytest_fixture_setup
| result = call_fixture_func(fixturefunc, request, kwargs)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 923, in call_fixture_func
| fixture_result = fixturefunc(**kwargs)
| ^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/Projects/test/tests/test_foo.py", line 6, in f1
| raise ExceptionGroup('', [ValueError('foo')])
| ExceptionGroup: (1 sub-exception)
+-+---------------- 1 ----------------
| ValueError: foo
+------------------------------------
_________________________ ERROR at setup of test_smth3 _________________________
Exception Group Traceback (most recent call last):
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 345, in from_call
| result: Optional[TResult] = func()
| ^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 266, in
| lambda: ihook(item=item, **kwds), when=when, reraise=reraise
| ^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_hooks.py", line 493, in call
| return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_manager.py", line 115, in _hookexec
| return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 113, in _multicall
| raise exception.with_traceback(exception.traceback)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/unraisableexception.py", line 85, in pytest_runtest_setup
| yield from unraisable_exception_runtest_hook()
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/unraisableexception.py", line 65, in unraisable_exception_runtest_hook
| yield
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/logging.py", line 833, in pytest_runtest_setup
| yield from self._runtest_for(item, "setup")
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/logging.py", line 822, in _runtest_for
| yield
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/capture.py", line 877, in pytest_runtest_setup
| return (yield)
| ^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/threadexception.py", line 82, in pytest_runtest_setup
| yield from thread_exception_runtest_hook()
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/threadexception.py", line 63, in thread_exception_runtest_hook
| yield
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 77, in _multicall
| res = hook_impl.function(*args)
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 161, in pytest_runtest_setup
| item.session._setupstate.setup(item)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 517, in setup
| raise exc
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 514, in setup
| col.setup()
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/python.py", line 1839, in setup
| self._request._fillfixtures()
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 693, in _fillfixtures
| item.funcargs[argname] = self.getfixturevalue(argname)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 547, in getfixturevalue
| fixturedef = self._get_active_fixturedef(argname)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 566, in _get_active_fixturedef
| self._compute_fixture_value(fixturedef)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 652, in _compute_fixture_value
| fixturedef.execute(request=subrequest)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 1085, in execute
| raise exc
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 345, in from_call
| result: Optional[TResult] = func()
| ^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 266, in
| lambda: ihook(item=item, **kwds), when=when, reraise=reraise
| ^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_hooks.py", line 493, in call
| return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_manager.py", line 115, in _hookexec
| return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 113, in _multicall
| raise exception.with_traceback(exception.traceback)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/unraisableexception.py", line 85, in pytest_runtest_setup
| yield from unraisable_exception_runtest_hook()
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/unraisableexception.py", line 65, in unraisable_exception_runtest_hook
| yield
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/logging.py", line 833, in pytest_runtest_setup
| yield from self._runtest_for(item, "setup")
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/logging.py", line 822, in _runtest_for
| yield
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/capture.py", line 877, in pytest_runtest_setup
| return (yield)
| ^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/threadexception.py", line 82, in pytest_runtest_setup
| yield from thread_exception_runtest_hook()
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/threadexception.py", line 63, in thread_exception_runtest_hook
| yield
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 77, in _multicall
| res = hook_impl.function(*args)
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 161, in pytest_runtest_setup
| item.session._setupstate.setup(item)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 517, in setup
| raise exc
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 514, in setup
| col.setup()
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/python.py", line 1839, in setup
| self._request._fillfixtures()
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 693, in _fillfixtures
| item.funcargs[argname] = self.getfixturevalue(argname)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 547, in getfixturevalue
| fixturedef = self._get_active_fixturedef(argname)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 566, in _get_active_fixturedef
| self._compute_fixture_value(fixturedef)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 652, in _compute_fixture_value
| fixturedef.execute(request=subrequest)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 1085, in execute
| raise exc
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 345, in from_call
| result: Optional[TResult] = func()
| ^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 266, in
| lambda: ihook(item=item, **kwds), when=when, reraise=reraise
| ^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_hooks.py", line 493, in call
| return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_manager.py", line 115, in _hookexec
| return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 113, in _multicall
| raise exception.with_traceback(exception.traceback)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/unraisableexception.py", line 85, in pytest_runtest_setup
| yield from unraisable_exception_runtest_hook()
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/unraisableexception.py", line 65, in unraisable_exception_runtest_hook
| yield
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/logging.py", line 833, in pytest_runtest_setup
| yield from self._runtest_for(item, "setup")
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/logging.py", line 822, in _runtest_for
| yield
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/capture.py", line 877, in pytest_runtest_setup
| return (yield)
| ^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/threadexception.py", line 82, in pytest_runtest_setup
| yield from thread_exception_runtest_hook()
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/threadexception.py", line 63, in thread_exception_runtest_hook
| yield
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 77, in _multicall
| res = hook_impl.function(*args)
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 161, in pytest_runtest_setup
| item.session._setupstate.setup(item)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 517, in setup
| raise exc
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/runner.py", line 514, in setup
| col.setup()
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/python.py", line 1839, in setup
| self._request._fillfixtures()
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 693, in _fillfixtures
| item.funcargs[argname] = self.getfixturevalue(argname)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 547, in getfixturevalue
| fixturedef = self._get_active_fixturedef(argname)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 566, in _get_active_fixturedef
| self._compute_fixture_value(fixturedef)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 652, in _compute_fixture_value
| fixturedef.execute(request=subrequest)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 1095, in execute
| result = ihook.pytest_fixture_setup(fixturedef=self, request=request)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_hooks.py", line 493, in call
| return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_manager.py", line 115, in _hookexec
| return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 113, in _multicall
| raise exception.with_traceback(exception.traceback)
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 96, in _multicall
| teardown.throw(exception) # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/setuponly.py", line 36, in pytest_fixture_setup
| return (yield)
| ^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pluggy/_callers.py", line 77, in _multicall
| res = hook_impl.function(*args)
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 1149, in pytest_fixture_setup
| result = call_fixture_func(fixturefunc, request, kwargs)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/.pyenv/versions/3.12.0/lib/python3.12/site-packages/_pytest/fixtures.py", line 923, in call_fixture_func
| fixture_result = fixturefunc(**kwargs)
| ^^^^^^^^^^^^^^^^^^^^^
| File "/Users/tkukushkin/Projects/test/tests/test_foo.py", line 6, in f1
| raise ExceptionGroup('', [ValueError('foo')])
| ExceptionGroup: (1 sub-exception)
+-+---------------- 1 ----------------
| ValueError: foo
+------------------------------------
=========================== short test summary info ============================
ERROR tests/test_foo.py::test_smth1 - ExceptionGroup: (1 sub-exception)
ERROR tests/test_foo.py::test_smth2 - ExceptionGroup: (1 sub-exception)
ERROR tests/test_foo.py::test_smth3 - ExceptionGroup: (1 sub-exception)
============================== 3 errors in 0.02s ===============================
Traceback of first test: 95 lines
Traceback of second test: 159 lines
Traceback of third test: 223 lines
In more complex example with several hundred of tests I got 2.7 GiB logs :-)
The text was updated successfully, but these errors were encountered: