forked from molecule-ai/molecule-core
The previous header said `unittest discover from the scripts/ root walks recursively`, contradicting the workflow body which runs two passes precisely because discover does NOT recurse without __init__.py. Fixed self-review feedback on PR #2440. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
53 lines
2.0 KiB
YAML
53 lines
2.0 KiB
YAML
name: Ops Scripts Tests
|
|
|
|
# Runs the unittest suite for scripts/ on every PR + push that touches
|
|
# anything under scripts/. Kept separate from the main CI so a script-only
|
|
# change doesn't trigger the heavier Go/Canvas/Python pipelines.
|
|
#
|
|
# Discovery layout: tests sit alongside the code they test (see
|
|
# scripts/ops/test_sweep_cf_decide.py for the pattern; scripts/
|
|
# test_build_runtime_package.py for the rewriter coverage). The job
|
|
# below runs `unittest discover` TWICE — once from `scripts/`, once
|
|
# from `scripts/ops/` — because neither dir has an `__init__.py`, so
|
|
# a single discover from `scripts/` doesn't recurse into the ops
|
|
# subdir. Two passes is simpler than retrofitting namespace packages.
|
|
|
|
on:
|
|
push:
|
|
branches: [main, staging]
|
|
paths:
|
|
- 'scripts/**'
|
|
- '.github/workflows/test-ops-scripts.yml'
|
|
pull_request:
|
|
branches: [main, staging]
|
|
paths:
|
|
- 'scripts/**'
|
|
- '.github/workflows/test-ops-scripts.yml'
|
|
merge_group:
|
|
types: [checks_requested]
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
test:
|
|
name: Ops scripts (unittest)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
|
with:
|
|
python-version: '3.11'
|
|
- name: Run scripts/ unittests (build_runtime_package, …)
|
|
# Top-level scripts/ tests live alongside their target file
|
|
# (e.g. scripts/test_build_runtime_package.py exercises
|
|
# scripts/build_runtime_package.py). discover from scripts/
|
|
# picks up only top-level test_*.py because scripts/ops/ has
|
|
# no __init__.py — that's intentional, so we run two passes.
|
|
working-directory: scripts
|
|
run: python -m unittest discover -t . -p 'test_*.py' -v
|
|
- name: Run scripts/ops/ unittests (sweep_cf_decide, …)
|
|
working-directory: scripts/ops
|
|
run: python -m unittest discover -p 'test_*.py' -v
|