test_interactive.py (963B)
1 #!/usr/bin/env python 2 3 from time import sleep 4 5 import mozunit 6 7 8 def test_run_interactive(runner, create_thread): 9 """Bug 965183: Run process in interactive mode and call wait()""" 10 runner.start(interactive=True) 11 12 thread = create_thread(runner, timeout=2) 13 thread.start() 14 15 # This is a blocking call. So the process should be killed by the thread 16 runner.wait() 17 thread.join() 18 assert not runner.is_running() 19 20 21 def test_stop_interactive(runner): 22 """Bug 965183: Explicitely stop process in interactive mode""" 23 runner.start(interactive=True) 24 runner.stop() 25 26 27 def test_wait_after_process_finished(runner): 28 """Wait after the process has been stopped should not raise an error""" 29 runner.start(interactive=True) 30 sleep(1) 31 runner.process_handler.kill() 32 33 returncode = runner.wait(1) 34 35 assert returncode not in [None, 0] 36 assert runner.process_handler is not None 37 38 39 if __name__ == "__main__": 40 mozunit.main()