Skip to content

Commit

Permalink
build: add proper configuration for tox/tests (#220)
Browse files Browse the repository at this point in the history
Define all the needed requirements and the
test command, so that running `tox` runs the
unit tests and runs them successfully.

Also simplify the CI workflow by using both
requirements files - exactly how tox does it.

Fixes #220 and #221.
  • Loading branch information
pbodnar committed Jul 29, 2024
1 parent a6b14a9 commit 14b1876
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest parameterized
if [ -f requirements.txt ]; then python -m pip install -r requirements.txt; fi
python -m pip install -r requirements.txt -r test-requirements.txt
python -m pip install flake8
- name: Lint with flake8
run: |
# See https://www.flake8rules.com for the list of the rules.
Expand Down Expand Up @@ -74,10 +74,9 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest parameterized
python -m pip install -r requirements.txt -r test-requirements.txt
# note: the following also installs "coverage"
python -m pip install coveralls
if [ -f requirements.txt ]; then python -m pip install -r requirements.txt; fi
- name: Get coverage report
run: |
coverage run --source=${package_name} --append -m pytest
Expand Down
3 changes: 3 additions & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# in alphabetical order:
parameterized
pytest
8 changes: 8 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,11 @@ extend-ignore = E124,E126,E127,E128,E501
max-line-length = 127

max-complexity = 10

[testenv]
# Configuration for tox - see https://tox.wiki/en/latest/config.html.
deps =
-r requirements.txt
-r test-requirements.txt
commands =
python -m pytest {posargs}

0 comments on commit 14b1876

Please sign in to comment.