From ce6bac4960654bec32a15d7c7ee9c926588bc64a Mon Sep 17 00:00:00 2001 From: David L Woodruff Date: Sat, 30 Mar 2024 09:01:27 -0700 Subject: [PATCH] On windows we are just going to have to leave a log file from the test --- pyomo/contrib/iis/tests/test_mis.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pyomo/contrib/iis/tests/test_mis.py b/pyomo/contrib/iis/tests/test_mis.py index 4ec232a80a3..0b2185f3d29 100644 --- a/pyomo/contrib/iis/tests/test_mis.py +++ b/pyomo/contrib/iis/tests/test_mis.py @@ -82,21 +82,23 @@ def _test_mis(solver_name): # On a Windows machine, we will not use a temp dir and just try to delete the log file if os.name == "nt": print("we have nt") - file_name = f"{solver_name}_mis.log" + file_name = f"_test_mis_{solver_name}.log" logger = logging.getLogger(f"test_mis_{solver_name}") + logger.setLevel(logging.INFO) fh = logging.FileHandler(file_name) fh.setLevel(logging.DEBUG) logger.addHandler(fh) mis.compute_infeasibility_explanation(m, opt, logger=logger) _check_output(file_name) + # os.remove(file_name) cannot remove it on Windows. Still in use. else: # not windows with TempfileManager.new_context() as tmpmgr: tmp_path = tmpmgr.mkdtemp() - file_name = os.path.join(tmp_path, f"{solver_name}_mis.log") + file_name = os.path.join(tmp_path, f"_test_mis_{solver_name}.log") logger = logging.getLogger(f"test_mis_{solver_name}") - logger.setlevel(logging.INFO) + logger.setLevel(logging.INFO) fh = logging.FileHandler(file_name) fh.setLevel(logging.DEBUG) logger.addHandler(fh)