August 2018
Beginner
160 pages
4h 8m
English
conftest.py files are imported during collection, so they directly affect your experience when running tests from the command line. For this reason, I suggest using local imports in conftest.py files as often as possible, to keep import times low.
So, don't use this:
import pytestimport tempfilefrom myapp import setup@pytest.fixturedef setup_app(): ...
Prefer local imports:
import pytest@pytest.fixturedef setup_app(): import tempfile from myapp import setup ...
This practice has a noticeable impact on test startup in large test suites.
Read now
Unlock full access