Repository navigation
Releases: tuppl/pytest-sources
Releases · tuppl/pytest-sources
Release list
v0.3.0
Full Changelog: v0.2.1...v0.3.0
v0.2.1
Fixed
- Fixed missing tests whose source wasn't the first parameter in the node id so they were treated as belonging to no source.
Full Changelog: v0.2.0...v0.2.1
v0.2.0
New Features
@pytest.mark.sources(*globs)now adds its sources to the run instead of narrowing the--sourcesset. A collection pass before the run finds marked sources, so they are scheduled, summarised and given a failure budget like declared ones.--skip-marker-sources(iniskip_marker_sources) skips tests carrying asourcesmarker, and the extra collection pass that finds them.- A report header giving the source count, worker count and work items. Without workers it says so, and points at
-n auto. source_foris exported from the package.
Changes
- Workers are opt-in. Passing
--sourcesno longer starts them on your behalf; use-nas with plain pytest-xdist.-n autostarts one worker per source, capped at the CPU count. --sources-maxfailis shared across processes through a per-run file, so it now combines with--dist loadfile,loadscopeandloadgroup. The budget there is at mostNfailures plus any tests already running when the limit is reached. It is refused alongside a--txspec that puts workers on another machine.- Spare workers are dealt to whichever source currently has the largest work item, rather than splitting every source equally. Five workers over three sources now use all five instead of leaving two idle.
- Documentation moved to
docs/GUIDE.mdanddocs/DESIGN.md, leaving the README as a reference. - Pipeline stage modules are separated from a
_core/package.from pytest_sources.source import ...no longer resolves; the top level package API is unchanged.
Fixed
- A test that parametrises its own
sourceargument is rejected with a usage error instead of silently colliding with the fanout. - The summary no longer fails on a test outcome it does not recognise, such as one another plugin introduces.
Full Changelog: v0.1.0...v0.2.0
v0.1.0
Run one test suite against many source trees. Every collected test runs once per source directory, with the source importable and the working directory inside it.
pytest --sources "sources/*"Isolation
- One process per source by default, so a crash or a hang takes down one submission rather than the run
- Workers are recycled between sources, so
sys.modules, globals and monkeypatching never leak across them - Composes with xdist's
--dist loadfile,loadscopeandloadgroup, which group within a source instead of replacing it - Warns when a module a source provides is already imported from elsewhere, which would otherwise grade every source against the same code
Writing tests
- Tests need no fixture to be fanned out; the source is on
sys.pathand is the working directory either way sourcefixture for when the test needs the identity:source.id,source.name,source.path,source / "data.txt",source.import_module(),source.chdir()@pytest.mark.sources("sources/*_alt")narrows one test to a subset@pytest.mark.no_sourcesruns a test once,@pytest.mark.no_chdirkeeps the invocation directory
Reporting
- Per-source results table after every run, with
passed,failed,error,skipped,xfailed,xpassedand time --sources-summary sources|testsfor a grid of source × test, either orientation--sources-maxfail=Ngives each source its own failure budget, so one bad submission doesn't end the run
Configuration
--sourcesis repeatable, or setsources = [...]in your ini--sources-delimiterchanges the test ID separator if your paths contain+- Test IDs are source paths relative to the rootdir, so
-k,--lfand nodeid selection work as usual
Known limitation
-n 0 and --dist no run every source in the calling process. That trades isolation for a debuggable single-process run; any other worker count gives each source its own.
Supported
Python 3.12–3.14, pytest 8–9, pytest-xdist 3.8+. Fully typed.