Skip to content

Audit edge-case warning semantics#25

Merged
bernalde merged 1 commit into
pr/benchmarksfrom
fix/issue-23-warning-semantics
May 10, 2026
Merged

Audit edge-case warning semantics#25
bernalde merged 1 commit into
pr/benchmarksfrom
fix/issue-23-warning-semantics

Conversation

@bernalde
Copy link
Copy Markdown
Member

Summary

  • Removed the legacy repository-wide warning filters from pytest.ini.
  • Made lyopronto.functions.Rp_finder handle the exact Tbot == T_sub singular case explicitly.
  • Replaced broad warning suppression with focused pytest.warns or test-local pytest.mark.filterwarnings in the edge-case tests that intentionally exercise infeasible/no-sublimation paths.

Warning Filters

  • Removed all global filters for calc_unknownRp, calc_knownRp, design_space, opt_Pch, and the Rp_finder divide-by-zero RuntimeWarning from pytest.ini.
  • Added module-local filters in tests/test_calc_unknownRp_coverage.py for repeated expected No sublimation and setpoint-exhaustion warnings from coverage-only unknown-Rp scenarios.
  • Added test-local filters in tests/test_coverage_gaps.py for expected design-space infeasibility and single-timestep warnings.
  • Added test-local filters in opt_Pch coverage/comparison tests where optimizer failure or incomplete drying is the expected tolerated edge-case behavior.
  • Changed tests/test_calculators.py::TestEdgeCases::test_very_low_shelf_temperature to assert the expected known-Rp vapor-pressure warning with pytest.warns.
  • Kept no repository-wide warning filters. No custom warning categories were introduced.

Rp_finder

Rp_finder now treats a zero bottom-to-sublimation temperature gradient as a documented singular resistance case instead of relying on NumPy divide warnings:

  • nonzero pressure driving force returns signed infinity;
  • zero pressure driving force returns NaN for the indeterminate 0/0 case;
  • focused tests assert the behavior and confirm no warning is emitted.

Tests Run

  • pytest tests/test_functions.py tests/test_calc_unknownRp.py tests/test_calc_knownRp.py tests/test_design_space.py tests/test_opt_Pch.py tests/test_calc_unknownRp_coverage.py tests/test_coverage_gaps.py -q -o addopts= -o filterwarnings=error --maxfail=10
    • Result: 127 passed in 180.20s
  • python -m pytest tests/test_calculators.py::TestEdgeCases::test_very_low_shelf_temperature tests/test_opt_Pch_coverage.py tests/test_opt_Pch_Tsh.py::TestOptPchTshValidation::test_joint_optimization_faster_than_single tests/test_opt_Pch_Tsh_coverage.py::TestOptPchTshComparison::test_joint_opt_vs_pch_only -q -o addopts= -o filterwarnings=error
    • Result: 16 passed in 111.95s
  • python -m pytest tests/ -n auto -q -m "not notebook and not pyomo" --ignore=tests/test_pyomo_models
    • Result: 257 passed in 359.27s
  • git diff --check
    • Result: passed
  • python -m mypy lyopronto/functions.py
    • Result: Success: no issues found in 1 source file
    • Note: local mypy also prints that configured Python 3.8 is no longer supported by this installed mypy version.

Notes

  • python -m ruff check on the changed files was run and reports existing legacy style/import/trailing-whitespace issues across these files; those are outside this warning-semantics change.
  • python -m black --check on the changed files was run and reports that the legacy files would be reformatted; no formatting pass was applied to avoid unrelated churn.
  • Notebook and Pyomo solver tests were not run locally; the requested practical non-notebook/non-Pyomo subset was run.

Closes #23

Copy link
Copy Markdown
Member Author

@bernalde bernalde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed against issue #23 and the surrounding warning-producing paths. I did not find blocking issues. The PR removes the repository-wide warning filters, keeps expected noisy warnings localized to tests that intentionally exercise those paths, and adds focused coverage for the Rp_finder Tbot == T_sub singular cases. Targeted warning-as-error tests and the practical non-notebook/non-Pyomo test subset pass locally. Merge-ready from my review; GitHub would not allow an APPROVE review from the PR author account.

@bernalde bernalde merged commit 9919cfc into pr/benchmarks May 10, 2026
2 checks passed
@bernalde bernalde deleted the fix/issue-23-warning-semantics branch May 10, 2026 19:32
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