From 6f058d71f7e2ec225fc62701258d7af797dd8893 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sun, 28 Jan 2024 11:45:55 +0100 Subject: [PATCH] Tests: Modernize configuration and invocation of `pytest` By centralizing common configuration settings into `pyproject.toml`, the invocation is more universal, and the configuration does not need to be maintained at different spots. --- Makefile | 8 ++++---- pyproject.toml | 12 ++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 7a7102c..536b2fb 100644 --- a/Makefile +++ b/Makefile @@ -43,13 +43,13 @@ format: ## Run code formatting black . test: clean ## Run tests with virtualenv Python - py.test -s -v --lf --cov epo_ops tests --cov-report term-missing --cov-report xml + pytest --lf test-ci: clean ## Run tests in CI environment with virtualenv Python - py.test -v --cov epo_ops tests --cov-report term-missing --cov-report xml + pytest -coverage: clean ## Check code coverage locally - py.test -s -v --cov epo_ops tests --cov-report term-missing --cov-report xml --cov-report html +coverage: clean test-ci ## Check code coverage locally + coverage html open htmlcov/index.html release: clean # Package and upload a release to PyPI diff --git a/pyproject.toml b/pyproject.toml index 93a840b..b4cc0f7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,6 +9,18 @@ requires = [ ] build-backend = "setuptools.build_meta" +[tool.pytest.ini_options] +minversion = "2.0" +addopts = """ + -rsfEX -p pytester --strict-markers --verbosity=3 + --cov=epo_ops tests --cov-report=term-missing --cov-report=xml + """ +log_level = "DEBUG" +log_cli_level = "DEBUG" +testpaths = ["tests"] +xfail_strict = true +markers = [ +] [tool.ruff] line-length = 80