pytest: rework conftest.py to support solver/writer marker expressions#3854
Merged
jsiirola merged 14 commits intoPyomo:mainfrom Feb 18, 2026
Merged
pytest: rework conftest.py to support solver/writer marker expressions#3854jsiirola merged 14 commits intoPyomo:mainfrom
conftest.py to support solver/writer marker expressions#3854jsiirola merged 14 commits intoPyomo:mainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3854 +/- ##
==========================================
+ Coverage 89.59% 89.63% +0.04%
==========================================
Files 905 905
Lines 106006 106014 +8
==========================================
+ Hits 94974 95030 +56
+ Misses 11032 10984 -48
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
mrmundt
reviewed
Feb 18, 2026
mrmundt
reviewed
Feb 18, 2026
mrmundt
reviewed
Feb 18, 2026
mrmundt
approved these changes
Feb 18, 2026
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.
Fixes # .
Summary/Motivation:
Pyomo's existing pytest configuration supports marking solver tests using
pytest.mark.solver(name), and then running those tests using a custom--solver namecommand line argument. However, the test selection was done by skipping tests at runtime and not deselecting the tests after collection. Further, the markers could not be used in "normal" marker expressions (because pytest does not support accessing positional arguments in marker expressions).This PR redesigns how we handle
solvermarkers:id). This enables using markers expressions likesolver(id='highs')to select tests based on the solver marker.vendor) is also defined using a substring ofidup to, but not including the first underscore. This supports selecting "all" tests for a vendor. For examplesolver(vendor='gurobi')will matchgurobi,gurobi_direct, andgurobi_persistentsolver markers.--solvercommand line option is now translated into a marker expression (instead of relying on skipping tests at runtime)solvermarker definition into thepyproject.toml(with all the other markers)In addition, this PR:
writermarker that works analogously to thesolvermarkerpyproject.tomlsolvermarker through the solver tests inpyomo.solversandpyomo.contrib.solverpaarameterized.expandChanges proposed in this PR:
Legal Acknowledgement
By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution: