def _(lock_mock, thread_mock, popen_mock): job = utils.AsyncJob("command", stdin=None) assert lock_mock.called assert thread_mock.called assert not hasattr(job, "stdin_thread") assert not hasattr(job, "stdin_lock") assert job.string_stdin is None
def _(lock_mock, thread_mock, popen_mock): job = utils.AsyncJob("echo", stdin="foobar") assert lock_mock.called assert job.stdin_thread.kwargs['name'] == 'echo-stdin' assert job.stdin_thread.kwargs['args'][0] == 'foobar' assert hasattr(job, "stdin_thread") assert hasattr(job, "stdin_lock") assert job.string_stdin is None
def _(lock_mock, thread_mock, popen_mock): job = utils.AsyncJob("echo", stdin=MagicMock(spec=file)) assert lock_mock.called assert job.stdout_thread.kwargs['name'] == 'echo-stdout' assert job.stderr_thread.kwargs['name'] == 'echo-stderr' assert hasattr(job, "stdout_thread") assert hasattr(job, "stdout_lock") assert hasattr(job, "stderr_thread") assert hasattr(job, "stderr_lock") assert job.string_stdin is None