-
Notifications
You must be signed in to change notification settings - Fork 84
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
pytest_runtest_logreport does not report "teardown" when using pytest-rerunfailures #237
Open
4 tasks done
Comments
Changing the example code to fail in the teardown instead: import pytest
@pytest.fixture
def fix():
assert True
yield
print("\nTEARDOWN CALLED")
assert False
@pytest.mark.flaky(reruns=1)
def test_logreport(fix):
assert True yields the expected output: ============================= test session starts ==============================
platform darwin -- Python 3.9.10, pytest-7.4.2, pluggy-1.3.0
rootdir: /Users/jimbrannlund/dev/pytest-logreport-rerunfailure
plugins: rerunfailures-12.0
collected 1 item
test_reportlog.py
TEARDOWN CALLED
WHEN: setup
.
WHEN: call
R
WHEN: teardown
TEARDOWN CALLED
WHEN: setup
.
WHEN: call
E
WHEN: teardown
==================================== ERRORS ====================================
_____________________ ERROR at teardown of test_logreport ______________________
@pytest.fixture
def fix():
assert True
yield
print("\nTEARDOWN CALLED")
> assert False
E assert False
test_reportlog.py:8: AssertionError
=========================== short test summary info ============================
ERROR test_reportlog.py::test_logreport - assert False
===================== 2 passed, 1 error, 1 rerun in 0.02s ====================== So maybe this works as intended (even if I don't quite understand why)? |
so as far as i can tell this is a issue with rerunfailures, not pytest-core |
This comment was marked as resolved.
This comment was marked as resolved.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
When using the
pytest-rerunfailures
plugin and marking a test as "flaky", thepytest_runtest_logreport
-hook is only called for the last occurrence of a "teardown" despite it still being run (evident in the output below).pip list
Python: 3.9.10
OS: osx 12.3 (M1 MacBook Pro)
Example:
Output:
pip list
from the virtual environment you are usingThe text was updated successfully, but these errors were encountered: