chore: Use pytester fixture to test the plugin#133
Merged
Conversation
9733d39 to
733242d
Compare
pytester fixture to test the pluginpytester fixture to test the plugin
733242d to
0ff0d01
Compare
0ff0d01 to
d47016c
Compare
d47016c to
96fe392
Compare
auto-merge was automatically disabled
April 7, 2026 19:02
Pull request was closed
96fe392 to
8b6becc
Compare
8b6becc to
f2e9d43
Compare
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
f2e9d43 to
7a75467
Compare
henryiii
reviewed
Jun 17, 2026
henryiii
left a comment
Contributor
There was a problem hiding this comment.
Looks good to me. Here's a Claude Opus 4.8 review if that's helpful:
🤖 AI text below 🤖
All 18 tests pass on this branch (uv run pytest -q). Here's my review of PR #133 — chore: Use pytester fixture to test the plugin.
Overview
Mechanical migration of plugin_test.py from the legacy testdir/pytest.Testdir fixture to the modern pytester/pytest.Pytester fixture. Two substantive side effects beyond the rename:
- Drops the local
no_fnmatch_linehelper, callingresult.stderr.no_fnmatch_line(...)directly. - Switches from
testdir.monkeypatchto the standalonemonkeypatchfixture.
Code quality
- Right call dropping the helper. Its comment said
no_fnmatch_linewas added totestdirin pytest 5.3.0; the project floor is pytest 7, so the shim was dead weight.RunResult.stderr.no_fnmatch_lineis available well within the supported range. - Escape semantics preserved. The old helper appended
"*"to every pattern. The inline replacements fold that*into the literal pattern correctly — e.g."...succeed_no_output.py"→"...succeed_no_output.py*". Where the caller already passed a trailing*(e.g."::*assert x += 1*"), the helper would have produced**; the new single-*form is fnmatch-equivalent, so no behavior change. monkeypatchfixture swap is correct. Using the standalone fixture instead ofpytester.monkeypatchis the documented pattern and keeps env setup independent of the pytester instance. No ordering concern sincesetenvdoesn't depend on cwd.- Nice tightening in
test_annotation_subtest: the addedassert len(result.stderr.lines) == 2makes the test verify the exact annotation count rather than just presence. osimport correctly retained — still used by the*_cwdtests viaos.path.dirname.
Suggestions (minor / non-blocking)
- Inconsistent idiom for the parent path.
test_annotation_fail_cwduses the cleanerstr(pytester.path.parent), buttest_annotation_warning_cwdstill usesos.path.dirname(str(pytester.path))for the same thing. Sincepytester.pathis apathlib.Path, standardizing both on.parentwould let theosimport drop entirely and read more uniformly. Worth a one-line follow-up, not a blocker.
Risk / correctness
- Low risk: pure test-infrastructure change, no plugin source touched.
pytesteris the actively-maintained successor totestdir, so this reduces deprecation surface. Full suite (incl. the xdist and subtest paths) passes locally. - Note: line 9 still uses
PYTEST_VERSION/packaging(the subtestskipif), so this branch is unaffected by the parallel PR #141 that removes them — no conflict in intent, though one will need a trivial rebase after the other merges.
Verdict: Clean, low-risk modernization that's a net improvement. Approve; optionally fold in the pytester.path.parent consistency tweak before merge.
….parent)` instead of `os.path.dirname(str(pytester.path))` Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
3f34446 to
7490af5
Compare
Collaborator
Author
|
Thanks for asking Claude for a review @henryiii! I've addressed the suggestion.
|
henryiii
approved these changes
Jun 17, 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.
pytester:testdir: