mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:35:53 +01:00
[PR #1365] [MERGED] tests: the CI registration scan counts the tests a TestCase inherits from a class of its module (TEST-CI-REG-LOCAL-MIXIN) #1395
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1395
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1365
Author: @milk4sale
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142
Base:
main← Head:test/ci-registration-local-mixin📝 Commits (1)
fd0a539tests: the CI registration scan counts the tests a TestCase inherits from a class of its module (TEST-CI-REG-LOCAL-MIXIN)📊 Changes
1 file changed (+59 additions, -3 deletions)
View changed files
📝
tests/test_ci_registration.py(+59 -3)📄 Description
Claimed in the coordination issue as: TEST-CI-REG-LOCAL-MIXIN (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7146307911)
What and why
mainis red ontests/test_ci_registration.pysince540d5111f, the merge of #930 at 22:12 UTC on 24 November; the test passes on that commit's parent,4a50cafc7. The standard-library loop runs this file, socheck,stdlib-tests-linuxandmacos-pythonfail on every pull request whose run starts on amainfrom then on.test_every_selected_file_exposes_a_test_to_its_runnerreports #930'stests/semantic/test_sub_co_same_operand.pyas a file the semantic job collects nothing from. That is not so:python -m unittest discover -s tests/semantic -p test_sub_co_same_operand.pyruns 6 tests there. Its threeTestCaseclasses have no test method of their own. They take them from_SameOperandMixin, a plain class defined in the same file, oneTestCaseper wave size.defines_a_testlooked at aTestCase's own body and at a base imported from another module, and not at a base defined in the module, so the fault is in the scan and #930's file stays as it is.The scan now also counts:
test*methods of the classes of the module that aTestCasederives from, directly or through other classes of the module;class Middle(Imported), thenclass Example(Middle, unittest.TestCase)), as it already did for one theTestCasenames itself.unittest's loader lists a class's tests withdir(), so these are tests the runner runs.Tested
python -I tests/test_ci_registration.py: 16 tests pass on this branch (main89d7dfcf5plus the commit). Onmainalone it fails attest_every_selected_file_exposes_a_test_to_its_runner; at4a50cafc7it passes and at540d5111fit fails.test_inherited_tests_count_where_unittest_discover_collects_them, does not carry my expectations alone: it writes eight small modules, runsunittest discoveron them once and holds the scan to what the runner collected. Five have a test (a mixin above theTestCase, two classes up, beside aTestCasebase without tests, an imported mixin named directly and through a local class) and three have none (a base without tests, a mixin noTestCasederives from, a mixin without aTestCase).main'sdefines_a_testput back, that test fails in four of the five cases with a test (all but the directly named imported mixin, whichmainalready handled), and the repository check fails as onmain.51a6074d2: both scans list the same 997 test files. Of the 473 files the semantic job selects,main's scan finds a test in 472 and this one in 473;test_sub_co_same_operand.pyis the only file the two disagree on, and they agree on all 36 files of the pytest job.unittest's loader collects tests from all 473 semantic files (6191 tests, no import failure). Somain's scan disagreed with the runner on that one file, and this one disagrees on none.tests/withpython -I(491 files): all pass, wheremainhas the one failure.python -I scripts/check_no_game_data.py tests/test_ci_registration.py,python -m compileallandgit diff --check.Run with Python 3.14.10 on Linux. Not run locally: Python 3.12 (the version CI installs), Windows and macOS. The new test reads
unittest's verbose output the waytest_semantic_selection_matches_discovery_through_packagesin the same file already does.GPUs tested: n/a (one Python test file; no shader, fixture or runtime code)
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (No translator change.)🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.