From 460d7d11c53206125df1581197fdeb10a23d689b Mon Sep 17 00:00:00 2001 From: Carl Csaposs Date: Thu, 4 Jan 2024 13:23:14 +0000 Subject: [PATCH] pytest-cov instead of coverage --- poetry.lock | 23 ++++++++++++++++++++++- pyproject.toml | 2 +- tox.ini | 5 +---- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/poetry.lock b/poetry.lock index 5b857db0..50013a10 100644 --- a/poetry.lock +++ b/poetry.lock @@ -382,6 +382,9 @@ files = [ {file = "coverage-7.3.2.tar.gz", hash = "sha256:be32ad29341b0170e795ca590e1c07e81fc061cb5b10c74ce7203491484404ef"}, ] +[package.dependencies] +tomli = {version = "*", optional = true, markers = "python_full_version <= \"3.11.0a6\" and extra == \"toml\""} + [package.extras] toml = ["tomli"] @@ -1246,6 +1249,24 @@ pytest = ">=7.0.0" docs = ["sphinx (>=5.3)", "sphinx-rtd-theme (>=1.0)"] testing = ["coverage (>=6.2)", "flaky (>=3.5.0)", "hypothesis (>=5.7.1)", "mypy (>=0.931)", "pytest-trio (>=0.7.0)"] +[[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 = "pytest-operator" version = "0.28.0" @@ -1652,4 +1673,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "2e1c24e15b6f4a9499ce8da0b37b17dd81f0ab50c23ff15a643f57ffe7df6213" +content-hash = "25d37a3d89b6e43ec2ff03c66378feb72248536cc597c5a9ba1cfdc1b3597ef5" diff --git a/pyproject.toml b/pyproject.toml index 60ec5cf2..63e14fbf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ codespell = "^2.2.6" [tool.poetry.group.unit.dependencies] pytest = "^7.4.3" -coverage = "^7.3.2" +pytest-cov = "^4.1.0" [tool.poetry.group.integration.dependencies] pytest = "^7.4.3" diff --git a/tox.ini b/tox.ini index 03873502..0ea5f28d 100644 --- a/tox.ini +++ b/tox.ini @@ -59,10 +59,7 @@ description = Run unit tests commands_pre = poetry install --only main,charm-libs,unit commands = - # TODO: replace with pytest-cov - poetry run coverage run --source={[vars]src_path} \ - -m pytest -v --tb native -s {posargs} {[vars]tests_path}/unit - poetry run coverage report + poetry run pytest --cov=src --ignore={[vars]tests_path}/integration/ {posargs} [testenv:integration] description = Run integration tests