Skip to content

Add Pyomo example smoke coverage#19

Merged
bernalde merged 1 commit into
pr/docs-examplesfrom
fix/issue-14-pyomo-example-smoke
May 8, 2026
Merged

Add Pyomo example smoke coverage#19
bernalde merged 1 commit into
pr/docs-examplesfrom
fix/issue-14-pyomo-example-smoke

Conversation

@bernalde
Copy link
Copy Markdown
Member

@bernalde bernalde commented May 8, 2026

Summary

  • Adds explicit Pyomo and IPOPT availability checks to examples/example_pyomo_optimizer.py.
  • Makes the example return a clear nonzero failure when optional optimization dependencies are missing or when no optimization stage solves.
  • Updates smoke coverage to validate missing-Pyomo, missing-IPOPT, all-stages-failed, and solved-stage success behavior.

Tests run

  • python -m pytest tests/test_example_scripts.py::TestPyomoExamples -v -n 0
    • Result: passed, 5 passed in 2.75s after formatting.
  • python -m ruff check tests/test_example_scripts.py examples/example_pyomo_optimizer.py
    • Result: passed.
  • python -m ruff format --check tests/test_example_scripts.py examples/example_pyomo_optimizer.py
    • Result: passed, 2 files already formatted.
  • python -m pytest tests/ -n auto -v -m "not notebook and not pyomo" --ignore=tests/test_pyomo_models
    • Result: passed, 247 passed in 439.92s.
  • python -m mypy lyopronto/
    • Result: passed, no issues found in 12 source files. The installed mypy emitted a config warning that python_version = 3.8 is no longer supported by that mypy version, but exited successfully.

Notes

  • This PR is stacked on pr/docs-examples to target the tail of PR PR 7/7: Pyomo documentation, examples, and CHANGELOG #12, where examples/example_pyomo_optimizer.py is introduced.
  • Notebook tests were not run locally as part of this change because the affected behavior is in the Pyomo example script and CI runs notebooks in a separate workflow.

Closes #14

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.

Review summary:

  1. Blocking issues: None.
  2. Nonblocking issues: None.
  3. Questions: None.
  4. Tests run and outcomes:
  • pytest tests/test_example_scripts.py -m "not notebook": 5 passed.
  • python examples/example_pyomo_optimizer.py: passed; solved 3 of 3 optimization stages.
  • python -m pytest tests/ -n auto -v -m "not notebook and not pyomo" --ignore=tests/test_pyomo_models: 247 passed, 2064 warnings.
  • python -m pytest tests/test_web_interface.py -v: 8 passed.

Note: An initial broad run via the pytest console script hit local import-path failures for examples/benchmarks in this non-editable environment; rerunning the same selection through python -m pytest passed.
5. Merge as-is: Yes. GitHub would not accept an APPROVE review from this authenticated user because the user is the PR author, so I am leaving this as COMMENT.

@bernalde bernalde merged commit a976717 into pr/docs-examples May 8, 2026
2 checks passed
@bernalde bernalde deleted the fix/issue-14-pyomo-example-smoke branch May 8, 2026 21:26
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