From 69ad0d943580d0c3f4468e8c1bedb4d734c09254 Mon Sep 17 00:00:00 2001 From: Joel Capitao Date: Mon, 16 Sep 2024 15:31:27 +0200 Subject: [PATCH] Tests: Add coverage, use pytest as test runner (#395) --- .coveragerc | 17 +++++++++++++++++ pyproject.toml | 4 +++- setup.cfg | 19 ++++++++++++++++--- 3 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..0ebcd25 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,17 @@ +# SPDX-FileCopyrightText: 2024 pydot contributors +# +# SPDX-License-Identifier: MIT + +[paths] +source = + src + */site-packages + +[run] +branch = true +parallel = true +relative_files = true +source = + test +source_pkgs = + pydot diff --git a/pyproject.toml b/pyproject.toml index 61727cb..bfd8458 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,7 +65,9 @@ tests = [ 'parameterized', 'ruff', 'tox', - 'unittest-parallel', + 'pytest', + 'pytest-cov', + 'pytest-xdist[psutil]', ] release = ['zest.releaser[recommended]'] diff --git a/setup.cfg b/setup.cfg index 3249c58..81bf476 100644 --- a/setup.cfg +++ b/setup.cfg @@ -9,6 +9,9 @@ push-changes=no create-wheel=yes tag-format=v{version} +[tool:pytest] +testpaths = test + [tox:tox] min_version = 4.6.3 env_list = @@ -25,13 +28,23 @@ package = wheel wheel_build_env = .pkg pass_env = TEST_ERROR_DIR -commands = unittest-parallel --level test -vv +setenv = + DEFAULT_COVERAGE_FILE = .coverage.{envname} + COVERAGE_FILE = {env:COVERAGE_FILE:{env:DEFAULT_COVERAGE_FILE}} +commands = pytest -n auto --cov {posargs} -[testenv:ruff] +[testenv:ruff-check] +skip_install = true deps = ruff==0.4.8 commands = ruff format --diff . - ruff check . + ruff check . {posargs} + +[testenv:ruff-fix] +deps = ruff==0.4.8 +commands = + ruff format . + ruff check --fix . # For tox-gh [gh] -- 2.46.0