Use teardown_method

This commit is contained in:
Andrew Murray 2025-07-24 07:27:39 +10:00
parent a39d14648b
commit f4d86e4f44

View File

@ -276,7 +276,6 @@ 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(
@ -316,5 +315,6 @@ 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:
def teardown_method(self) -> None:
os.remove("embed_pil.c") os.remove("embed_pil.c")