You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From several years ago until recently (works in 8.0.2, doesn't work in 8.1.1), it was possible to get teardown exception information in pytest_fixture_post_finalizer by calling sys.exc_info(). This appears to have changed with the following commit: 434282e#diff-49027cfd80e14edac9b0fae71f7228a408a09599f66a7815839ce8c3ae2ab84fL1020-R1043, which moved the hook call from inside the finally block to before the exception is (re)raised.
Perhaps there's another way to get at this information, but I wasn't able to find it by reading documentation, searching the web, or trying to read the source code. I was able to make things work again by somewhat rearranging the new code.
This was first encountered in CI images that I believe were based off of Ubuntu 22.04, but I was able to reproduce on macOS Monterey.
Here is the code for my attempt at a minimal example:
From several years ago until recently (works in 8.0.2, doesn't work in 8.1.1), it was possible to get teardown exception information in
pytest_fixture_post_finalizer
by callingsys.exc_info()
. This appears to have changed with the following commit: 434282e#diff-49027cfd80e14edac9b0fae71f7228a408a09599f66a7815839ce8c3ae2ab84fL1020-R1043, which moved the hook call from inside the finally block to before the exception is (re)raised.Perhaps there's another way to get at this information, but I wasn't able to find it by reading documentation, searching the web, or trying to read the source code. I was able to make things work again by somewhat rearranging the new code.
This was first encountered in CI images that I believe were based off of Ubuntu 22.04, but I was able to reproduce on macOS Monterey.
Here is the code for my attempt at a minimal example:
conftest.py
test_repro.py
Against 8.0.2, this prints
Saw exception!
, andpip list
has the following output:Against 8.1.1, this prints
Didn't see exception
, andpip list
has the following output:Against 8.2.0, this still prints
Didn't see exception
, andpip list
has the following output:Against a branch I created in a fork of pytest to check that I'm right about this issue (main...mchase-nasuni:pytest:mchase-nasuni-internal-testing), this prints
Saw exception!
, andpip list
has the following output:The text was updated successfully, but these errors were encountered: