-
Notifications
You must be signed in to change notification settings - Fork 238
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
Add SCIP solver for testing #1282
Changes from all commits
b7180a1
b8170e6
e262687
fe38431
378c6a7
d5219dc
986ba84
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, @lbianchi-lbl ! Can I note how funny this name is, though? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for noting, that was very much on purpose! I like to think of it as "Barber paradox for software engineers" 😅 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
################################################################################# | ||
# The Institute for the Design of Advanced Energy Systems Integrated Platform | ||
# Framework (IDAES IP) was produced under the DOE Institute for the | ||
# Design of Advanced Energy Systems (IDAES). | ||
# | ||
# Copyright (c) 2018-2023 by the software owners: The Regents of the | ||
# University of California, through Lawrence Berkeley National Laboratory, | ||
# National Technology & Engineering Solutions of Sandia, LLC, Carnegie Mellon | ||
# University, West Virginia University Research Corporation, et al. | ||
# All rights reserved. Please see the files COPYRIGHT.md and LICENSE.md | ||
# for full copyright and license information. | ||
################################################################################# | ||
import os | ||
|
||
import pytest | ||
from pyomo.environ import SolverFactory | ||
|
||
from idaes.core.util.testing import _enable_scip_solver_for_testing | ||
|
||
|
||
ampl_module_scip = pytest.importorskip( | ||
"ampl_module_scip", reason="'ampl_module_scip' not available" | ||
) | ||
|
||
|
||
@pytest.mark.unit | ||
def test_path_manipulation(): | ||
path_before_enabling = str(os.environ["PATH"]) | ||
|
||
func_to_revert_changes = _enable_scip_solver_for_testing() | ||
path_after_enabling = str(os.environ["PATH"]) | ||
sf = SolverFactory("scip") | ||
assert len(path_after_enabling) > len(path_before_enabling) | ||
assert str(ampl_module_scip.bin_dir) in str(sf.executable()) | ||
assert sf.available() | ||
|
||
func_to_revert_changes() | ||
path_after_reverting = str(os.environ["PATH"]) | ||
assert path_after_reverting == path_before_enabling |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,7 +127,7 @@ def __getitem__(self, key): | |
# Put abstract (non-versioned) deps here. | ||
# Concrete dependencies go in requirements[-dev].txt | ||
install_requires=[ | ||
"pyomo>=6.6.2", | ||
"pyomo @ git+https://github.com/IDAES/[email protected]", | ||
"pint", # required to use Pyomo units | ||
"networkx", # required to use Pyomo network | ||
"numpy", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a bad idea to add a test to cover this case to future-proof against any changes in how AMPL and/or Python handle their
PATH
entries / modifications in the future.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree it'd be nice to have the "undo" functionality tested. It's a bit tricky but I'll see what I can do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mrmundt I've added a basic test for the PATH manipulation: 986ba84