test_ok2/testing/freeze/create_executable.py

12 lines
427 B
Python
Raw Normal View History

"""Generate an executable with pytest runner embedded using PyInstaller."""
2018-05-23 22:48:46 +08:00
if __name__ == "__main__":
import pytest
import subprocess
hidden = []
for x in pytest.freeze_includes():
2018-05-23 22:48:46 +08:00
hidden.extend(["--hidden-import", x])
hidden.extend(["--hidden-import", "distutils"])
2018-05-23 22:48:46 +08:00
args = ["pyinstaller", "--noconfirm"] + hidden + ["runtests_script.py"]
subprocess.check_call(" ".join(args), shell=True)