From 85c6a386efa4639b6fc823911c2bf6b52d0e37c5 Mon Sep 17 00:00:00 2001 From: Michael Hines Date: Wed, 27 Dec 2023 17:12:08 -0500 Subject: [PATCH] cannot unlink a missing file without missing_ok=True arg. --- test/coreneuron/test_nmodlrandom_syntax.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/coreneuron/test_nmodlrandom_syntax.py b/test/coreneuron/test_nmodlrandom_syntax.py index fed4bdf517..db6614e3d4 100644 --- a/test/coreneuron/test_nmodlrandom_syntax.py +++ b/test/coreneuron/test_nmodlrandom_syntax.py @@ -60,13 +60,11 @@ def chk_nmodl(txt, program="nocmodl", rcode=False): f = open("temp.mod", "w") f.write(txt) f.close() - f = open("temp.cpp", "w") # so can be unlinked after run if not created - f.close() result = run([program, "temp.mod"]) ret = (result.returncode == 0) == rcode if ret: pathlib.Path.unlink("temp.mod") - pathlib.Path.unlink("temp.cpp") + pathlib.Path.unlink("temp.cpp", missing_ok=True) else: print("chk_nmodl ", program, " return code ", result.returncode) print(txt)