checks.tests.TestsCheck

checks.tests.TestsCheck()

Run package tests and report results.

Executes the package’s test suite using the configured test runner (pytest by default) and reports pass/fail status. Supports pytest and unittest runners.

Attributes

name :

The check identifier (“tests”).

description :

Human-readable description of this check.

Configuration Options

runner (str): Test runner to use (“pytest” or “unittest”). Defaults to “pytest”. args (list[str]): Additional arguments to pass to the test runner.

Examples

Run tests with default settings (pytest):

>>> from pathlib import Path
>>> check = TestsCheck()
>>> result = check.run(Path("."), {"enabled": True})
>>> result.name
'tests'

Configure to use unittest:

>>> config = {"enabled": True, "runner": "unittest"}
>>> result = check.run(Path("."), config)

Pass additional pytest arguments:

>>> config = {"enabled": True, "args": ["-x", "--cov"]}
>>> result = check.run(Path("."), config)

Methods

Name Description
run Run tests and return results.

run

checks.tests.TestsCheck.run(package_path, config)

Run tests and return results.

Executes the test suite in the package’s tests/ or test/ directory. The test runner is determined by the runner config option.

Parameters

package_path : Path

Path to the package directory containing tests.

config : dict[str, Any]

Configuration dictionary with options: - runner (str): “pytest” or “unittest” (default: “pytest”) - args (list[str]): Additional arguments for the runner

Returns

: CheckResult

A CheckResult with:

: CheckResult
  • OK status if all tests pass
: CheckResult
  • WARNING status if no tests found
: CheckResult
  • ERROR status if tests fail or runner not installed
: CheckResult
  • SKIPPED status if the test runner is not installed