Review/1365 property test discovery #1385
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1385"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by xel1uz on 2026-11-24T23:02:25Z.
Claimed in the coordination issue as: TEST-CI-REG-LOCAL-MIXIN (original claim by @milk4sale).
Depends on: #1365. This branch includes @milk4sale's support for test methods inherited from a mixin in the same module.
What and why
On #1365, a
TestCasethat inherits only@property def test_label(self)can pass the CI registration check even thoughunittestdiscovers zero tests. The scanner sees thetestprefix on the function definition, but looking up the name on the class returns a property.The follow-up teaches the scanner to recognize
@propertyand its getter, setter, and deleter forms. It adds two cases checked against realunittestdiscovery: an inherited property with a setter contributes zero tests, while an inherited@staticmethod def test_one()contributes one.Tested
fd0a5390: the registration check accepted the property-only mixin, whileunittestcollected zero tests.a1274181, the scanner agreed withunittestin both new cases. Ranpy -3.12 -I tests/test_ci_registration.pyon Windows with Python 3.12.10: all 16 tests passed.py -3.12 -m unittest discover -s tests/semantic -p test_sub_co_same_operand.py -v: all six tests in the module that motivated #1365 passed.git diff --checkandscripts/check_no_game_data.pypassed for the changed file.GPUs tested: n/a (Python test discovery).
AI-assisted: yes, OpenAI Codex.
Checklist
mainat28a32e19.Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T15:17:46Z.
Reviewed
a1274181a. One-file change in tests/test_ci_registration.py: test-name detection learns that a property and its accessors are not test methods, which matches unittest's loader (getattr on the class is not callable). Ran (Python 3.12) the full file on the PR tree, 16 tests OK including the two new fixtures and the Ran-6 count, and the file on main, 16 tests OK with the old logic. A probe on both trees confirms the fix: for the property-only mixin source (and plain-def-shadowed-by-property, cross-name setters, property-over-staticmethod) main's scan says the file defines a test while a realpython -m unittest discovercollects nothing; the PR agrees with the runner in every case, and the staticmethod fixture keeps counting. Two leftover false positives predate this PR and are unchanged by it (functools.cached_property, and@Mixin.test_x.setterwritten in a subclass); worth a finding line in the coordination issue, no change requested here.AI-assisted review.
Recommendation: Merge
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T14:49:00Z.
Red/green: test_ci_registration.py failed 2 assertions on main because inherited mixin tests were not counted, and passes with the ancestor-aware defines_a_test.
Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main
4f9199d09in GitHub Actions: no new failure.AI-assisted (Claude Code, Claude Opus 5.5)