20 | 20 |
|
21 | 21 |
with pytest.raises(RuntimeError):
|
22 | 22 |
with pytest.warns(DeprecationWarning, match="timeout"):
|
23 | |
procrunner.run(task, -1, False)
|
|
23 |
procrunner.run(task, timeout=-1, debug=False)
|
24 | 24 |
|
25 | 25 |
assert mock_subprocess.Popen.called
|
26 | 26 |
assert mock_process.terminate.called
|
|
41 | 41 |
task = ["___"]
|
42 | 42 |
|
43 | 43 |
with pytest.raises(RuntimeError):
|
44 | |
procrunner.run(task, -1, False, raise_timeout_exception=True)
|
|
44 |
procrunner.run(task, timeout=-1, debug=False, raise_timeout_exception=True)
|
45 | 45 |
|
46 | 46 |
assert mock_subprocess.Popen.called
|
47 | 47 |
assert mock_process.terminate.called
|
|
82 | 82 |
|
83 | 83 |
actual = procrunner.run(
|
84 | 84 |
command,
|
85 | |
0.5,
|
86 | |
False,
|
|
85 |
timeout=0.5,
|
|
86 |
debug=False,
|
87 | 87 |
callback_stdout=mock.sentinel.callback_stdout,
|
88 | 88 |
callback_stderr=mock.sentinel.callback_stderr,
|
89 | 89 |
working_directory=mock.sentinel.cwd,
|
|
127 | 127 |
def test_default_process_environment_is_parent_environment(mock_subprocess):
|
128 | 128 |
mock_subprocess.Popen.side_effect = NotImplementedError() # cut calls short
|
129 | 129 |
with pytest.raises(NotImplementedError):
|
130 | |
procrunner.run([mock.Mock()], -1, False, raise_timeout_exception=True)
|
|
130 |
procrunner.run(
|
|
131 |
[mock.Mock()], timeout=-1, debug=False, raise_timeout_exception=True
|
|
132 |
)
|
131 | 133 |
assert mock_subprocess.Popen.call_args[1]["env"] == os.environ
|
132 | 134 |
|
133 | 135 |
|
|
139 | 141 |
with pytest.raises(NotImplementedError):
|
140 | 142 |
procrunner.run(
|
141 | 143 |
[mock.Mock()],
|
142 | |
-1,
|
143 | |
False,
|
|
144 |
timeout=-1,
|
|
145 |
debug=False,
|
144 | 146 |
environment=copy.copy(mock_env),
|
145 | 147 |
raise_timeout_exception=True,
|
146 | 148 |
)
|
|
156 | 158 |
with pytest.raises(NotImplementedError):
|
157 | 159 |
procrunner.run(
|
158 | 160 |
[mock.Mock()],
|
159 | |
-1,
|
160 | |
False,
|
|
161 |
timeout=-1,
|
|
162 |
debug=False,
|
161 | 163 |
environment=copy.copy(mock_env1),
|
162 | 164 |
environment_override=copy.copy(mock_env2),
|
163 | 165 |
raise_timeout_exception=True,
|
|
174 | 176 |
with pytest.raises(NotImplementedError):
|
175 | 177 |
procrunner.run(
|
176 | 178 |
[mock.Mock()],
|
177 | |
-1,
|
178 | |
False,
|
|
179 |
timeout=-1,
|
|
180 |
debug=False,
|
179 | 181 |
environment_override=copy.copy(mock_env2),
|
180 | 182 |
raise_timeout_exception=True,
|
181 | 183 |
)
|
|
203 | 205 |
with pytest.raises(NotImplementedError):
|
204 | 206 |
procrunner.run(
|
205 | 207 |
[mock.Mock()],
|
206 | |
-1,
|
207 | |
False,
|
|
208 |
timeout=-1,
|
|
209 |
debug=False,
|
208 | 210 |
environment_override={
|
209 | 211 |
random_environment_variable: "X" + random_environment_value
|
210 | 212 |
},
|