Skip to content

Commit

Permalink
Tests: Remove use of coverage, use pytest --cov instead
Browse files Browse the repository at this point in the history
In order to run without code coverage, invoke `pytest --no-cov`.
  • Loading branch information
amotl committed Oct 11, 2022
1 parent 1e2d155 commit 8bcc6e1
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 32 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ script:
- tox -- -vvv --numprocesses=auto

after_success:
- tox -e coverage-report
- codecov

notifications:
Expand Down
7 changes: 2 additions & 5 deletions bin/checkdone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,15 @@ echo
echo "Running test coverage check..."
pushd $PYTHONPATH &>/dev/null
if [ ! -z "$@" ]; then
LANG=C.UTF-8 PYTHONPATH=$PYTHONPATH coverage run -m pytest -vv -k "$@"
LANG=C.UTF-8 PYTHONPATH=$PYTHONPATH pytest -vv -k "$@"
RET=$?

else
LANG=C.UTF-8 PYTHONPATH=$PYTHONPATH coverage run -m pytest -vv
LANG=C.UTF-8 PYTHONPATH=$PYTHONPATH pytest -vv
RET=$?
fi

if [ $RET -ne 0 ]; then
echo "Tests failed."
exit 1
fi

# Print our report
LANG=C.UTF-8 PYTHONPATH=$PYTHONPATH coverage report --show-missing
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ services:
# Want to run the whole test suite:
#
# [ -f .coverage ] && rm -f .coverage
# docker-compose run --rm test.py36 coverage run --append -m pytest -vv
# docker-compose run --rm test.py310 coverage run --append -m pytest -vv
# docker-compose run --rm test.py36 pytest
# docker-compose run --rm test.py310 pytest
#
# Run the whole test suite fast:
# docker-compose run --rm test.py310 coverage run -m pytest -vvv --numprocesses=auto
# docker-compose run --rm test.py310 pytest --numprocesses=auto
#
# To produce a report:
# docker-compose run --rm test.py310 coverage combine
Expand Down
14 changes: 10 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license_file = LICENSE

[flake8]
# We exclude packages we don't maintain
exclude = .eggs,.tox
exclude = .eggs,.github,.pytest_cache,.ruff_cache,.venv,.venv311,.tox
ignore = E741,E722,W503,W504,W605
statistics = true
builtins = _
Expand All @@ -16,9 +16,15 @@ builtins = _
test=pytest

[tool:pytest]
addopts = --verbose -ra
python_files = test/test_*.py
norecursedirs=test/helpers
addopts =
-ra
-p pytester
--verbosity=3
--capture=no
--strict-markers
--cov --cov-report=term-missing --cov-report=xml
testpaths = test
norecursedirs = test/helpers
filterwarnings =
once::Warning

Expand Down
31 changes: 12 additions & 19 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py36,py37,py38,py39,py310,pypy36,pypy37,pypy38,pypy39,bare,coverage-report
envlist = py36,py37,py38,py39,py310,pypy36,pypy37,pypy38,pypy39,bare


[testenv]
Expand All @@ -12,7 +12,7 @@ deps=
-r{toxinidir}/dev-requirements.txt
commands =
python setup.py compile_catalog
coverage run -m pytest {posargs}
pytest {posargs}
flake8 . --count --show-source --statistics

[testenv:py36]
Expand All @@ -23,7 +23,7 @@ deps=
-r{toxinidir}/all-plugin-requirements.txt
commands =
python setup.py compile_catalog
coverage run -m pytest {posargs}
pytest {posargs}
flake8 . --count --show-source --statistics

[testenv:py37]
Expand All @@ -34,7 +34,7 @@ deps=
-r{toxinidir}/all-plugin-requirements.txt
commands =
python setup.py compile_catalog
coverage run -m pytest {posargs}
pytest {posargs}

[testenv:py38]
deps=
Expand All @@ -44,7 +44,7 @@ deps=
-r{toxinidir}/all-plugin-requirements.txt
commands =
python setup.py compile_catalog
coverage run -m pytest {posargs}
pytest {posargs}
flake8 . --count --show-source --statistics

[testenv:py39]
Expand All @@ -55,7 +55,7 @@ deps=
-r{toxinidir}/all-plugin-requirements.txt
commands =
python setup.py compile_catalog
coverage run -m pytest {posargs}
pytest {posargs}
flake8 . --count --show-source --statistics

[testenv:py310]
Expand All @@ -66,7 +66,7 @@ deps=
-r{toxinidir}/all-plugin-requirements.txt
commands =
python setup.py compile_catalog
coverage run -m pytest {posargs}
pytest {posargs}
flake8 . --count --show-source --statistics


Expand All @@ -76,7 +76,7 @@ deps=
-r{toxinidir}/dev-requirements.txt
commands =
python setup.py compile_catalog
coverage run -m pytest {posargs}
pytest {posargs}
flake8 . --count --show-source --statistics

[testenv:pypy36]
Expand All @@ -88,7 +88,7 @@ deps=
-r{toxinidir}/all-plugin-requirements.txt
commands =
python setup.py compile_catalog
coverage run -m pytest {posargs}
pytest {posargs}
flake8 . --count --show-source --statistics

[testenv:pypy37]
Expand All @@ -100,7 +100,7 @@ deps=
-r{toxinidir}/all-plugin-requirements.txt
commands =
python setup.py compile_catalog
coverage run -m pytest {posargs}
pytest {posargs}

[testenv:pypy38]
deps=
Expand All @@ -111,7 +111,7 @@ deps=
-r{toxinidir}/all-plugin-requirements.txt
commands =
python setup.py compile_catalog
coverage run -m pytest {posargs}
pytest {posargs}
flake8 . --count --show-source --statistics

[testenv:pypy39]
Expand All @@ -123,12 +123,5 @@ deps=
-r{toxinidir}/all-plugin-requirements.txt
commands =
python setup.py compile_catalog
coverage run -m pytest {posargs}
pytest {posargs}
flake8 . --count --show-source --statistics

[testenv:coverage-report]
deps = coverage
skip_install = true
commands =
coverage combine
coverage report

0 comments on commit 8bcc6e1

Please sign in to comment.