From 8bcc6e1b8d08d203971f90f06893d4099494a375 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Tue, 11 Oct 2022 02:34:32 +0200 Subject: [PATCH] Tests: Remove use of `coverage`, use `pytest --cov` instead In order to run without code coverage, invoke `pytest --no-cov`. --- .travis.yml | 1 - bin/checkdone.sh | 7 ++----- docker-compose.yml | 6 +++--- setup.cfg | 14 ++++++++++---- tox.ini | 31 ++++++++++++------------------- 5 files changed, 27 insertions(+), 32 deletions(-) diff --git a/.travis.yml b/.travis.yml index a659bee5a9..9e08ac18fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -62,7 +62,6 @@ script: - tox -- -vvv --numprocesses=auto after_success: - - tox -e coverage-report - codecov notifications: diff --git a/bin/checkdone.sh b/bin/checkdone.sh index ad4cb6e29d..80d7954b44 100755 --- a/bin/checkdone.sh +++ b/bin/checkdone.sh @@ -74,11 +74,11 @@ 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 @@ -86,6 +86,3 @@ if [ $RET -ne 0 ]; then echo "Tests failed." exit 1 fi - -# Print our report -LANG=C.UTF-8 PYTHONPATH=$PYTHONPATH coverage report --show-missing diff --git a/docker-compose.yml b/docker-compose.yml index b776443ca9..150b0fd8de 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/setup.cfg b/setup.cfg index 80e6900df3..523c61f814 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 = _ @@ -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 diff --git a/tox.ini b/tox.ini index 728e55b7c0..ee441331ab 100644 --- a/tox.ini +++ b/tox.ini @@ -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] @@ -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] @@ -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] @@ -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= @@ -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] @@ -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] @@ -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 @@ -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] @@ -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] @@ -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= @@ -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] @@ -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