Repository navigation
feat(test-integrity): detect weakened Python tests - #99
Merged
Merged
Conversation
Treat pytest's test files and conftest.py as tests, and block unconditional pytest and unittest skips, expected failures, and added bare returns in them. A skip conditioned on the platform or an environment variable, with a plain reason, is reported instead. Count assert statements, unittest and mock assertions, and pytest.raises or warns when assertions are removed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ection switches return None gives up like a bare return. skipUnless skips when its condition is false, so an impossible condition is read as always skipping. __test__ = False and collect_ignore stop pytest collecting tests, like a skip. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
caiopizzol
enabled auto-merge (squash)
September 28, 2026 16:59
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
…t_ignore in conftest only A skipif may name condition= and reason= in either order. return; gives up like return. pytest reads collect_ignore only from a conftest, so elsewhere it is an ordinary name. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This was referenced Sep 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Test integrity only knew JavaScript tests. On a Python change that weakens tests four ways, it caught only the deleted test file. A new
@pytest.mark.skip, an addedreturnbefore the assertions, and removed assertions all passed.Change
Detector only (
detect.ts). The Python gate is a separate follow-up: thejustfile,uv run pytest, and pytest options inpyproject.toml.test_*.py,*_test.py, andconftest.pyare test files, as are files undertests/as before. Deleting one blocks.@pytest.mark.skip,@unittest.skip,@skip), as marks (pytestmark =,pytest.param(marks=…)), or as calls (pytest.skip(),pytest.xfail(),pytest.importorskip(),self.skipTest(),SkipTest);__test__ = Falseandcollect_ignore, which stop pytest collecting tests.skipif,skipIf,skipUnless, orxfailwhose condition comparessys.platform,os.name,platform.system(), or an environment variable with a string, and whose reason is plain text. The rules match the JavaScript ones: truthiness conditions such asnot IMAGEstill block, and so does anorthat is always true.skipUnlessis read inverted, because it skips when its condition is false.return, orreturn None, in a Python test file.assertstatements,self.assert…(), mock.assert_…()calls, andpytest.raises()orpytest.warns()are counted.Verification
bun run checkpasses; 93 package tests.skipifcalls on truthiness conditions;return None.🤖 Generated with Claude Code