-
Notifications
You must be signed in to change notification settings - Fork 6
Add AI-generated unit testing from SECQUOIA fork #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 69 commits
Commits
Show all changes
88 commits
Select commit
Hold shift + click to select a range
9ba1ca5
Add testing-related files from SECQUOIA fork
Ickaser 1f8f829
Missed a file
Ickaser 636abca
Have tests use pyproject.toml, not requirements.txt
Ickaser 7d21fee
add pandas as dev dep
Ickaser 9aea544
fix tests: replace math.exp with np.exp
Ickaser 4b4b30d
fix: calc_knownRp uses percent rather than 0-1
Ickaser 2d71b30
clean whitespace
Ickaser f79ef6a
fix: Handle edge case in design space
Ickaser bb8b0f1
Move helper func to separate module under tests
Ickaser 04dc914
Fix tests for unknownRp
Ickaser 35e9001
Note that edge case needs treatment
Ickaser 4ece426
cleanup
Ickaser 146ce4f
Include pytest settings in pyproject.toml
Ickaser e3c0b6c
Fully move all tests to percent dried, not fraction
Ickaser ba54799
Further test cleanup
Ickaser b8a1b9d
Ignore some local things
Ickaser 762b25e
Standardize calc_unknownRp tests
Ickaser 668b5b9
Fix a bug in design space, uncovered by tests
Ickaser f4b8c35
DRY the tests out a bit
Ickaser 1e1e450
Eliminate one cause of infinite loops in design space
Ickaser 0580533
fix: give an initial guess in acceptable range
Ickaser a2e3a63
Make a start on handling cases where optimization fails for Pch
Ickaser 7cc345d
Get all tests passing, skip those that address problems which don't e…
Ickaser e7ed041
dry out Tsh a little bit
Ickaser 89e187c
Get all opt_Pch tests passing
Ickaser 73d3e2d
Get some Tsh tests passing
Ickaser 59276a9
Get joint optimization tests passing
Ickaser 480333c
Remove separate "coverage" tests
Ickaser 8af8236
Complete line coverage of opt_Pch
Ickaser 8ae591c
Unify Pch_Tsh optimization, with complete coverage
Ickaser dd6dec3
default ramp rate of no ramp, if not supplied
Ickaser 647d438
Add Tmax parameter to assert_physically_reasonable_output
Ickaser 5b4942e
Tweak path handling
Ickaser 4543700
Include results from web API in repo, for test comparisons
Ickaser c0bfc4f
Add coverage defaults to testing
Ickaser f9ba741
Rename for clarity, delete duplicate tests
Ickaser 37ee318
Consolidate calc_unknownRp into one file
Ickaser 9de5ded
Make unknownRp give useful warnings, test those warnings
Ickaser 86fa972
lint
Ickaser 2f546af
Add warnings for design space, consolidate tests,, get complete test …
Ickaser ce5a6ec
Consolidate
Ickaser 0d5ebe0
Consolidate and clarify knownRp tests
Ickaser a27f759
clarify deps
Ickaser 0ca6e28
Get a proper regression test passing on calc_knownRp by taking dt and…
Ickaser 08ae428
Work on increasing coverage
Ickaser 773e689
Remove redundant test
Ickaser e093497
Make path to test data have one source of truth
Ickaser ac6a566
Standardize a magic number
Ickaser 54a08fb
Test failures
Ickaser 1bf635d
Add one more testing utility function
Ickaser df1457d
Fix and clean up freezing, clean up tests, add tests to reach 100% co…
Ickaser cf3499e
Make example scripts with plots part of the test suite
Ickaser a6d48bb
Add tests which execute notebooks; rework CI to run papermill within …
Ickaser 92f441b
Fix compat bound
Ickaser 180ab8b
fix: don't have notebooks run together with "PR tests"
Ickaser 1466278
Separate out notebook dependencies from docs building dependencies
Ickaser 6c26035
Import papermill inside notebook tests
Ickaser c1b7e0e
Try out writing PR version of docs again
Ickaser f72449f
try again pr docs
Ickaser 424a789
one more thing to try
Ickaser 7889425
move permissions?
Ickaser 4746db3
Give up on PR versions of docs from Actions
Ickaser 898264c
Clean up unused config
Ickaser b6acdcf
Make one category of dev deps, not two
Ickaser 4b3b0bf
Remove unused testing script
Ickaser 81c1175
Delete obsolete test
Ickaser ac3daf1
Modify equations being solved to account for varying shelf temperatur…
Ickaser 5fdcf97
Add reference test for freezing
Ickaser 79e8d3c
Add new reference data for opt_Pch
Ickaser fe69ff2
Point to correct file
Ickaser b840ca3
Test reference case for opt_Pch
Ickaser 3c28e84
Give opt_pch reference case its own inputs setup
Ickaser 6be88f3
Take some of Copilot's review suggestions
Ickaser ab501b6
Linting
Ickaser 9df00fe
Ruff formatting. Lots of whitespace noise, all single quotes to doubl…
Ickaser 11ca994
Get *a* reference test working for opt_Pch
Ickaser d80f5f3
unnecessary imports
Ickaser 12e78ba
Relax tolerance
Ickaser 06cd9cb
Help diagnose CI failure
Ickaser d7eb662
Bite the bullet and add a time interpolator for Tshelf and Pchamber
Ickaser a051012
Make RampInterpolator conform to existing API for dt_setpt, with kwar…
Ickaser 6598280
Add more consistency checks to optimization tests, use some np.testin…
Ickaser 2dc3d3d
Fix freezing reference to be closer to original interpretation
Ickaser 627a911
Get one last test passing
Ickaser eb7b25b
ruff format on tests
Ickaser d1a6fe7
Remove unused sections from pyproject.toml
Ickaser e2265aa
Make some dev docs, shuffle things into there from README, etc.
Ickaser 43c0a21
Add some extra helpers for RampInterpolator, use in calc_knownRp
Ickaser File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # Centralized CI version configuration for LyoPRONTO | ||
| # Update this file to change Python version across all workflows | ||
| python-version: '3.13' |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| name: PR Tests | ||
|
|
||
| # Smart CI workflow: | ||
| # - Draft PRs: Fast tests only (no coverage) for rapid iteration | ||
| # - Ready for Review: Full tests with coverage for quality assurance | ||
| # - All subsequent commits: Continue with full coverage | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [ main ] | ||
| types: [ opened, synchronize, reopened, ready_for_review, converted_to_draft ] | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Read CI version config | ||
| id: versions | ||
| uses: mikefarah/yq@v4.44.1 | ||
| with: | ||
| cmd: yq eval '.python-version' .github/ci-config/ci-versions.yml | ||
|
|
||
| - name: Determine test mode | ||
| id: mode | ||
| run: | | ||
| if [ "${{ github.event.pull_request.draft }}" ]; then | ||
| echo "mode=fast" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "mode=full" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ steps.versions.outputs.result }} | ||
| cache: 'pip' | ||
| cache-dependency-path: | | ||
| pyproject.toml | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip setuptools wheel | ||
| pip install . | ||
| pip install .[dev] | ||
| pip install -e . --no-build-isolation | ||
|
|
||
| - name: Run tests | ||
| # Currently this conditional branching doesn't actually do anything, | ||
| # since pyproject.toml adds these coverage arguments to the testing anyway | ||
| run: | | ||
| if [ "${{ steps.mode.outputs.mode }}" == "fast" ]; then | ||
| echo "⚡ Skipping notebook tests (marked with @pytest.mark.notebook) - these run separately" | ||
| pytest tests/ -n auto -v -m "not notebook" --cov=lyopronto --cov-report=term-missing | ||
| else | ||
| echo "⚡ Skipping notebook tests (marked with @pytest.mark.slow), not running coverage" | ||
| pytest tests/ -n auto -v -m "not notebook" | ||
| fi | ||
|
|
||
| - name: Upload coverage (if run) | ||
| if: steps.mode.outputs.coverage == 'true' | ||
| uses: codecov/codecov-action@v4 | ||
| with: | ||
| file: ./coverage.xml | ||
| flags: pr-tests | ||
| name: pr-coverage | ||
| fail_ci_if_error: false | ||
| token: ${{ secrets.CODECOV_TOKEN }} |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| name: Slow Tests (Manual) | ||
|
|
||
| # Manual workflow for running slow optimization tests | ||
| # Useful for: | ||
| # - Testing before merge if concerned about slow test failures | ||
| # - Running comprehensive tests on feature branches | ||
| # - Validating optimization behavior changes | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| run_all: | ||
| description: 'Run all tests (true) or only slow tests (false)' | ||
| required: false | ||
| default: 'false' | ||
| type: choice | ||
| options: | ||
| - 'true' | ||
| - 'false' | ||
|
|
||
| jobs: | ||
| slow-tests: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Read CI version config | ||
| id: versions | ||
| uses: mikefarah/yq@v4.44.1 | ||
| with: | ||
| cmd: yq eval '.python-version' .github/ci-config/ci-versions.yml | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ steps.versions.outputs.result }} | ||
| cache: 'pip' | ||
| cache-dependency-path: | | ||
| pyproject.toml | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip setuptools wheel | ||
| pip install . | ||
| pip install .[dev] | ||
| pip install -e . --no-build-isolation | ||
|
|
||
| - name: Run slow tests | ||
| run: | | ||
| if [ "${{ inputs.run_all }}" == "true" ]; then | ||
| echo "🔍 Running ALL tests (including slow optimization tests)" | ||
| echo "⏱️ This may take 30-40 minutes on CI" | ||
| pytest tests/ -n auto -v --cov=lyopronto --cov-report=xml --cov-report=term-missing | ||
| else | ||
| echo "🐌 Running ONLY slow tests (marked with @pytest.mark.slow)" | ||
| echo "⏱️ This focuses on optimization tests that take minutes" | ||
| pytest tests/ -n auto -v -m "slow" --cov=lyopronto --cov-report=xml --cov-report=term-missing | ||
| fi | ||
|
|
||
| - name: Upload coverage | ||
| uses: codecov/codecov-action@v4 | ||
| with: | ||
| file: ./coverage.xml | ||
| flags: slow-tests | ||
| name: slow-tests-coverage | ||
| fail_ci_if_error: false | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
|
|
||
| - name: Test Summary | ||
| if: always() | ||
| run: | | ||
| if [ "${{ inputs.run_all }}" == "true" ]; then | ||
| echo "✅ Complete test suite finished" | ||
| else | ||
| echo "🐌 Slow tests completed" | ||
| fi | ||
| echo "📊 Coverage uploaded to Codecov" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| name: Main Branch Tests | ||
|
|
||
| # Full tests with coverage for main branch | ||
| # (PRs are handled by pr-tests.yml) | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main, dev-pyomo ] | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Read CI version config | ||
| id: versions | ||
| uses: mikefarah/yq@v4.44.1 | ||
| with: | ||
| cmd: yq eval '.python-version' .github/ci-config/ci-versions.yml | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ steps.versions.outputs.result }} | ||
| cache: 'pip' | ||
| cache-dependency-path: | | ||
| pyproject.toml | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip setuptools wheel | ||
| pip install . | ||
| pip install .[dev] | ||
| pip install -e . --no-build-isolation | ||
|
|
||
| - name: Run ALL tests with pytest and coverage (including slow tests) | ||
| run: | | ||
| echo "🔍 Running complete test suite including slow tests" | ||
| echo "⏱️ This may take 30-40 minutes on CI (includes optimization tests)" | ||
| pytest tests/ -n auto -v --cov=lyopronto --cov-report=xml --cov-report=term-missing | ||
|
|
||
| - name: Upload coverage to Codecov | ||
| uses: codecov/codecov-action@v4 | ||
| with: | ||
| file: ./coverage.xml | ||
| flags: unittests | ||
| name: codecov-umbrella | ||
| fail_ci_if_error: false | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
|
|
||
| - name: Coverage Summary | ||
| if: always() | ||
| run: | | ||
| echo "✅ Full coverage tests completed for main branch" | ||
| echo "📊 Coverage metrics updated in Codecov" |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.