Skip to content

Instantly share code, notes, and snippets.

@masiarek
Created September 2, 2022 12:33
Show Gist options
  • Save masiarek/4b99ad430f0ae4d69cb179ade8c63432 to your computer and use it in GitHub Desktop.
Save masiarek/4b99ad430f0ae4d69cb179ade8c63432 to your computer and use it in GitHub Desktop.
import pytest
@pytest.fixture(autouse=True, scope="module")
def fix_module():
print("\nFix module setup")
yield
print("\nFix module teardown")
@pytest.fixture(autouse=True, scope="function")
def fix_function():
print("\nFix function setup")
yield
print("\nFix function teardown")
@pytest.fixture()
def blue():
print("\nFix blue setup")
yield
print("\nFix blue teardown")
@pytest.fixture()
def green():
print("\nFix green setup")
yield
print("\nFix green teardown")
def test_one(blue, green):
print("Test one")
def test_two(green,blue):
print("Test two")
@masiarek
Copy link
Author

masiarek commented Sep 2, 2022

Why am I not getting the expected messages “setup” and “teardown”?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment