Remove file after test completion

This commit is contained in:
Andrew Murray 2025-07-16 13:40:22 +10:00
parent 91bbeb5dcb
commit a426eb55af

View File

@ -276,6 +276,7 @@ class TestEmbeddable:
except Exception: except Exception:
pytest.skip("Compiler could not be initialized") pytest.skip("Compiler could not be initialized")
try:
with open("embed_pil.c", "w", encoding="utf-8") as fh: with open("embed_pil.c", "w", encoding="utf-8") as fh:
home = sys.prefix.replace("\\", "\\\\") home = sys.prefix.replace("\\", "\\\\")
fh.write( fh.write(
@ -315,3 +316,5 @@ int main(int argc, char* argv[])
process = subprocess.Popen(["embed_pil.exe"], env=env) process = subprocess.Popen(["embed_pil.exe"], env=env)
process.communicate() process.communicate()
assert process.returncode == 0 assert process.returncode == 0
finally:
os.remove("embed_pil.c")