Skip to content

Commit

Permalink
test: use py3{py-minor-version} format rather than py3.{py-minor-vers…
Browse files Browse the repository at this point in the history
…ion} for testenv name

This convention is more "tox-friendly", since an environment with 'py$MAJOR$MINOR'
in its name will use the Python interpreter at version $MAJOR.MINOR as base python.

In particular, in this way, we could avoid the repetition of different testenv
configurations which only differ by the basepython variable.

This change required a workaround in the GitHub Actions workflow configuration,
since the Python version there has a dot that separates major and minor versions.
  • Loading branch information
marcofavorito committed May 12, 2023
1 parent 3d19164 commit 87bfb92
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
run: pip install tox
- name: Unit tests and coverage
run: |
pyver=`echo ${{ matrix.python-version }} | tr -d "."`
tox -e py${{ matrix.python-version }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
Expand Down
10 changes: 4 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = check-copyright, black-check, isort-check, docs, flake8, mypy, py3.8, py3.7
envlist = check-copyright, black-check, isort-check, docs, flake8, mypy, py3{7,8,9,10}

[testenv]
setenv =
Expand All @@ -19,11 +19,9 @@ commands =
--cov-report=html \
--cov-report=term

[testenv:py3.7]
basepython = python3.7

[testenv:py3.8]
basepython = python3.8
[testenv:py{37,38,39,310}]
commands =
{[testenv]commands}

[testenv:flake8]
skip_install = True
Expand Down

0 comments on commit 87bfb92

Please sign in to comment.