Run test suite under Python -O / -OO in CI#608
Open
arunkumargururaj07-star wants to merge 3 commits intobayesflow-org:mainfrom
Open
Run test suite under Python -O / -OO in CI#608arunkumargururaj07-star wants to merge 3 commits intobayesflow-org:mainfrom
arunkumargururaj07-star wants to merge 3 commits intobayesflow-org:mainfrom
Conversation
LarsKue
requested changes
Jan 13, 2026
Contributor
LarsKue
left a comment
There was a problem hiding this comment.
Thank you for the PR. Please target the dev branch instead of the main branch. Further, I think we need to avoid making the test suite too expensive, see individual comments for changes.
| os: [ubuntu-latest, windows-latest] | ||
| python-version: ["3.10"] # we usually only need to test the oldest python version | ||
| backend: ["jax", "tensorflow", "torch"] | ||
| optimization: ["", "-O", "-OO"] |
Contributor
There was a problem hiding this comment.
Running the optimizations in the matrix is too expensive. Can we add a separate manual-trigger only workflow to handle this instead?
| - name: Run Tests | ||
| run: | | ||
| pytest -x -m "not slow" | ||
| python ${{ matrix.optimization }} -m pytest tests/ --tb=short -v |
Contributor
There was a problem hiding this comment.
Can you go into some detail why you chose to make this verbose but shorten the traceback? I'm not entirely sure of the implications for the output yet.
Contributor
There was a problem hiding this comment.
Please keep this file unchanged with respect to the dev branch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR updates the CI workflow to run the test suite under Python optimization
flags (-O and -OO).
The goal is to ensure that tests behave correctly when assertions in the main
codebase are stripped, while relying on pytest’s assertion rewriting for test
files.
No test logic or helper functions were modified — only the GitHub Actions
workflow was updated to add optimized test runs.