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 (from pytest-rerunfailures) #272

Closed
komalc9 opened this issue May 3, 2024 · 10 comments
Labels

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

@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

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

@komalc9
Copy link
Author

komalc9 commented May 22, 2024

i used below command:
pytest name_of_test

@komalc9
Copy link
Author

komalc9 commented May 28, 2024

What else is required?

@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.

@Zac-HD Zac-HD changed the title The teardown does not execute properly for session level fixture when we use --reruns The teardown does not execute properly for session level fixture when we use --reruns (from pytest-rerunfailures) Jul 6, 2024
@Zac-HD Zac-HD transferred this issue from pytest-dev/pytest Jul 6, 2024
@GeorgeAtKistler
Copy link

I think I see the same issue: #274

@icemac
Copy link
Contributor

icemac commented Sep 13, 2024

Pytest 8.2 is not yet supported, see #267. So closing this issue in favor of that one.

@icemac icemac closed this as not planned Won't fix, can't repro, duplicate, stale Sep 13, 2024
@icemac icemac added the invalid label Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants