Skip to content

Commit 9e6c5e8

Browse files
committed
Randomize tests and run them in parallel
Document optional test suites
1 parent 1339fd3 commit 9e6c5e8

File tree

5 files changed

+84
-2
lines changed

5 files changed

+84
-2
lines changed

CHANGES.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ Unreleased
1313
``semver.Version``. :issue:`3298` :pr:`3299`
1414
- Fix pager test pollution under parallel execution by using pytest's
1515
``tmp_path`` fixture instead of a shared temporary file path. :pr:`3238`
16+
- Add optional randomized parallel test execution using ``pytest-randomly`` and
17+
``pytest-xdist`` to detect test pollution and race conditions. :pr:`3151`
18+
- Add contributor documentation for running stress tests, randomized
19+
parallel tests, and Flask smoke tests. :pr:`3151` :pr:`3177`
1620

1721
Version 8.3.2
1822
-------------

docs/contributing.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Contributing
2+
3+
This is a quick reference for Click-specific development tasks. For setting up the development environment and the general contribution workflow, see the Pallets [quick reference](https://palletsprojects.com/contributing/quick/) and the [detailed contributing guide](https://palletsprojects.com/contributing/).
4+
5+
## Extra Test Environments
6+
7+
Click includes some extra test environments:
8+
9+
- `tox r -e stress` runs stress tests for race conditions in Click's test runner.
10+
11+
```shell-session
12+
$ tox r -e stress
13+
```
14+
15+
- `tox r -e random` runs tests in parallel in a random order to detect test pollution.
16+
17+
```shell-session
18+
$ tox r -e random
19+
```
20+
21+
- A CI workflow (`.github/workflows/test-flask.yaml`) runs Flask's test suite to catch downstream regressions.

docs/index.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,12 @@ About Project
133133

134134
* `Version Policy <https://palletsprojects.com/versions>`_
135135

136-
* `Contributing <https://palletsprojects.com/contributing/>`_
137-
138136
* `Donate <https://palletsprojects.com/donate>`_
139137

140138
.. toctree::
141139
:maxdepth: 1
142140

141+
contributing
143142
contrib
144143
license
145144
changes

pyproject.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ pre-commit = [
5151
tests = [
5252
"pytest",
5353
]
54+
tests-random = [
55+
"pytest",
56+
"pytest-randomly",
57+
"pytest-xdist",
58+
]
5459
typing = [
5560
"mypy",
5661
"pyright",
@@ -165,6 +170,15 @@ commands = [[
165170
{replace = "posargs", default = [], extend = true},
166171
]]
167172

173+
[tool.tox.env.random]
174+
description = "randomized parallel tests to detect test pollution and race conditions"
175+
dependency_groups = ["tests-random"]
176+
commands = [[
177+
"pytest", "-v", "--tb=short", "--numprocesses=auto",
178+
"--basetemp={env_tmp_dir}",
179+
{replace = "posargs", default = [], extend = true},
180+
]]
181+
168182
[tool.tox.env.stress]
169183
description = "stress tests for stream lifecycle race conditions"
170184
commands = [[

uv.lock

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)