From d6643a8e965ad5ee2a48ec57e0e2b9667ad2e497 Mon Sep 17 00:00:00 2001 From: Hemna Date: Thu, 19 Aug 2021 19:23:12 -0400 Subject: [PATCH] Updated tox.ini this patch updates tox.ini to support coverage tests. --- .coveragerc | 14 ++++++++++++++ tox.ini | 28 +++++++++++++++++++--------- 2 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..2ae1a3a --- /dev/null +++ b/.coveragerc @@ -0,0 +1,14 @@ +[run] +include = + aprsd/* + tests/* + */lib/python*/site-packages/aprsd/* + */pypy*/site-packages/aprsd/* + *\Lib\site-packages\aprsd\* +branch = 1 + +[paths] +source = aprsd/ + */lib/python*/site-packages/aprsd/ + */pypy*/site-packages/aprsd/ + *\Lib\site-packages\aprsd\ diff --git a/tox.ini b/tox.ini index f2d935a..dc48f07 100644 --- a/tox.ini +++ b/tox.ini @@ -10,17 +10,27 @@ envlist = pre-commit,pep8,fmt-check,py{36,37,38} isolated_build = true [testenv] -setenv = VIRTUAL_ENV={envdir} +setenv = _PYTEST_SETUP_SKIP_APRSD_DEP=1 + coverage: _APRSD_TOX_CMD=coverage run -m pytest usedevelop = True install_command = pip install {opts} {packages} -deps = -r{toxinidir}/requirements.txt +extras = tests +deps = coverage: coverage + -r{toxinidir}/requirements.txt -r{toxinidir}/dev-requirements.txt + pytestmain: git+https://github.com/pytest-dev/pytest.git@main commands = - # Use -bb to enable BytesWarnings as error to catch str/bytes misuse. - # Use -Werror to treat warnings as errors. -# {envpython} -bb -Werror -m pytest \ -# --cov="{envsitepackagesdir}/aprsd" --cov-report=html --cov-report=term {posargs} - {envpython} -bb -m pytest {posargs} + {env:_APRSD_TOX_CMD:pytest} {posargs} + coverage: coverage report -m + coverage: coverage xml + +[pytest] +minversion=2.0 +testpaths = tests +#--pyargs --doctest-modules --ignore=.tox +addopts=-r a +filterwarnings = + error [testenv:docs] skip_install = true @@ -94,13 +104,13 @@ commands = [testenv:type-check] skip_install = true -deps = - -r{toxinidir}/requirements.txt +deps = -r{toxinidir}/requirements.txt -r{toxinidir}/dev-requirements.txt commands = mypy aprsd [testenv:pre-commit] skip_install = true +basepython = python3 deps = pre-commit commands = pre-commit run --all-files --show-diff-on-failure