def test_if_file_created(): """Check whether the process really created the given file.""" assert os.path.isfile(filename) is False executor = PidExecutor(process, filename) executor.start() assert os.path.isfile(filename) is True executor.stop()
def test_start_and_wait(timeout): """Test if the executor will await for the process to create a file.""" process = 'bash -c "sleep 2 && touch {0} && sleep 10"'.format(filename) executor = PidExecutor(process, filename, timeout=timeout) executor.start() assert executor.running() is True executor.stop()