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

Fix: Omit tests directory from code coverage #735

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
30 changes: 16 additions & 14 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ hiredis = redis[hiredis]>=4.0.2

[coverage:run]
omit =
tests/*,
*/tests/*

[coverage:report]
precision = 1
skip_covered = true
omit =
*/tests/*

[tox:tox]
minversion = 3.15.0
Expand Down Expand Up @@ -80,18 +82,18 @@ REDIS =
[testenv]
passenv = CI, GITHUB*
commands =
{envpython} -m pytest --cov-report= --ds=settings.sqlite {posargs}
{envpython} -m pytest --cov-append --cov-report= --ds=settings.sqlite_herd {posargs}
{envpython} -m pytest --cov-append --cov-report= --ds=settings.sqlite_json {posargs}
{envpython} -m pytest --cov-append --cov-report= --ds=settings.sqlite_lz4 {posargs}
{envpython} -m pytest --cov-append --cov-report= --ds=settings.sqlite_msgpack {posargs}
{envpython} -m pytest --cov-append --cov-report= --ds=settings.sqlite_sentinel {posargs}
{envpython} -m pytest --cov-append --cov-report= --ds=settings.sqlite_sentinel_opts {posargs}
{envpython} -m pytest --cov-append --cov-report= --ds=settings.sqlite_sharding {posargs}
{envpython} -m pytest --cov-append --cov-report= --ds=settings.sqlite_usock {posargs}
{envpython} -m pytest --cov-append --cov-report= --ds=settings.sqlite_zlib {posargs}
{envpython} -m pytest --cov-append --cov-report= --ds=settings.sqlite_zstd {posargs}
{envpython} -m pytest --cov-append --cov-report= --ds=settings.sqlite_gzip {posargs}
{envpython} -m pytest -vv --ignore=tests/* --cov-report= --ds=settings.sqlite {posargs}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need these ignores?

{envpython} -m pytest -vv --ignore=tests/* --cov-append --cov-report= --ds=settings.sqlite_herd {posargs}
{envpython} -m pytest -vv --ignore=tests/* --cov-append --cov-report= --ds=settings.sqlite_json {posargs}
{envpython} -m pytest -vv --ignore=tests/* --cov-append --cov-report= --ds=settings.sqlite_lz4 {posargs}
{envpython} -m pytest -vv --ignore=tests/* --cov-append --cov-report= --ds=settings.sqlite_msgpack {posargs}
{envpython} -m pytest -vv --ignore=tests/* --cov-append --cov-report= --ds=settings.sqlite_sentinel {posargs}
{envpython} -m pytest -vv --ignore=tests/* --cov-append --cov-report= --ds=settings.sqlite_sentinel_opts {posargs}
{envpython} -m pytest -vv --ignore=tests/* --cov-append --cov-report= --ds=settings.sqlite_sharding {posargs}
{envpython} -m pytest -vv --ignore=tests/* --cov-append --cov-report= --ds=settings.sqlite_usock {posargs}
{envpython} -m pytest -vv --ignore=tests/* --cov-append --cov-report= --ds=settings.sqlite_zlib {posargs}
{envpython} -m pytest -vv --ignore=tests/* --cov-append --cov-report= --ds=settings.sqlite_zstd {posargs}
{envpython} -m pytest -vv --ignore=tests/* --cov-append --cov-report= --ds=settings.sqlite_gzip {posargs}
{envpython} -m coverage report
{envpython} -m coverage xml

Expand All @@ -115,7 +117,7 @@ envdir={toxworkdir}/lint
commands =
black: black --target-version py36 {posargs:--check --diff} setup.py django_redis/ tests/
ruff: ruff {posargs:check --show-fixes} django_redis/ tests/
mypy: mypy {posargs:--cobertura-xml-report .} django_redis tests
mypy: mypy {posargs:--cobertura-xml-report .} django_redis
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please restore this, as also tests should be checked for typing errors so that we can notice breaking changes

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure @WisdomPill ! This was just experimental. Any suggestions to avoid tests directory from coverage report?

deps =
black
django-stubs
Expand Down
Loading