Skip to content

Commit

Permalink
Merge pull request #190 from modlinltd/ps/update-tests
Browse files Browse the repository at this point in the history
chore: update tests to run properly with tox
  • Loading branch information
asfaltboy authored Mar 20, 2024
2 parents 405670f + 8b8dbfa commit f685995
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
19 changes: 19 additions & 0 deletions bin/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/env bash
set -e # Exit immediately if a command exits with a non-zero status.

# Run tests and check code style. Executed from tox (see tox.ini)
#
# this is required due to an issue with generic types used in asgiref and
# pypy's support for them:
# https://github.com/django/asgiref/issues/393

echo "Running tox env $TOX_ENV_NAME"
if [[ $TOX_ENV_NAME = pypy* ]]; then
echo "Running tests without coverage"
pytest .
else
echo "Running tests with coverage"
pytest --cov-append .
fi
echo "Checking code style"
pycodestyle --exclude=urls.py,migrations,.ropeproject -v advanced_filters
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
DJANGO_SETTINGS_MODULE=tests.test_project.settings
addopts = --cov=advanced_filters --cov-report=term-missing --doctest-modules
testpaths = advanced_filters
pythonpath = . tests
10 changes: 5 additions & 5 deletions test-reqs.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
coveralls
factory-boy==2.12.0
pycodestyle==2.5.0
pytest-django==3.9.0
pytest-cov
coveralls==3.3.1
factory-boy==3.3.0
pycodestyle==2.10.0
pytest-django==4.5.2
pytest-cov==4.1.0
9 changes: 5 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[tox]
envlist =
py{37,py37}-django{22,32}
py{38,py38,39}-django{22,32,40}
py{38,39}-django{22,32,40}
pypy38-django22
py310-django{32,40}
report

Expand All @@ -18,13 +19,13 @@ deps =

depends =
!report: clean
report: *
report: ALL

parallel_show_output = true

allowlist_externals = bin/test.sh
commands =
pytest --cov-append .
pycodestyle --exclude=urls.py,migrations,.ropeproject -v advanced_filters
bin/test.sh

[gh-actions]
python =
Expand Down

0 comments on commit f685995

Please sign in to comment.