Skip to content

Instantly share code, notes, and snippets.

@meejah
Last active August 23, 2016 05:32
Show Gist options
  • Save meejah/78f29b41931913c5e21813e3a669316d to your computer and use it in GitHub Desktop.
Save meejah/78f29b41931913c5e21813e3a669316d to your computer and use it in GitHub Desktop.
from __future__ import print_function
import pytest
@pytest.hookimpl(hookwrapper=True)
def pytest_fixture_setup(fixturedef, request):
print("pytest_fixture_setup before", fixturedef, request)
yield
print("pytest_fixture_setup after", fixturedef, request)
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_setup(item):
print("BEFORE", item)
yield
print("AFTER", item)
@pytest.fixture
def a_fixture():
import time
time.sleep(2)
return "nothing"
def test_foo(a_fixture):
print("inside test_foo", a_fixture)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment