Skip to content

Commit

Permalink
cannot unlink a missing file without missing_ok=True arg.
Browse files Browse the repository at this point in the history
  • Loading branch information
nrnhines committed Dec 27, 2023
1 parent 4bffce2 commit 85c6a38
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions test/coreneuron/test_nmodlrandom_syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 85c6a38

Please sign in to comment.