In my repo, we have 243 tests:
> pytest --collect-only
<snip>
======================================================= 243 tests collected in 2.48s ========================================================
A run in parallel shows 185/243 as running:
> pytest -n5
============================================================ test session starts ============================================================
platform linux -- Python 3.9.7, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
Using --randomly-seed=2570972701
<snip>
plugins: randomly-3.10.1, forked-1.3.0, instafail-0.4.2, skip-slow-0.0.2, hypothesis-6.24.0, xdist-2.4.0, anyio-3.3.4
gw0 [243] / gw1 [243] / gw2 [243] / gw3 [243] / gw4 [243]
......s........s..............s.....ssssssssssssssssssssssssssss...........................................sssssss.................ss [ 54%]
ss.......ssssssssss........s.s......s........sss.............................................................. [100%]
========================================================== short test summary info ==========================================================
SKIPPED [1] <snip>: need --slow option to run
<snip>
SKIPPED [1] <snip>: need --slow option to run
===================================================== 185 passed, 58 skipped in 59.58s ======================================================
A run in parallel with --slow
works as expected:
> pytest -n5 --slow
============================================================ test session starts ============================================================
platform linux -- Python 3.9.7, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
Using --randomly-seed=483316960
<snip}
plugins: randomly-3.10.1, forked-1.3.0, instafail-0.4.2, skip-slow-0.0.2, hypothesis-6.24.0, xdist-2.4.0, anyio-3.3.4
gw0 [243] / gw1 [243] / gw2 [243] / gw3 [243] / gw4 [243]
..................................................................................................................................... [ 54%]
.............................................................................................................. [100%]
====================================================== 243 passed in 315.03s (0:05:15) ======================================================
However, a run in parallel with --slow
and --looponfail
does not:
> pytest -f -n5 --slow
============================= test session starts ==============================
platform linux -- Python 3.9.7, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
Using --randomly-seed=1986922651
<snip>
plugins: randomly-3.10.1, forked-1.3.0, instafail-0.4.2, skip-slow-0.0.2, hypothesis-6.24.0, xdist-2.4.0, anyio-3.3.4
gw0 I / gw1 I / gw2 I / gw3 I / gw4 I
gw0 [243] / gw1 [243] / gw2 [243] / gw3 [243] / gw4 [243]
..........................s............................................. [ 29%]
........s.......s.............ssssssssssssssssssssssssssss.............. [ 59%]
s.........s.......................sssss...ssssssss..ssssssssss.......s.s [ 88%]
........................... [100%]
=========================== short test summary info ============================
SKIPPED [1] <snip>: need --slow option to run
<snip>
SKIPPED [1] <snip>: need --slow option to run
================= 185 passed, 58 skipped in 163.80s (0:02:43) ==================
############################################################ waiting for changes ############################################################
My src/tests/conftest.py
has some hypothesis
settings, no pytest
ones.
My pyproject.toml
has some packages and options:
pytest = "^6.2.5"
pytest-instafail = "^0.4.2"
pytest-randomly = "^3.10.1"
pytest-skip-slow = "^0.0.2"
pytest-xdist = "^2.4.0"
[tool.pytest.ini_options]
addopts = ["-rsxX", "--strict-markers"]
filterwarnings = [
"ignore:`np.bool` is a deprecated alias for the builtin `bool`:DeprecationWarning",
"ignore:`np.int` is a deprecated alias for the builtin `int`:DeprecationWarning",
"ignore:`np.long` is a deprecated alias for `np.compat.long`:DeprecationWarning",
"ignore:elementwise comparison failed:DeprecationWarning",
"ignore:Solution may be inaccurate:UserWarning",
"ignore:Use of `disable_window_seconds` has been deprecated:DeprecationWarning",
"ignore:You are solving a parameterized problem that is not DPP:UserWarning",
]
looponfailroots = ["src"]
minversion = 6.0
testpaths = ["src/tests"]
xfail_strict = true
question