Skip to content

Instantly share code, notes, and snippets.

@jasonkeene
Created June 3, 2014 00:14
Show Gist options
  • Save jasonkeene/10bbb26e1990e4c32227 to your computer and use it in GitHub Desktop.
Save jasonkeene/10bbb26e1990e4c32227 to your computer and use it in GitHub Desktop.
import pytest
class Fixture():
@property
def foo(self):
raise NotImplementedError
@pytest.fixture
def myfix():
return Fixture()
@pytest.fixture
def child_fix1(myfix):
myfix.foo = "bar"
return myfix
@pytest.fixture
def child_fix2(myfix):
myfix.foo = "baz"
return myfix
def test_things(myfix, child_fix1, child_fix2):
with pytest.raises(NotImplementedError):
myfix.foo
assert child_fix1.foo == "bar"
assert child_fix2.foo == "baz"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment