mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-15 09:44:46 +03:00
Remove file after test completion
This commit is contained in:
parent
91bbeb5dcb
commit
a426eb55af
|
@ -276,10 +276,11 @@ class TestEmbeddable:
|
||||||
except Exception:
|
except Exception:
|
||||||
pytest.skip("Compiler could not be initialized")
|
pytest.skip("Compiler could not be initialized")
|
||||||
|
|
||||||
with open("embed_pil.c", "w", encoding="utf-8") as fh:
|
try:
|
||||||
home = sys.prefix.replace("\\", "\\\\")
|
with open("embed_pil.c", "w", encoding="utf-8") as fh:
|
||||||
fh.write(
|
home = sys.prefix.replace("\\", "\\\\")
|
||||||
f"""
|
fh.write(
|
||||||
|
f"""
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
|
@ -301,17 +302,19 @@ int main(int argc, char* argv[])
|
||||||
return 0;
|
return 0;
|
||||||
}}
|
}}
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
objects = compiler.compile(["embed_pil.c"])
|
objects = compiler.compile(["embed_pil.c"])
|
||||||
compiler.link_executable(objects, "embed_pil")
|
compiler.link_executable(objects, "embed_pil")
|
||||||
|
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
env["PATH"] = sys.prefix + ";" + env["PATH"]
|
env["PATH"] = sys.prefix + ";" + env["PATH"]
|
||||||
|
|
||||||
# Do not display the Windows Error Reporting dialog
|
# Do not display the Windows Error Reporting dialog
|
||||||
getattr(ctypes, "windll").kernel32.SetErrorMode(0x0002)
|
getattr(ctypes, "windll").kernel32.SetErrorMode(0x0002)
|
||||||
|
|
||||||
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")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user