Open
Description
Consider the following file:
import pytest
@pytest.fixture(scope="function")
def myfixture():
print("enter fixture")
yield
assert False, "fixture fails in teardown"
def test_foo(myfixture):
pytest.exit("foo")
Run this with pytest --junit-xml=junit.xml
. The exit code is 1, which, per the documentation, means “some of the tests failed”. However, if you examine junit.xml
, it does not record any failed tests! I’m not sure whether the exit code ought to be 2 (because of the pytest.exit
call) or whether the test teardown ought to be recorded as a failure in junit.xml
(because of the assertion failure, and the exit code remain 1 in this case), and I don’t really care that much which one happens, but it ought to be one or the other.
This happened on Pytest 6.2.4 under Linux.