[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

Closed
opened 2026-11-26 20:21:06 +01:00 by 4ld0 · 0 comments
Owner

📋 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)

  • fd0a539 tests: 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

main is red on tests/test_ci_registration.py since 540d5111f, 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, so check, stdlib-tests-linux and macos-python fail on every pull request whose run starts on a main from then on.

test_every_selected_file_exposes_a_test_to_its_runner reports #930's tests/semantic/test_sub_co_same_operand.py as 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.py runs 6 tests there. Its three TestCase classes have no test method of their own. They take them from _SameOperandMixin, a plain class defined in the same file, one TestCase per wave size. defines_a_test looked at a TestCase'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:

  • the test* methods of the classes of the module that a TestCase derives from, directly or through other classes of the module;
  • a base imported from another module that is reached that way (class Middle(Imported), then class Example(Middle, unittest.TestCase)), as it already did for one the TestCase names itself.

unittest's loader lists a class's tests with dir(), so these are tests the runner runs.

Tested

  • python -I tests/test_ci_registration.py: 16 tests pass on this branch (main 89d7dfcf5 plus the commit). On main alone it fails at test_every_selected_file_exposes_a_test_to_its_runner; at 4a50cafc7 it passes and at 540d5111f it fails.
  • The new test, test_inherited_tests_count_where_unittest_discover_collects_them, does not carry my expectations alone: it writes eight small modules, runs unittest discover on them once and holds the scan to what the runner collected. Five have a test (a mixin above the TestCase, two classes up, beside a TestCase base without tests, an imported mixin named directly and through a local class) and three have none (a base without tests, a mixin no TestCase derives from, a mixin without a TestCase).
  • Control: with main's defines_a_test put back, that test fails in four of the five cases with a test (all but the directly named imported mixin, which main already handled), and the repository check fails as on main.
  • Over the whole repository, at 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.py is 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). So main's scan disagreed with the runner on that one file, and this one disagrees on none.
  • Every standalone test file under tests/ with python -I (491 files): all pass, where main has the one failure.
  • python -I scripts/check_no_game_data.py tests/test_ci_registration.py, python -m compileall and git 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 way test_semantic_selection_matches_discovery_through_packages in 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

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of 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.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1365 **Author:** [@milk4sale](https://github.com/milk4sale) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/25/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `test/ci-registration-local-mixin` --- ### 📝 Commits (1) - [`fd0a539`](https://github.com/ubiquitarianism/leonida/commit/fd0a5390753c24c92428b6beadd41b704a93cbb1) tests: 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) <details> <summary>View changed files</summary> 📝 `tests/test_ci_registration.py` (+59 -3) </details> ### 📄 Description Claimed in the coordination issue as: TEST-CI-REG-LOCAL-MIXIN (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7146307911) ### What and why `main` is red on `tests/test_ci_registration.py` since `540d5111f`, 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, so `check`, `stdlib-tests-linux` and `macos-python` fail on every pull request whose run starts on a `main` from then on. `test_every_selected_file_exposes_a_test_to_its_runner` reports #930's `tests/semantic/test_sub_co_same_operand.py` as 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.py` runs 6 tests there. Its three `TestCase` classes have no test method of their own. They take them from `_SameOperandMixin`, a plain class defined in the same file, one `TestCase` per wave size. `defines_a_test` looked at a `TestCase`'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: - the `test*` methods of the classes of the module that a `TestCase` derives from, directly or through other classes of the module; - a base imported from another module that is reached that way (`class Middle(Imported)`, then `class Example(Middle, unittest.TestCase)`), as it already did for one the `TestCase` names itself. `unittest`'s loader lists a class's tests with `dir()`, so these are tests the runner runs. ### Tested - `python -I tests/test_ci_registration.py`: 16 tests pass on this branch (`main` `89d7dfcf5` plus the commit). On `main` alone it fails at `test_every_selected_file_exposes_a_test_to_its_runner`; at `4a50cafc7` it passes and at `540d5111f` it fails. - The new test, `test_inherited_tests_count_where_unittest_discover_collects_them`, does not carry my expectations alone: it writes eight small modules, runs `unittest discover` on them once and holds the scan to what the runner collected. Five have a test (a mixin above the `TestCase`, two classes up, beside a `TestCase` base without tests, an imported mixin named directly and through a local class) and three have none (a base without tests, a mixin no `TestCase` derives from, a mixin without a `TestCase`). - Control: with `main`'s `defines_a_test` put back, that test fails in four of the five cases with a test (all but the directly named imported mixin, which `main` already handled), and the repository check fails as on `main`. - Over the whole repository, at `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.py` is 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). So `main`'s scan disagreed with the runner on that one file, and this one disagrees on none. - Every standalone test file under `tests/` with `python -I` (491 files): all pass, where `main` has the one failure. - `python -I scripts/check_no_game_data.py tests/test_ci_registration.py`, `python -m compileall` and `git 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 way `test_semantic_selection_matches_discovery_through_packages` in 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 - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (No translator change.) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:21:06 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#1395
No description provided.