Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update tests to run properly with tox #190

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading