From: Denis Laxalde Date: Sun, 21 Nov 2021 08:49:58 +0000 (+0100) Subject: Add a minimal coverage configuration X-Git-Tag: 3.0.5~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b6b21fe362f92117f231bdfcdf8fa1a33d56add;p=thirdparty%2Fpsycopg.git Add a minimal coverage configuration We use pytest-cov, as it enables running coverage with pytest in a single command. We exclude 'if TYPE_CHECKING:' and ellipsis lines from report. --- diff --git a/.gitignore b/.gitignore index 06d808ac7..7fac87251 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ __pycache__/ /psycopg_binary/ .vscode .venv +.coverage +htmlcov diff --git a/psycopg/setup.py b/psycopg/setup.py index 6da0b8522..23341bfd9 100644 --- a/psycopg/setup.py +++ b/psycopg/setup.py @@ -41,6 +41,7 @@ extras_require = { "pproxy ~= 2.7.8", "pytest ~= 6.2.5", "pytest-asyncio ~= 0.16.0", + "pytest-cov ~= 3.0.0", "pytest-randomly ~= 3.10.1", "tenacity ~= 8.0.1", ], diff --git a/pyproject.toml b/pyproject.toml index 19ee39359..b05c86604 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,6 +18,16 @@ testpaths=[ # log_format = "%(asctime)s.%(msecs)03d %(levelname)-8s %(name)s:%(filename)s:%(lineno)d %(message)s" # log_level = "DEBUG" +[tool.coverage.run] +source = [ + "psycopg/psycopg", + "psycopg_pool/psycopg_pool", +] +[tool.coverage.report] +exclude_lines = [ + "if TYPE_CHECKING:", + '\.\.\.$', +] [tool.mypy] files = [