Skip to content

Commit a535f3f

Browse files
committed
Document optional test suites, update changelog
1 parent 1f09a8c commit a535f3f

File tree

3 files changed

+71
-1
lines changed

3 files changed

+71
-1
lines changed

CHANGES.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ Unreleased
1414
with a dedicated CI job. :pr:`3139`
1515
- Fix callable ``flag_value`` being instantiated when used as a default via
1616
``default=True``. :issue:`3121` :pr:`3201` :pr:`3213` :pr:`3225`
17+
- Add optional randomized parallel test execution using ``pytest-randomly`` and
18+
``pytest-xdist`` to detect test pollution and race conditions. :pr:`3151`
19+
- Add contributor documentation for running stress tests, randomized
20+
parallel tests, and Flask smoke tests. :pr:`3151` :pr:`3177`
1721

1822
Version 8.3.1
1923
--------------

docs/contributing.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Contributing to Click
2+
3+
These guidelines are particular to Click and complement the `general ones for all Pallets projects <https://palletsprojects.com/contributing/>`_.
4+
5+
## Running the Test Suite
6+
7+
The default invocation runs the fast unit tests:
8+
9+
```shell-session
10+
$ tox
11+
```
12+
13+
Or without tox:
14+
15+
```shell-session
16+
$ pytest
17+
```
18+
19+
### Stress Tests
20+
21+
These are a collection of long-running tests that reproduce race conditions in `CliRunner`. They are marked with `@pytest.mark.stress`.
22+
23+
Run them with the dedicated tox environment:
24+
25+
```shell-session
26+
$ tox -e stress-py3.14
27+
```
28+
29+
Or directly with pytest:
30+
31+
```shell-session
32+
$ pytest tests/test_stream_lifecycle.py -m stress -x --override-ini="addopts="
33+
```
34+
35+
These tests run 30_000 iterations each and take a long time. Use `-x` to stop at the first failure.
36+
37+
### Randomized & Parallel Tests
38+
39+
Runs the full test suite in random order across multiple processes to detect test pollution and race conditions. This uses `pytest-randomly` and `pytest-xdist`.
40+
41+
```shell-session
42+
$ tox -e random
43+
```
44+
45+
You can reproduce a specific ordering by passing the seed printed at the start of the run:
46+
47+
```shell-session
48+
$ tox -e random -- -p randomly -p no:randomly -p randomly --randomly-seed=12345
49+
```
50+
51+
### Flask Smoke Tests
52+
53+
A CI workflow (`.github/workflows/test-flask.yaml`) runs Flask's own test suite against Click's `main` branch. This catches regressions that would break Flask, Click's primary downstream consumer.
54+
55+
The workflow clones Flask, installs it, then overrides Click with the current branch. To replicate locally:
56+
57+
```shell-session
58+
$ git clone https://github.com/pallets/flask
59+
$ cd flask
60+
$ uv venv --python 3.14
61+
$ uv sync --all-extras
62+
$ uv run --with "git+https://github.com/pallets/click.git@main" -- pytest
63+
```
64+
65+
Replace `@main` with your branch or a local path (`-e /path/to/click`) to test local changes.

docs/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,14 @@ About Project
133133

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

136-
* `Contributing <https://palletsprojects.com/contributing/>`_
136+
* `General Contributing Guidelines <https://palletsprojects.com/contributing/>`_
137137

138138
* `Donate <https://palletsprojects.com/donate>`_
139139

140140
.. toctree::
141141
:maxdepth: 1
142142

143+
contributing
143144
contrib
144145
license
145146
changes

0 commit comments

Comments
 (0)