Repository navigation
v0.4.0
Added
-
test --fastandcheck --fast: the suite in parallel.--fast
runs pytest aspytest -n <workers> -p no:cacheprovider [target], with
pytest-xdist spreading the suite across the cores;--workers/-w
takes whatpytest -ntakes (an integer,auto— the default — or
logical) and is a usage error (exit 2) without--fast. The cache
plugin is off because several workers writing.pytest_cacheat once
is a race that buys nothing. The target is forwarded and pytest's exit
code comes straight back, as in the serial run. It is a flag rather
than atest fastsubcommand becausetestalready takes a
positional path:test fastkeeps meaning thefast/folder.
Requested in mauriciobenjamin700/tempest-fastapi-sdk#328.Measured on a machine with 6 physical cores / 12 threads. On this
package's own suite (100 tests, warm environment, three runs each)
tempest-cli testtook 2.2 s andtempest-cli test --fast1.6–1.7 s
(12 workers: nopsutilhere, soautocounts logical CPUs) — worker
start-up is most of the fast run at this size. On the
tempest-fastapi-sdk suite (10 218 tests, one run each, same
invocation), pytest reported 2127 s serial and 411 s with--fast
(auto→ 6 workers, sincepsutilis installed there), about 5.2x;
both runs ended with the same 10 failures, all fromruffbeing a dead
pyenv shim on thatPATH.autois pytest-xdist's rule, not ours: physical cores whenpsutil
is importable, logical CPUs otherwise.-w logicalasks for the
threads explicitly. -
A missing pytest-xdist is a sentence, not
unrecognized arguments: -n. Before spawning,--fastasks the interpreter pytest will run
under — read from the pytest script's shebang, its siblingpython,
or the sameuv run --with pytestoverlay — whether it can import
xdist. When it cannot, the message namespytest-xdist,
tempest-cli[tools]andtempest-fastapi-sdk[tests], and the exit code
is 127, with no traceback.check --fastmakes that check before its
first step. A probe that cannot run at all is not taken as "missing":
the run proceeds and pytest reports for itself. -
run_pytest(..., fast=, workers=)andrun_full_check(..., fast=, workers=)for library callers — keyword-only, defaulting to the
serial run, so every existing call is unchanged.DEFAULT_FAST_WORKERS,
XDIST_MODULEandMISSING_TOOL_EXIT_CODEare exported from
tempest_cli.lint.
Changed
[tools]now carriespytest-xdist>=3.8.0next to mypy and pytest,
so the bundle is enough for--fast. Itsrequires-dist
(execnet>=2.1,pytest>=7.0.0) has no upper bound.