mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-08-01 16:58:06 +00:00
Phase B2 of the sports unification. Both features exist in only some of
the nine scoreboards, so they ship as capabilities the plugin composes,
never as `if self.<feature>_enabled` branches inside the base classes: a
sport that does not opt in has none of this code in its MRO.
CelebrationMixin (afl, nrl, soccer, football)
The two lineages spelled this differently -- _check_for_goal /
celebrate_opponent_goals vs _check_for_score / celebrate_opponent_scores
-- but the bodies were identical apart from three things, each now a
seam rather than a branch:
- wording -> score_phrase() / win_phrase() hooks
- follow-up suppression -> COALESCE_SCORING_SEQUENCE, on for football
where a touchdown lands as +6 then +1, off where two increments are
two real goals
- team identity -> _favorite_key, so nrl matches on team id without
core learning why its abbreviations are ambiguous
Both config spellings are read, so a plugin adopting the mixin keeps
working with the keys already in its published schema.
Rotation strategies
The three "dialects" turned out to be one algorithm (SWRR) in two
shapes: an incremental picker holding state across calls, and a
precomputed per-cycle list. They agree within a cycle and differ only at
the boundary, so core ships both behind a name registry rather than
declaring a winner. weight_for is supplied by the host, so rotation.py
never learns what a favorite is; an unknown name degrades to "simple"
because it arrives from user config.
Each strategy is checked against a verbatim transcription of the plugin
code it replaces, over every live-game shape up to four games -- the
differential B5 will delete the bundled copies on the strength of.
185 new tests. Gates: 648 core unit, 60 plugin safety.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FgbA8SMutQQpXkMG8LMmC4
79 lines
2.5 KiB
YAML
79 lines
2.5 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches: [main]
|
|
|
|
# Both jobs only check out the repo and run pytest.
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
plugin-safety:
|
|
name: Plugin safety harness + unit tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
|
|
with:
|
|
python-version: "3.12"
|
|
cache: pip
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt -r requirements-test.txt
|
|
pip install RGBMatrixEmulator
|
|
|
|
- name: Run harness + visual rendering tests
|
|
run: |
|
|
pytest --no-cov \
|
|
test/plugins/test_harness.py \
|
|
test/plugins/test_visual_rendering.py \
|
|
test/plugins/test_plugin_matrix.py
|
|
|
|
unit-tests:
|
|
name: Core unit tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
|
|
with:
|
|
python-version: "3.12"
|
|
cache: pip
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt -r requirements-test.txt
|
|
pip install RGBMatrixEmulator
|
|
|
|
# Safety net for the shared sports/scroll/style infrastructure. These
|
|
# suites existed but were not enrolled in CI, so a refactor of
|
|
# src/base_classes or src/common could regress them silently. Enrolled
|
|
# explicitly (not `pytest test/`) so known hardware-only suites don't
|
|
# break CI; grow this list as more suites are made headless.
|
|
- name: Run core unit suites
|
|
run: |
|
|
pytest --no-cov \
|
|
test/test_skin_system.py \
|
|
test/test_font_manager.py \
|
|
test/test_data_sources.py \
|
|
test/test_api_extractors.py \
|
|
test/test_scroll_helper.py \
|
|
test/test_scroll_helper_continuous.py \
|
|
test/test_adaptive_layout.py \
|
|
test/test_loader_compat_warning.py \
|
|
test/test_sports_base_characterization.py \
|
|
test/test_element_style.py \
|
|
test/test_sports_core_promotions.py \
|
|
test/test_sports_modes_promotions.py \
|
|
test/test_sports_capabilities.py
|