1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-06-15 20:37:43 +00:00

[PR #12200/112050ee backport][stable-13] Antsibull-nox: split up unit tests by Python version (#12270)

Antsibull-nox: split up unit tests by Python version (#12200)

* antsibull-nox: split up unit tests by Python version.

* Adjust syntax for Python-version specific unit tests.

* Update Python version in ansible-test example.

(cherry picked from commit 112050ee7a)

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
patchback[bot] 2026-06-14 17:36:54 +02:00 committed by GitHub
parent 3cba1cd735
commit ee4d63acbd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 4 deletions

View file

@ -93,10 +93,10 @@ The following commands show how to run unit tests:
nox -Re ansible-test-units-devel
# Run all unit tests for one Python version (a lot faster):
nox -Re ansible-test-units-devel -- --python 3.13
nox -Re ansible-test-units-devel-3.14
# Run a specific unit test (for the nmcli module) for one Python version:
nox -Re ansible-test-units-devel -- --python 3.13 tests/unit/plugins/modules/net_tools/test_nmcli.py
nox -Re ansible-test-units-devel-3.14 -- tests/unit/plugins/modules/net_tools/test_nmcli.py
```
If you replace `-Re` with `-e`, then the virtual environments will be re-created. The `-R` re-uses them (if they already exist).
@ -145,10 +145,10 @@ The following commands show how to run unit tests:
ansible-test units --docker -v
# Run all unit tests for one Python version (a lot faster):
ansible-test units --docker -v --python 3.8
ansible-test units --docker -v --python 3.14
# Run a specific unit test (for the nmcli module) for one Python version:
ansible-test units --docker -v --python 3.8 tests/unit/plugins/modules/net_tools/test_nmcli.py
ansible-test units --docker -v --python 3.14 tests/unit/plugins/modules/net_tools/test_nmcli.py
```
### Integration tests

View file

@ -118,3 +118,10 @@ include_devel = true
[sessions.ansible_test_units]
include_devel = true
split_by_python_version = true
[sessions.ansible_test_units.core_python_versions]
"2.18" = ["3.8", "3.11", "3.13"]
"2.19" = ["3.8", "3.11", "3.13"]
"2.20" = ["3.9", "3.12", "3.14"]
"2.21" = ["3.9", "3.12", "3.14"]