The repository does not mainly need more test volume—it already has 1,690 tests and about
Commit

95.3% statement coverage locally. The next gains are CI reliability, reproducibility, and artifact testing.
Highest priorities
- Test the exact commit
The formatting job currently rewrites the code, applies that patch to every test job, then optionally commits it later (.github/workflows/test.yml:37). That means CI tests code that is not actually in the PR commit, and fork PRs can pass while remaining unformatted.
Make formatting a check-only required job:
pre-commit run --all-files --show-diff-on-failure
If automatic formatting is desired, keep it as a separate optional/manual workflow.
- Add coverage enforcement
I measured 95.33% statement coverage with the two external Kaleido exports excluded. Add pytest-cov to the test extra and enforce an initial 95% floor in one Linux job. Then introduce branch coverage and changed-line coverage without chasing 100%.
pytest --cov=postgkyl --cov-branch
--cov-report=term-missing --cov-report=xml
--cov-fail-under=95
- Prevent hangs and silent skips
The Kaleido GIF test (tests/test_render_plotly.py:534) did not complete within 45 seconds even though Chrome detection passed. Add:
- pytest-timeout, with strict timeouts around external renderers.
- Job-level timeout-minutes.
- Explicit unit, native, render, and external_tool markers.
- --strict-markers --strict-config -ra.
- A native-job preflight that fails unless gpython.available() is true; native tests must not silently skip because the extension failed to load.
- Test distributable artifacts
CI only tests an editable checkout. The extension currently embeds an absolute runpath to the checkout (scripts/build_gpython.sh:72), while libg0core.so is not included as package data (pyproject.toml:74). A wheel is therefore likely non-portable.
Add a packaging job that:
- Builds sdist and wheel.
- Runs twine check.
- Installs the wheel in a clean temporary environment.
- Imports Postgkyl from outside the repository.
- Runs pgkyl --version and a native load/interpolate smoke test.
- Checks Linux/macOS shared-library dependencies with auditwheel/delocate.
- Make builds reproducible
Gkeyll is cloned from a moving branch (scripts/build_gkeyll.sh:13). Pin one exact commit in one authoritative location and key the CI cache from it. Update that commit deliberately through a scheduled dependency-update workflow.
Also reconcile requirements.txt:1 with pyproject.toml:13; their dependency names and floors currently disagree. Prefer pyproject.toml as the source of truth and generate constraints mechanically.
Recommended CI shape
- quality: formatting, Ruff linting, architecture tests, incremental type checking.
- unit: pure/core tests over every supported Python version.
- coverage: complete Linux suite on one representative Python.
- native: targeted Gkeyll/C-extension tests on Linux and macOS.
- render: known Chrome/ffmpeg/OpenGL environment, isolated and timed.
- package: clean sdist/wheel installation.
- sanitizer: scheduled ASan/UBSan native run.
Add push on the default branch, workflow_dispatch, concurrency cancellation, pip/native- build caching, and Python 3.13/3.14 coverage if they are supported. Currently requires- python >=3.10, classifiers, and the 3.10–3.12 matrix disagree.
Improve test quality
The most valuable new tests would be property-based invariants rather than more branch- targeted examples:
- nodal/modal/quad round trips;
- integration of constants equals physical volume;
- native and NumPy linear operations agree after interpolation;
- I/O round trips preserve grid, metadata, and value form;
- inplace and emitted-result paths are equivalent without aliasing;
- malformed states are rejected at construction.
Finally, make warnings errors by default and scope the broad global ignores in pyproject.toml:83 to the tests that intentionally produce them.
I would implement this in three PRs: CI reliability and coverage first, reproducible packaging second, then test tiers/property testing/static analysis.
The hardened non-external suite is now clean: 1,704 passed, 6 expected skips, and warnings- as-errors exposed and eliminated ten unclosed-file leaks. The native extension now loads through $ORIGIN with its bundled library, so I’m doing the final branch-coverage and clean- artifact validation before handing this over.
Implemented a comprehensive CI/testing hardening pass.
Key improvements:
-
Tiered CI across Python 3.10–3.14, Linux/macOS, renderers, coverage, and packaging: .github/workflows/test.yml
-
Strict pytest markers, warnings-as-errors, native capability enforcement, and 93% branch- coverage gate: pyproject.toml
-
24 new invariant tests for arithmetic, integration, cloning, and representations: tests/ test_invariants.py
-
Reproducible Gkeyll revision and portable native wheels using $ORIGIN/@loader_path: scripts/build_gkeyll.sh
-
Clean, off-checkout wheel verification: scripts/smoke_wheel.sh
-
Ruff and repository sanity hooks added to pre-commit.
-
Weekly dependency and GitHub Actions updates: .github/dependabot.yml
-
Removed duplicated requirements.txt; pyproject.toml is now authoritative.
Validation completed:
- 1,704 passed, 6 expected skips, 4 external tests deselected.
- Combined branch coverage: 93.54%.
- Native lane: 495 passed.
- Pure compatibility lane: 269 passed with the extension physically absent.
- Clean native wheel installation, import, load, and interpolation passed.
- YAML, TOML, shell syntax, formatting, and diff checks passed.
The macOS loader path and Python 3.14 environment remain platform-CI validations.
Entire-Checkpoint: 01M1Q65XWD97TWG5D2F8HG7ETS