Skip to content

Commit ce6bac4

Browse files
committed
On windows we are just going to have to leave a log file from the test
1 parent daeed6e commit ce6bac4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pyomo/contrib/iis/tests/test_mis.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -82,21 +82,23 @@ def _test_mis(solver_name):
8282
# On a Windows machine, we will not use a temp dir and just try to delete the log file
8383
if os.name == "nt":
8484
print("we have nt")
85-
file_name = f"{solver_name}_mis.log"
85+
file_name = f"_test_mis_{solver_name}.log"
8686
logger = logging.getLogger(f"test_mis_{solver_name}")
87+
logger.setLevel(logging.INFO)
8788
fh = logging.FileHandler(file_name)
8889
fh.setLevel(logging.DEBUG)
8990
logger.addHandler(fh)
9091

9192
mis.compute_infeasibility_explanation(m, opt, logger=logger)
9293
_check_output(file_name)
94+
# os.remove(file_name) cannot remove it on Windows. Still in use.
9395

9496
else: # not windows
9597
with TempfileManager.new_context() as tmpmgr:
9698
tmp_path = tmpmgr.mkdtemp()
97-
file_name = os.path.join(tmp_path, f"{solver_name}_mis.log")
99+
file_name = os.path.join(tmp_path, f"_test_mis_{solver_name}.log")
98100
logger = logging.getLogger(f"test_mis_{solver_name}")
99-
logger.setlevel(logging.INFO)
101+
logger.setLevel(logging.INFO)
100102
fh = logging.FileHandler(file_name)
101103
fh.setLevel(logging.DEBUG)
102104
logger.addHandler(fh)

0 commit comments

Comments
 (0)