Skip to content

Commit

Permalink
pyproject: Add testing for different python versions with tox
Browse files Browse the repository at this point in the history
This change is needed for testing difference with python versions
used on different distributions.
Catching problems for example with f-string format.

Ref: https://peps.python.org/pep-0701/
Signed-off-by: Arisu Tachibana <arisu.tachibana@miraclelinux.com>
  • Loading branch information
aliceinwire committed Feb 28, 2025
1 parent 36dfc3e commit d364d2b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/poetry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs:
- uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install poetry
uses: abatilo/actions-poetry@v3
- name: Install shellcheck
Expand All @@ -28,5 +30,5 @@ jobs:
run: poetry run black --check --verbose .
- name: Isort check
run: poetry run isort . --profile black --check --diff
- name: Pytest check
run: poetry run pytest -rP
- name: Tox check (pytest)
run: poetry run tox
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ black = "^24.8.0"
isort = "^5.13.2"
pytest = "^8.3.3"
poethepoet = "^0.29.0"
tox = "^4.24.1"

[tool.poe.tasks]
check = "./scripts/check.sh"
Expand Down
2 changes: 1 addition & 1 deletion scripts/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

poetry run black . --extend-exclude="kcidev-src"
poetry run isort . --extend-skip="kcidev-src"
poetry run pytest -rP --ignore="kcidev-src"
poetry run tox
11 changes: 11 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[tox]
env_list = py311,py312

[testenv]
allowlist_externals = poetry
commands_pre =
poetry install --no-root
poetry sync
commands =
poetry run pytest tests/ --import-mode importlib

0 comments on commit d364d2b

Please sign in to comment.