Repository navigation
PROVECODE 0.2.0 (beta)
Pre-release
Pre-release
Beta. PROVECODE tells you whether a code change made its own tests weaker, and whether the change still passes the tests that were trusted before it. Python with pytest or unittest only. Real-world precision is not yet measured, so expect some false alarms and please report them.
Install
uv tool install "provecode[cli] @ git+https://github.com/Shriram28Baskar/provecode@v0.2.0#subdirectory=engine"
pipx install "provecode[cli] @ git+https://github.com/Shriram28Baskar/provecode@v0.2.0#subdirectory=engine"
pip install "provecode[cli] @ git+https://github.com/Shriram28Baskar/provecode@v0.2.0#subdirectory=engine"GitHub Action: uses: Shriram28Baskar/provecode@v0.2.0, which works with no contract. See the README section "Use it in your repository".
First release meant for use outside this repository. Real-world precision is not yet measured (see README, "Honest scope").
Added
- Zero-config pull-request gate. The GitHub Action's
contractinput is optional. Without a contract, any test-weakening finding fails the check (block-on: weakening).provecode check --block-on weakeningdoes the same from the CLI. - Rules (ADR 0014):
- pytest config in any directory (
engine/pyproject.toml), including a closer config that shadows a parent's; filterwarnings = errorremoved;assert a and bjudged per conjunct;- always-true asserts (
assert True,assert (x, "msg")); - equality reduced to a
len()check; abs(a - b) < tandmath.iscloseread as tolerances;- an exception added alongside the expected one;
- the parametrize decorator removed;
pytest.importorskipadded to an existing test;- checks moved into a loop that never runs;
- autouse conftest fixtures that patch the package under test;
tox.initest commands narrowed,--prefixed or removed;--cov-fail-underlowered in CI and tox commands.
- pytest config in any directory (
- Trusted re-run (
provecode rerun,check --execute): base tests against head code in sealed containers (ADR 0013). - Harness and test-body rules H1–H7 and T1–T5 (ADR 0012).
provecode guardandinstall-hooksfor pre-commit and Claude Code (ADR 0010).docs/research/scripts/cheat_catalog.py: a regression catalog of weakenings and legitimate near-misses.LICENSE(MIT).
Changed
pytest.approxandmath.iscloseat their default tolerances no longer count as a weakening of==. A looser tolerance still does.- Disabling
cacheprovider,pastebin,xdist,sugarorhtmlwith-p no:is no longer a plugin finding.
Fixed (false alarms)
- A test moved unchanged to another test file is recorded as a move (R0), not a deletion (B1).
python -m pytestis no longer read as a marker filter.- Parametrize cases given
pytest.param(..., id=...)are the same cases. - An assert restructured into one equality (
assert (a, b) == (...)) is not a removal. # pragma: no coverinside a string is not a coverage exclusion.- CI and tox test commands (H5, H6), found by the real-history scan:
- tox's
{posargs}is read as nothing and{posargs:default}as its default, which is what runs when no arguments are given; coverage run -m,{envpython} -m, and runner options before-m(python -b -m) name the module to run, not a marker filter;- values of options such as
--cov-report xmlare not test paths; - a test path widened to its directory is not fewer tests;
- paths are compared only when both commands run pytest;
- a GitHub
${{ ... }}expression is one value and, when it selects tox envs, unknown rather than narrowed; - a shell comment that mentions pytest is not a test command;
[testenv:lint],[testenv:flake8]and the other non-test env names already exempt in CI are exempt intox.initoo.
- tox's
Fixed (performance)
- The hollowed-helper check (T2) rebuilt its table of in-file helpers once per test, so its cost grew with the square of the number of tests. On
kjd/idna's 1.5 MB test file (about 6,300 tests) oneprovecode guardrun took about 107 s; it now takes about 5 s, most of it parsing the file. Findings are unchanged. - The
pytest_plugins-in-a-test-module check (H2) no longer parses a test module twice when the name does not occur in it. The search runs on NFKC-normalised text, so a look-alike spelling is still parsed and found.