Replies: 2 comments 3 replies
-
We met the same behavior. @amercader Have you found any solution or explanation for this? # test_hello.py
import pytest
@pytest.fixture(autouse=True)
def hello():
print("Hello")
class TestHello:
def setup_method(self):
print("world")
# @pytest.mark.usefixtures("hello")
def test_hello(self):
pass Result: pytest -s test_hello.py
===================== test session starts =====================
platform linux -- Python 3.10.10, pytest-7.3.1, pluggy-0.13.1
rootdir: /home/ivanov_dmi/projects/pytest_fixture
collected 1 item
test_hello.py Hello
world
.
|
Beta Was this translation helpful? Give feedback.
1 reply
-
I suspect this is related to turning xunit setup/teardown into autouse fixture |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We have a big legacy test suite that uses nose-style
setup()
methods on test classes and have noticed a behavior change between pytest 6.2.5 and pytest 7.0.1.Consider the following test:
In pytest 6.2.5, first the fixtures get executed, then the
setup()
methods:In pytest 7.0.1, first the
setup()
method gets executed, then the fixtures:Looking at the Changelog I couldn't find any mention of this change, is this a regression or it is indeed the new expected behavior?
Many thanks!
Beta Was this translation helpful? Give feedback.
All reactions