Skip to content

Commit

Permalink
Cleanup (#117)
Browse files Browse the repository at this point in the history
* Removed redundant package installation in the CI

* Use "poetry run" for all tox commands

* Removed isolated_build due to deprecation: https://tox.wiki/en/latest/upgrading.html#removed-tox-ini-keys
  • Loading branch information
Nusnus authored Jan 1, 2024
1 parent f7c9783 commit 847c9b4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
uses: snok/install-poetry@v1.3.4

- name: Install tox and mypy
run: poetry install --with dev,test,ci
run: poetry install --with ci

- name: Run mypy
run: tox -e mypy
4 changes: 2 additions & 2 deletions .github/workflows/parallel-support.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:

- name: Install tox
run: |
poetry install --with dev,test,ci
poetry install --with ci
- name: Run tox for all environments in parallel
timeout-minutes: 15
Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:

- name: Install tox
run: |
poetry install --with dev,test,ci
poetry install --with ci
- name: Run tox for all environments in parallel
timeout-minutes: 15
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:

- name: Install tox
run: |
poetry install --with dev,test,ci
poetry install --with ci
- name: Run tox for "${{ matrix.python-version }}-unit"
timeout-minutes: 5
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:

- name: Install tox
run: |
poetry install --with dev,test,ci
poetry install --with ci
- name: Run tox for "${{ matrix.python-version }}-integration"
timeout-minutes: 15
Expand Down Expand Up @@ -167,7 +167,7 @@ jobs:

- name: Install tox
run: |
poetry install --with dev,test,ci
poetry install --with ci
- name: Run tox for "${{ matrix.python-version }}-smoke"
timeout-minutes: 15
Expand Down
17 changes: 8 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[tox]
isolated_build = true
requires =
tox>4
tox-gh-actions
Expand Down Expand Up @@ -28,9 +27,9 @@ setenv =
commands_pre =
poetry install --with dev,test
commands =
unit: python3 -m pytest tests/unit/ --maxfail=3 {posargs}
integration: python3 -m pytest tests/integration/ --exitfirst --dist=loadscope {posargs}
smoke: python3 -m pytest tests/smoke/ --exitfirst --dist=loadscope {posargs}
unit: poetry run pytest tests/unit/ --maxfail=3 {posargs}
integration: poetry run pytest tests/integration/ --exitfirst --dist=loadscope {posargs}
smoke: poetry run pytest tests/smoke/ --exitfirst --dist=loadscope {posargs}
basepython =
3.8: py38
3.9: py39
Expand All @@ -50,7 +49,7 @@ setenv =
PYTHONUNBUFFERED = 1
PYTHONDONTWRITEBYTECODE = 1
commands =
python3 -m pytest tests --exitfirst \
poetry run pytest tests --exitfirst \
-n auto --dist=loadscope \
--reruns 5 --rerun-except AssertionError \
{posargs}
Expand All @@ -68,22 +67,22 @@ commands =
[testenv:mypy]
commands_pre =
poetry install --only dev
python -m mypy --install-types --non-interactive
poetry run mypy --install-types --non-interactive
commands =
python -m mypy --config-file pyproject.toml
poetry run mypy --config-file pyproject.toml

[testenv:lint]
commands_pre =
poetry install --only dev
commands =
pre-commit {posargs:run --all-files --show-diff-on-failure}
poetry run pre-commit {posargs:run --all-files --show-diff-on-failure}

[testenv:clean]
allowlist_externals = poetry, pytest, bash, find
commands_pre =
poetry install --only dev
commands =
python -m cleanpy .
poetry run cleanpy .
bash -c 'files=$(find . -name "*.coverage*" -type f); if [ -n "$files" ]; then echo "Removed coverage file(s):"; echo "$files" | tr " " "\n"; rm $files; fi'
bash -c 'containers=$(docker ps -aq --filter label=creator=pytest-docker-tools); if [ -n "$containers" ]; then echo "Removed Docker container(s):"; docker rm -f $containers; fi'
bash -c 'networks=$(docker network ls --filter name=pytest- -q); if [ -n "$networks" ]; then echo "Removed Docker network(s):"; docker network rm $networks; fi'
Expand Down

0 comments on commit 847c9b4

Please sign in to comment.