From d54fd6ebcc1d9111e51c528ae47a6393261973b3 Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Sat, 8 Jul 2023 17:26:09 +0200 Subject: [PATCH] Setup tox - add tox configuration for coverage reporting --- poetry.lock | 70 +++++++++++++++++++++++++++++++++++++++++++++++++- pyproject.toml | 1 + tox.ini | 25 ++++++++++++++++-- 3 files changed, 93 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index 578f93a..7a81972 100644 --- a/poetry.lock +++ b/poetry.lock @@ -147,6 +147,9 @@ files = [ {file = "coverage-7.2.7.tar.gz", hash = "sha256:924d94291ca674905fe9481f12294eb11f2d3d3fd1adb20314ba89e94f44ed59"}, ] +[package.dependencies] +tomli = {version = "*", optional = true, markers = "python_full_version <= \"3.11.0a6\" and extra == \"toml\""} + [package.extras] toml = ["tomli"] @@ -182,6 +185,20 @@ tzdata = {version = "*", markers = "sys_platform == \"win32\""} argon2 = ["argon2-cffi (>=19.1.0)"] bcrypt = ["bcrypt"] +[[package]] +name = "exceptiongroup" +version = "1.1.2" +description = "Backport of PEP 654 (exception groups)" +optional = false +python-versions = ">=3.7" +files = [ + {file = "exceptiongroup-1.1.2-py3-none-any.whl", hash = "sha256:e346e69d186172ca7cf029c8c1d16235aa0e04035e5750b4b95039e65204328f"}, + {file = "exceptiongroup-1.1.2.tar.gz", hash = "sha256:12c3e887d6485d16943a309616de20ae5582633e0a2eda17f4e10fd61c1e8af5"}, +] + +[package.extras] +test = ["pytest (>=6)"] + [[package]] name = "filelock" version = "3.12.2" @@ -197,6 +214,17 @@ files = [ docs = ["furo (>=2023.5.20)", "sphinx (>=7.0.1)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] testing = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "diff-cover (>=7.5)", "pytest (>=7.3.1)", "pytest-cov (>=4.1)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"] +[[package]] +name = "iniconfig" +version = "2.0.0" +description = "brain-dead simple config-ini parsing" +optional = false +python-versions = ">=3.7" +files = [ + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, +] + [[package]] name = "packaging" version = "23.1" @@ -257,6 +285,46 @@ tomli = {version = ">=2.0.1", markers = "python_version < \"3.11\""} docs = ["furo (>=2023.5.20)", "sphinx (>=7.0.1)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] testing = ["covdefaults (>=2.3)", "importlib-metadata (>=6.6)", "pytest (>=7.3.1)", "pytest-cov (>=4.1)", "pytest-mock (>=3.10)", "setuptools (>=67.8)", "wheel (>=0.40)"] +[[package]] +name = "pytest" +version = "7.4.0" +description = "pytest: simple powerful testing with Python" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-7.4.0-py3-none-any.whl", hash = "sha256:78bf16451a2eb8c7a2ea98e32dc119fd2aa758f1d5d66dbf0a59d69a3969df32"}, + {file = "pytest-7.4.0.tar.gz", hash = "sha256:b4bf8c45bd59934ed84001ad51e11b4ee40d40a1229d2c79f9c592b0a3f6bd8a"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=0.12,<2.0" +tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} + +[package.extras] +testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] + +[[package]] +name = "pytest-cov" +version = "4.1.0" +description = "Pytest plugin for measuring coverage." +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-cov-4.1.0.tar.gz", hash = "sha256:3904b13dfbfec47f003b8e77fd5b589cd11904a21ddf1ab38a64f204d6a10ef6"}, + {file = "pytest_cov-4.1.0-py3-none-any.whl", hash = "sha256:6ba70b9e97e69fcc3fb45bfeab2d0a138fb65c4d0d6a41ef33983ad114be8c3a"}, +] + +[package.dependencies] +coverage = {version = ">=5.2.1", extras = ["toml"]} +pytest = ">=4.6" + +[package.extras] +testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtualenv"] + [[package]] name = "sqlparse" version = "0.4.4" @@ -356,4 +424,4 @@ test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "7f4d3f16801f96349ce798e41cb976e6d4210c5235e444e0f20b37d1ddc76d73" +content-hash = "aec72e26a75f6a72f5d2538c7b7999f973bb2fab8859d678da24f45da2131493" diff --git a/pyproject.toml b/pyproject.toml index 0c28592..1e44ee9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,7 @@ django = "<5" [tool.poetry.group.dev.dependencies] coverage = "^7.1.0" tox = "^4.6.4" +pytest-cov = "^4.1.0" [[tool.poetry.source]] name = "gnuviech" diff --git a/tox.ini b/tox.ini index 638d3ef..f31cff7 100644 --- a/tox.ini +++ b/tox.ini @@ -1,13 +1,34 @@ [tox] env_list = - py310 + clean,py39,py310,py311,report minversion = 4.6.4 +[coverage:paths] +source = + gvacommon + +[coverage:report] +omit = + gvacommon/tests/* + [testenv] description = run the tests with pytest package = wheel wheel_build_env = .pkg deps = pytest>=6 + pytest-cov commands = - pytest {tty:--color=yes} {posargs} + pytest --cov --cov-append --cov-report=term-missing {tty:--color=yes} {posargs} + +[testenv:report] +deps = coverage +skip_install = true +commands = + coverage report -m + coverage html + +[testenv:clean] +deps = coverage +skip_install = true +commands = coverage erase