|
2 | 2 |
|
3 | 3 | ## Running tests |
4 | 4 |
|
5 | | -Use Python 3.10 or newer. From the repository root, create a virtual environment: |
| 5 | +Use [tox](https://tox.wiki/) from the repository root. It creates an isolated |
| 6 | +environment and installs the project and its test dependencies: |
6 | 7 |
|
7 | 8 | ```sh |
8 | | -python -m venv .venv |
| 9 | +python -m pip install tox |
| 10 | +tox -e py |
9 | 11 | ``` |
10 | 12 |
|
11 | | -Activate it with `source .venv/bin/activate` on Linux or macOS, or |
12 | | -`.venv\Scripts\Activate.ps1` in Windows PowerShell. Then install the project and its |
13 | | -test dependencies: |
| 13 | +Pass pytest arguments after `--` to run a single file or tests matching a name: |
14 | 14 |
|
15 | 15 | ```sh |
16 | | -python -m pip install -e ".[tests]" |
17 | | -``` |
18 | | - |
19 | | -Run the full suite, a single file, or tests matching a name: |
20 | | - |
21 | | -```sh |
22 | | -python -m pytest |
23 | | -python -m pytest tests/test_number.py |
24 | | -python -m pytest tests/test_number.py -k intcomma |
| 16 | +tox -e py -- tests/test_number.py |
| 17 | +tox -e py -- tests/test_number.py -k intcomma |
25 | 18 | ``` |
26 | 19 |
|
27 | 20 | Some localisation tests are skipped when compiled `.mo` translation files are missing. |
28 | 21 | Generate them with `scripts/generate-translation-binaries.sh`, which requires Bash and |
29 | 22 | GNU gettext's `msgfmt`. Translation-update tests also require `xgettext` and `msgmerge`. |
30 | | -Use `python -m pytest -rs` to see skip reasons. |
| 23 | +Use `tox -e py -- -rs` to see skip reasons. |
31 | 24 |
|
32 | | -CI generates translation binaries and runs tests through [tox](../tox.ini). See the |
33 | | -[test workflow](workflows/test.yml) for supported Python versions and platforms. |
| 25 | +CI generates translation binaries and runs the |
| 26 | +[configured tox environments](../tox.ini). See the [test workflow](workflows/test.yml) |
| 27 | +for supported Python versions and platforms. |
34 | 28 |
|
35 | 29 | ## Linting |
36 | 30 |
|
|
0 commit comments