Skip to content
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

The teardown does not execute properly for session level fixture when we use --reruns #12284

Open
komalc9 opened this issue May 3, 2024 · 8 comments

Comments

@komalc9
Copy link

komalc9 commented May 3, 2024

When you will run the "test_example_fixture" test, You will observe that the teardown is never printed in console. This is restricting the clean up in my project.

NOTE: It happens only when we use rerun failed tests.

import pytest

@pytest.fixture(scope="session")
def example_fixture():
print("\nSetup")
yield
print("Teardown")

@pytest.mark.flaky(reruns=1)
def test_example_fixture(example_fixture):
assert 0

@komalc9
Copy link
Author

komalc9 commented May 3, 2024

I am using pytest 8.2 and pytest-rerunfailures 14.0

@RonnyPfannschmidt
Copy link
Member

Please provide details on what command you run

@RonnyPfannschmidt RonnyPfannschmidt added the status: needs information reporter needs to provide more information; can be closed after 2 or more weeks of inactivity label May 4, 2024
@komalc9
Copy link
Author

komalc9 commented May 4, 2024

Running directly using pycharm.

Fyi it works in pytest 8.1.0

@komalc9
Copy link
Author

komalc9 commented May 6, 2024

Also, I have tested this it works on pytest 8.1.0 but not in 8.2.0.
With pytest-rerunfailures 14.0 or 12.0

Copy link
Contributor

This issue is stale because it has the status: needs information label and requested follow-up information was not provided for 14 days.

@github-actions github-actions bot added the stale label May 21, 2024
@komalc9
Copy link
Author

komalc9 commented May 22, 2024

i used below command:
pytest name_of_test

@github-actions github-actions bot removed the stale label May 23, 2024
@komalc9
Copy link
Author

komalc9 commented May 28, 2024

What else is required?

@The-Compiler The-Compiler removed the status: needs information reporter needs to provide more information; can be closed after 2 or more weeks of inactivity label May 28, 2024
@The-Compiler
Copy link
Member

This sounds like an issue in pytest-rerunfailures rather than pytest. But given that it started appearing with pytest 8.2.0, it might still be interesting to see what change in pytest caused it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants