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.
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
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