Skip to content

Instantly share code, notes, and snippets.

@Sharadh
Last active July 16, 2020 04:14
Show Gist options
  • Save Sharadh/590215d0d53611974f07f027066e9f67 to your computer and use it in GitHub Desktop.
Save Sharadh/590215d0d53611974f07f027066e9f67 to your computer and use it in GitHub Desktop.
Code snippet to accompany blogpost on 5 pytest best practices
import pytest
@pytest.fixture
def first():
print("Set up first fixture")
yield
print("Clean up first fixture")
@pytest.fixture
def second(first):
print("Set up second fixture")
yield
print("Clean up second fixture")
def test_context_fixture_order(second):
print("In the test")
assert False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment