From b73976d0bfcd26f2afff6fc987e404ec6ae7931e Mon Sep 17 00:00:00 2001 From: Yusuf Efe <120668197+yuefdev@users.noreply.github.com> Date: Sat, 3 Oct 2026 05:44:22 +0300 Subject: [PATCH 1/3] Document local test setup and pytest commands Fixes #430. --- .github/CONTRIBUTING.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 19549180..5aafc7a7 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,5 +1,38 @@ # Contributing +## Running tests + +Use Python 3.10 or newer. From the repository root, create a virtual environment: + +```sh +python -m venv .venv +``` + +Activate it with `source .venv/bin/activate` on Linux or macOS, or +`.venv\Scripts\Activate.ps1` in Windows PowerShell. Then install the project and +its test dependencies: + +```sh +python -m pip install -e ".[tests]" +``` + +Run the full suite, a single file, or tests matching a name: + +```sh +python -m pytest +python -m pytest tests/test_number.py +python -m pytest tests/test_number.py -k intcomma +``` + +Some localisation tests are skipped when compiled `.mo` translation files are +missing. Generate them with `scripts/generate-translation-binaries.sh`, which +requires Bash and GNU gettext's `msgfmt`. Translation-update tests also require +`xgettext` and `msgmerge`. Use `python -m pytest -rs` to see skip reasons. + +CI generates translation binaries and runs tests through [tox](../tox.ini). +See the [test workflow](workflows/test.yml) for supported Python versions and +platforms. + ## Linting Linting is run on the CI using [prek](https://prek.j178.dev//), and can be run locally: From 3c2ca4edd6396fa2e8e80d6c26e02fec3d63fbe9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 3 Oct 2026 02:44:36 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .github/CONTRIBUTING.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 5aafc7a7..7ab23525 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -9,8 +9,8 @@ python -m venv .venv ``` Activate it with `source .venv/bin/activate` on Linux or macOS, or -`.venv\Scripts\Activate.ps1` in Windows PowerShell. Then install the project and -its test dependencies: +`.venv\Scripts\Activate.ps1` in Windows PowerShell. Then install the project and its +test dependencies: ```sh python -m pip install -e ".[tests]" @@ -24,14 +24,13 @@ python -m pytest tests/test_number.py python -m pytest tests/test_number.py -k intcomma ``` -Some localisation tests are skipped when compiled `.mo` translation files are -missing. Generate them with `scripts/generate-translation-binaries.sh`, which -requires Bash and GNU gettext's `msgfmt`. Translation-update tests also require -`xgettext` and `msgmerge`. Use `python -m pytest -rs` to see skip reasons. +Some localisation tests are skipped when compiled `.mo` translation files are missing. +Generate them with `scripts/generate-translation-binaries.sh`, which requires Bash and +GNU gettext's `msgfmt`. Translation-update tests also require `xgettext` and `msgmerge`. +Use `python -m pytest -rs` to see skip reasons. -CI generates translation binaries and runs tests through [tox](../tox.ini). -See the [test workflow](workflows/test.yml) for supported Python versions and -platforms. +CI generates translation binaries and runs tests through [tox](../tox.ini). See the +[test workflow](workflows/test.yml) for supported Python versions and platforms. ## Linting From f2f139c5527ee1f14c63a612553d4f3de5af7d09 Mon Sep 17 00:00:00 2001 From: Yusuf Efe <120668197+yuefdev@users.noreply.github.com> Date: Sun, 18 Oct 2026 03:57:39 +0300 Subject: [PATCH 3/3] docs: use tox for local testing instructions Co-Authored-By: gpt-6-astra Signed-off-by: Yusuf Efe <120668197+yuefdev@users.noreply.github.com> --- .github/CONTRIBUTING.md | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 7ab23525..43a5a370 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -2,35 +2,29 @@ ## Running tests -Use Python 3.10 or newer. From the repository root, create a virtual environment: +Use [tox](https://tox.wiki/) from the repository root. It creates an isolated +environment and installs the project and its test dependencies: ```sh -python -m venv .venv +python -m pip install tox +tox -e py ``` -Activate it with `source .venv/bin/activate` on Linux or macOS, or -`.venv\Scripts\Activate.ps1` in Windows PowerShell. Then install the project and its -test dependencies: +Pass pytest arguments after `--` to run a single file or tests matching a name: ```sh -python -m pip install -e ".[tests]" -``` - -Run the full suite, a single file, or tests matching a name: - -```sh -python -m pytest -python -m pytest tests/test_number.py -python -m pytest tests/test_number.py -k intcomma +tox -e py -- tests/test_number.py +tox -e py -- tests/test_number.py -k intcomma ``` Some localisation tests are skipped when compiled `.mo` translation files are missing. Generate them with `scripts/generate-translation-binaries.sh`, which requires Bash and GNU gettext's `msgfmt`. Translation-update tests also require `xgettext` and `msgmerge`. -Use `python -m pytest -rs` to see skip reasons. +Use `tox -e py -- -rs` to see skip reasons. -CI generates translation binaries and runs tests through [tox](../tox.ini). See the -[test workflow](workflows/test.yml) for supported Python versions and platforms. +CI generates translation binaries and runs the +[configured tox environments](../tox.ini). See the [test workflow](workflows/test.yml) +for supported Python versions and platforms. ## Linting