Skip to content

Add protocol compliance testing helpers#1953

Merged
FlorianPfaff merged 1 commit intomainfrom
feature/protocol-testing-helpers
May 3, 2026
Merged

Add protocol compliance testing helpers#1953
FlorianPfaff merged 1 commit intomainfrom
feature/protocol-testing-helpers

Conversation

@FlorianPfaff
Copy link
Copy Markdown
Owner

Summary

Adds reusable protocol-compliance testing helpers:

  • pyrecest.protocols.testing
  • ProtocolAssertionError
  • generic helpers for runtime protocol checks, attributes, callable methods, non-None method results, and array shape checks
  • convenience helpers for common PyRecEst capabilities: dimensions, distribution-like methods, minimal filter contract, likelihood models, and transition models
  • focused unit tests for all helpers
  • docs section showing how to use the helpers in capability tests

Scope

This is intentionally additive and independent of the distribution/filter/model/conversion/manifold protocol PRs. It does not change existing distribution, filter, model, conversion, or manifold behavior.

The helpers use duck typing plus the common protocols from PR0 so they can be used immediately and refined later as more protocol modules land.

Non-goals

Not included:

  • new distribution/filter/model protocols
  • package-level exports from pyrecest.protocols
  • py.typed
  • changes to existing abstract base classes
  • mathematical correctness tests for any concrete estimator or distribution

Tests

Focused local checks:

PYTHONPATH=src python -m compileall -q src/pyrecest/protocols tests/protocols/test_protocol_testing_helpers.py
PYTHONPATH=src pytest -q tests/protocols/test_protocol_testing_helpers.py

Result:

12 passed

Stacking

This PR is stacked on #1952 and targets feature/public-protocol-seed. After #1952 is merged, this PR can be retargeted to main if needed.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 17.62s
✅ JSON prettier 2 0 0 0 0.52s
✅ JSON v8r 2 0 0 3.12s
✅ MARKDOWN markdownlint 28 0 0 0 1.39s
✅ MARKDOWN markdown-table-formatter 28 1 0 0 0.34s
✅ PYTHON bandit 478 0 0 7.52s
✅ PYTHON black 478 22 0 0 13.49s
✅ PYTHON flake8 478 0 0 4.18s
✅ PYTHON isort 478 27 0 0 0.91s
✅ PYTHON mypy 478 0 0 6.3s
✅ PYTHON pylint 478 0 0 108.92s
✅ PYTHON ruff 478 27 0 0 0.11s
✅ REPOSITORY checkov yes no no 23.19s
✅ REPOSITORY gitleaks yes no no 13.31s
✅ REPOSITORY git_diff yes no no 0.08s
✅ REPOSITORY secretlint yes no no 8.99s
✅ REPOSITORY syft yes no no 3.42s
✅ REPOSITORY trivy-sbom yes no no 3.63s
✅ REPOSITORY trufflehog yes no no 21.54s
✅ YAML prettier 5 0 0 0 0.71s
✅ YAML v8r 5 0 0 5.74s
✅ YAML yamllint 5 0 0 0.5s

See detailed reports in MegaLinter artifacts

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@9.4.0 --custom-flavor-setup --custom-flavor-linters PYTHON_PYLINT,PYTHON_BLACK,PYTHON_FLAKE8,PYTHON_ISORT,PYTHON_BANDIT,PYTHON_MYPY,PYTHON_RUFF,COPYPASTE_JSCPD,JSON_V8R,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_CHECKOV,REPOSITORY_GIT_DIFF,REPOSITORY_GITLEAKS,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY_SBOM,REPOSITORY_TRUFFLEHOG,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

Test Results

    12 files  ±  0      12 suites  ±0   4h 42m 21s ⏱️ + 26m 15s
 1 375 tests + 12   1 375 ✅ + 12      0 💤 ±0  0 ❌ ±0 
16 864 runs  +144  13 288 ✅ +144  3 576 💤 ±0  0 ❌ ±0 

Results for commit 90f7a54. ± Comparison against base commit f9cd9d3.

♻️ This comment has been updated with latest results.

@FlorianPfaff FlorianPfaff force-pushed the feature/protocol-testing-helpers branch from 9a3b63d to 47912d0 Compare May 3, 2026 07:58
@FlorianPfaff FlorianPfaff changed the base branch from feature/public-protocol-seed to main May 3, 2026 08:09
@FlorianPfaff FlorianPfaff force-pushed the feature/protocol-testing-helpers branch from 47912d0 to 90f7a54 Compare May 3, 2026 17:35
@FlorianPfaff FlorianPfaff merged commit 7adf7ea into main May 3, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant