def spawn_busy_loop(app): import os import atexit import signal import ctypes import subprocess import eskytester proc = subprocess.Popen([eskytester.script_path(app,"script1"),"busyloop"]) assert proc.poll() is None @atexit.register def cleanup(): if hasattr(proc,"terminate"): proc.terminate() else: if sys.platform == "win32": ctypes.windll.kernel32.TerminateProcess(int(proc._handle),-1) else: os.kill(proc.pid,signal.SIGTERM) proc.wait()
def spawn_busy_loop(app): import os import atexit import signal import ctypes import subprocess import eskytester proc = subprocess.Popen( [eskytester.script_path(app, "script1"), "busyloop"]) assert proc.poll() is None @atexit.register def cleanup(): assert proc.poll() is None if hasattr(proc, "terminate"): proc.terminate() else: if sys.platform == "win32": ctypes.windll.kernel32.TerminateProcess( int(proc._handle), -1) else: os.kill(proc.pid, signal.SIGTERM) proc.wait()
ESKY_CONTROL_DIR = esky.util.ESKY_CONTROL_DIR # Test that the frozen app is actually working import eskytester eskytester.yes_i_am_working() eskytester.yes_my_deps_are_working() eskytester.yes_my_data_is_installed() assert sys.frozen assert __name__ == "__main__" app = esky.tests.TestableEsky(sys.executable,"http://localhost:8000/dist/") assert app.name == "eskytester" assert app.active_version == "0.1" assert app.version == "0.1" assert app.find_update() == "0.3" assert os.path.isfile(eskytester.script_path(app,"script1")) # Test that the script is executed with sensible globals etc, so # it can create classes and other "complicated" things class ATestClass(object): def __init__(self): self.a = "A" class BTestClass(ATestClass): def __init__(self): super(BTestClass,self).__init__() self.a = "B" assert BTestClass().a == "B" # Spawn another instance that just busy-loops, # holding a lock on the current version.
# Test that the frozen app is actually working import eskytester eskytester.yes_i_am_working() eskytester.yes_my_deps_are_working() eskytester.yes_my_data_is_installed() assert sys.frozen assert __name__ == "__main__" app = esky.tests.TestableEsky(sys.executable, "http://localhost:8000/dist/") assert app.name == "eskytester" assert app.active_version == "0.1" assert app.version == "0.1" assert app.find_update() == "0.3" assert os.path.isfile(eskytester.script_path(app, "script1")) # Test that the script is executed with sensible globals etc, so # it can create classes and other "complicated" things class ATestClass(object): def __init__(self): self.a = "A" class BTestClass(ATestClass): def __init__(self): super(BTestClass, self).__init__() self.a = "B"