From 728873e3778bec9786fe1be4ceddca1052da6cff Mon Sep 17 00:00:00 2001 From: Florian Maurer Date: Wed, 20 Nov 2024 14:46:48 +0100 Subject: [PATCH] fix running pyomo test-solvers --- pyomo/opt/plugins/driver.py | 2 +- pyomo/solvers/tests/testcases.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pyomo/opt/plugins/driver.py b/pyomo/opt/plugins/driver.py index c7c7103835c..beaf5268fe9 100644 --- a/pyomo/opt/plugins/driver.py +++ b/pyomo/opt/plugins/driver.py @@ -50,7 +50,7 @@ def setup_test_parser(parser): def test_exec(options): import pyomo.solvers.tests.testcases - pyomo.solvers.tests.testcases.run_test_scenarios(options) + pyomo.solvers.tests.testcases.run_scenarios(options) # diff --git a/pyomo/solvers/tests/testcases.py b/pyomo/solvers/tests/testcases.py index 6bef40818d9..f0ea27136b6 100644 --- a/pyomo/solvers/tests/testcases.py +++ b/pyomo/solvers/tests/testcases.py @@ -355,7 +355,7 @@ def run_scenarios(options): for key, test_case in generate_scenarios(): model, solver, io = key - if len(solvers) > 0 and not solver in solvers: + if len(solvers) > 0 and solver not in solvers: continue if test_case.status == 'skip': continue @@ -381,7 +381,7 @@ def run_scenarios(options): # Validate solution status try: model_class.post_solve_test_validation(None, results) - except: + except Exception: if test_case.status == 'expected failure': stat[key] = (True, "Expected failure") else: @@ -431,7 +431,7 @@ def run_scenarios(options): total = Bunch(NumEPass=0, NumEFail=0, NumUPass=0, NumUFail=0) for key in stat: model, solver, io = key - if not solver in summary: + if solver not in summary: summary[solver] = Bunch(NumEPass=0, NumEFail=0, NumUPass=0, NumUFail=0) _pass, _str = stat[key] if _pass: