Skip to content

Commit

Permalink
Add license guard
Browse files Browse the repository at this point in the history
  • Loading branch information
qtothec committed Apr 17, 2019
1 parent a99e28c commit 87cc43e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pyomo/contrib/gdpopt/tests/test_gdpopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
GLOA_solvers = (mip_solver, global_nlp_solver, minlp_solver)
LOA_solvers_available = all(SolverFactory(s).available() for s in LOA_solvers)
GLOA_solvers_available = all(SolverFactory(s).available() for s in GLOA_solvers)
license_available = SolverFactory(global_nlp_solver).license_is_valid() if GLOA_solvers_available else False


class TestGDPoptUnit(unittest.TestCase):
Expand Down Expand Up @@ -385,6 +386,7 @@ def test_GDP_integer_vars_infeasible(self):
)
self.assertEqual(res.solver.termination_condition, TerminationCondition.infeasible)

@unittest.skipUnless(license_available, "Global NLP solver license not available.")
def test_GLOA_8PP(self):
"""Test the global logic-based outer approximation algorithm."""
exfile = import_file(
Expand All @@ -398,6 +400,7 @@ def test_GLOA_8PP(self):
)
self.assertTrue(fabs(value(eight_process.profit.expr) - 68) <= 1E-2)

@unittest.skipUnless(license_available, "Global NLP solver license not available.")
def test_GLOA_8PP_force_NLP(self):
"""Test the global logic-based outer approximation algorithm."""
exfile = import_file(
Expand All @@ -412,6 +415,7 @@ def test_GLOA_8PP_force_NLP(self):
)
self.assertTrue(fabs(value(eight_process.profit.expr) - 68) <= 1E-2)

@unittest.skipUnless(license_available, "Global NLP solver license not available.")
def test_GLOA_strip_pack_default_init(self):
"""Test logic-based outer approximation with strip packing."""
exfile = import_file(
Expand All @@ -425,6 +429,7 @@ def test_GLOA_strip_pack_default_init(self):
self.assertTrue(
fabs(value(strip_pack.total_length.expr) - 11) <= 1E-2)

@unittest.skipUnless(license_available, "Global NLP solver license not available.")
def test_GLOA_constrained_layout_default_init(self):
"""Test LOA with constrained layout."""
exfile = import_file(
Expand Down

0 comments on commit 87cc43e

Please sign in to comment.