say have file fixtures.py defines simple py.test fixture called foobar.
normally have import fixture use (including of sub-fixtures), this:
from fixtures import foobar def test_bazinga(foobar): note don't want use star import.
how import fixture can write:
import fixtures def test_bazinga(foobar): is possible? seems it, because py.test defines such fixtures (e.g. monkeypatch).
fixtures , visibility bit odd in pytest. don't require importing, if defined them in test_*.py file, they'll available in file.
you can put them in (project- or subfolder-wide) conftest.py use them in multiple files.
pytest-internal fixtures defined in core plugin, , available everywhere. in fact, conftest.py nothing else per-directory plugin.
you can run py.test --fixtures see fixtures coming from.
Comments
Post a Comment