Skip to content

Commit

Permalink
Tests: Modernize configuration and invocation of pytest
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
amotl committed Jan 28, 2024
1 parent a97c547 commit 6f058d7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6f058d7

Please sign in to comment.