https://pantsbuild.org/ logo
f

fierce-park-88503

11/05/2018, 8:04 PM
what are strategies for using shared pytest fixtures? importing them in the tests that use them stops working when the fixtures you import themselves depend on other fixtures. e.g.:
Copy code
# my_fixtures.py

@pytest.fixture
def foo():
  yield 'foo'

@pytest.fixture
def foobar(foo):
  yield foo + 'bar'
Copy code
from my_fixtures import foobar

def test_foobar(foobar):
  assert foobar == 'foobar'
the
foobar
fixture will fail to initialize because
foo
isn’t in pytest’s search path for fixtures