Skip to content

Commit

Permalink
Improve pytest execution
Browse files Browse the repository at this point in the history
- add pytest-xdist optional
- update test deps
  • Loading branch information
ssbarnea committed Dec 3, 2024
1 parent 64c4e39 commit 7e6be8c
Show file tree
Hide file tree
Showing 11 changed files with 648 additions and 165 deletions.
22 changes: 13 additions & 9 deletions .config/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ mccabe==0.7.0 # via pylint
mdurl==0.1.2 # via markdown-it-py
mergedeep==1.3.4 # via mkdocs, mkdocs-get-deps
mkdocs==1.6.1 # via mkdocs-ansible, mkdocs-autorefs, mkdocs-gen-files, mkdocs-htmlproofer-plugin, mkdocs-macros-plugin, mkdocs-material, mkdocs-minify-plugin, mkdocs-monorepo-plugin, mkdocstrings
mkdocs-ansible==24.3.1 # via ansible-lint (pyproject.toml)
mkdocs-ansible==24.12.0 # via ansible-lint (pyproject.toml)
mkdocs-autorefs==1.2.0 # via mkdocstrings, mkdocstrings-python
mkdocs-gen-files==0.5.0 # via mkdocs-ansible
mkdocs-get-deps==0.2.0 # via mkdocs
mkdocs-htmlproofer-plugin==1.3.0 # via mkdocs-ansible
mkdocs-macros-plugin==1.3.7 # via mkdocs-ansible
mkdocs-material==9.5.46 # via mkdocs-ansible
mkdocs-material==9.5.47 # via mkdocs-ansible
mkdocs-material-extensions==1.3.1 # via mkdocs-ansible, mkdocs-material
mkdocs-minify-plugin==0.8.0 # via mkdocs-ansible
mkdocs-monorepo-plugin==1.1.0 # via mkdocs-ansible
Expand All @@ -68,22 +68,24 @@ mkdocstrings-python==1.12.2 # via mkdocs-ansible
mypy==1.13.0 # via ansible-lint (pyproject.toml)
mypy-extensions==1.0.0 # via black, mypy
netaddr==1.3.0 # via ansible-lint (pyproject.toml)
packaging==24.2 # via ansible-compat, ansible-core, black, mkdocs, mkdocs-macros-plugin, pipdeptree, pyproject-api, pytest, tox, ansible-lint (pyproject.toml)
packaging==24.2 # via ansible-compat, ansible-core, black, mkdocs, mkdocs-macros-plugin, pipdeptree, pyproject-api, pytest, pytest-sugar, tox, ansible-lint (pyproject.toml)
paginate==0.5.7 # via mkdocs-material
pathspec==0.12.1 # via black, mkdocs, mkdocs-macros-plugin, yamllint, ansible-lint (pyproject.toml)
pillow==11.0.0 # via cairosvg, mkdocs-ansible
pipdeptree==2.24.0 # via mkdocs-ansible, ansible-lint (pyproject.toml)
pipdeptree==2.24.0 # via mkdocs-ansible
platformdirs==4.3.6 # via black, mkdocs-get-deps, mkdocstrings, pylint, tox, virtualenv
pluggy==1.5.0 # via pytest, tox
psutil==6.1.0 # via ansible-lint (pyproject.toml)
psutil==6.1.0 # via pytest-xdist, ansible-lint (pyproject.toml)
pycparser==2.22 # via cffi
pygments==2.18.0 # via mkdocs-material, rich
pylint==3.3.1 # via ansible-lint (pyproject.toml)
pylint==3.3.2 # via ansible-lint (pyproject.toml)
pymdown-extensions==10.12 # via markdown-exec, mkdocs-ansible, mkdocs-material, mkdocstrings
pyproject-api==1.8.0 # via tox
pytest==8.3.3 # via pytest-mock, pytest-plus, pytest-xdist, ansible-lint (pyproject.toml)
pytest==8.3.4 # via pytest-instafail, pytest-mock, pytest-plus, pytest-sugar, pytest-xdist, ansible-lint (pyproject.toml)
pytest-instafail==0.5.0 # via ansible-lint (pyproject.toml)
pytest-mock==3.14.0 # via ansible-lint (pyproject.toml)
pytest-plus==0.7.0 # via ansible-lint (pyproject.toml)
pytest-sugar==1.0.0 # via ansible-lint (pyproject.toml)
pytest-xdist==3.6.1 # via ansible-lint (pyproject.toml)
python-dateutil==2.9.0.post0 # via ghp-import, mkdocs-macros-plugin
python-slugify==8.0.4 # via mkdocs-monorepo-plugin
Expand All @@ -93,14 +95,15 @@ referencing==0.35.1 # via jsonschema, jsonschema-specifications, types-jso
regex==2024.11.6 # via mkdocs-material
requests==2.32.3 # via linkchecker, mkdocs-htmlproofer-plugin, mkdocs-material
rich==13.9.4 # via ansible-lint (pyproject.toml)
rpds-py==0.21.0 # via jsonschema, referencing
rpds-py==0.22.0 # via jsonschema, referencing
ruamel-yaml==0.18.6 # via ansible-lint (pyproject.toml)
ruamel-yaml-clib==0.2.12 # via ruamel-yaml, ansible-lint (pyproject.toml)
setproctitle==1.3.4 # via pytest-xdist
six==1.16.0 # via python-dateutil
soupsieve==2.6 # via beautifulsoup4
subprocess-tee==0.4.2 # via ansible-compat, ansible-lint (pyproject.toml)
super-collections==0.5.3 # via mkdocs-macros-plugin
termcolor==2.5.0 # via mkdocs-macros-plugin
termcolor==2.5.0 # via mkdocs-macros-plugin, pytest-sugar
text-unidecode==1.3 # via python-slugify
tinycss2==1.4.0 # via cairosvg, cssselect2
tomli==2.2.1 # via black, coverage, mypy, pylint, pyproject-api, pytest, tox
Expand All @@ -121,3 +124,4 @@ zipp==3.21.0 # via importlib-metadata
# pip
# resolvelib
# typing-extensions
# uv
1 change: 0 additions & 1 deletion .config/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ pathspecs
pbrun
pfexec
pickleable
pipdeptree
pipefail
piptools
pipx
Expand Down
4 changes: 2 additions & 2 deletions .config/requirements-docs.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
mkdocs-ansible>=0.2.0 # do not use lock extra because it would break dependabot updates
pipdeptree>=2.7.1
mkdocs-ansible>=24.12.0 # do not use lock extra because it would break dependabot updates
uv>=0.5.5 # uv pip tree
2 changes: 1 addition & 1 deletion .config/requirements-lock.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pygments==2.18.0 # via rich
pyyaml==6.0.2 # via ansible-compat, ansible-core, yamllint, ansible-lint (pyproject.toml)
referencing==0.35.1 # via jsonschema, jsonschema-specifications
rich==13.9.4 # via ansible-lint (pyproject.toml)
rpds-py==0.21.0 # via jsonschema, referencing
rpds-py==0.22.0 # via jsonschema, referencing
ruamel-yaml==0.18.6 # via ansible-lint (pyproject.toml)
ruamel-yaml-clib==0.2.12 # via ruamel-yaml
subprocess-tee==0.4.2 # via ansible-compat, ansible-lint (pyproject.toml)
Expand Down
4 changes: 3 additions & 1 deletion .config/requirements-test.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ pylint # IDE support
pytest >= 7.2.2
pytest-mock
pytest-plus >= 0.6 # for PYTEST_REQPASS
pytest-xdist >= 2.1.0
pytest-xdist[psutil,setproctitle] >= 2.1.0
pytest-instafail >= 0.5.0 # only for local development, via PYTEST_ADDOPTS=--instafail
pytest-sugar >= 1.0.0
ruamel.yaml>=0.17.31
ruamel-yaml-clib # needed for mypy
tox >= 4.0.0
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ repos:
args: [--relative, --no-progress, --no-summary]
name: Spell check with cspell
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.4
rev: 0.30.0
hooks:
- id: check-github-workflows
- repo: https://github.com/pre-commit/pre-commit-hooks.git
Expand Down Expand Up @@ -134,7 +134,7 @@ repos:
hooks:
- id: toml-sort-fix
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.0
rev: v0.8.1
hooks:
- id: ruff
args:
Expand Down Expand Up @@ -205,7 +205,7 @@ repos:
- wcmatch
- yamllint
- repo: https://github.com/pycqa/pylint
rev: v3.3.1
rev: v3.3.2
hooks:
- id: pylint
args:
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ dependencies on Ansible internals is desired as these can change without any
warning.

```bash exec="1" source="console"
_PIP_USE_IMPORTLIB_METADATA=0 pipdeptree -p ansible-lint
uv pip tree --package ansible-lint --show-version-specifiers --strict
```

## Adding a new rule
Expand Down
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ reportPossiblyUnboundVariable = false
[tool.pytest.ini_options]
# do not add options here as this will likely break either console runs or IDE
# integration like vscode or pycharm
addopts = "-p no:pytest_cov --failed-first"
addopts = "-p no:pytest_cov --durations=10 --failed-first"
# https://code.visualstudio.com/docs/python/testing
# coverage is re-enabled in `tox.ini`. That approach is safer than
# `--no-cov` which prevents activation from tox.ini and which also fails
Expand Down Expand Up @@ -333,6 +333,10 @@ in_place = true
sort_inline_tables = true
sort_table_keys = true

[tool.uv]
# incompatible with Windows
environments = ["platform_system != 'Windows'"]

[tool.uv.pip]
annotation-style = "line"
custom-compile-command = "tox run deps"
Expand Down
Loading

0 comments on commit 7e6be8c

Please sign in to comment.