@@ 205-214 (lines=10) @@ | ||
202 | ||
203 | ||
204 | def test_unobserved_run_doesnt_emit(run): |
|
205 | observer = run.observers[0] |
|
206 | run.unobserved = True |
|
207 | run() |
|
208 | assert not observer.started_event.called |
|
209 | assert not observer.heartbeat_event.called |
|
210 | assert not observer.completed_event.called |
|
211 | assert not observer.interrupted_event.called |
|
212 | assert not observer.failed_event.called |
|
213 | ||
214 | ||
215 | def test_stdout_capturing_no(run, capsys): |
|
216 | def print_mock_progress(): |
|
217 | for i in range(10): |
|
@@ 193-202 (lines=10) @@ | ||
190 | ||
191 | ||
192 | def test_run_exception_in_failed_event_is_caught(run): |
|
193 | observer = run.observers[0] |
|
194 | observer2 = mock.Mock(priority=20) |
|
195 | run.observers.append(observer2) |
|
196 | observer.failed_event.side_effect = TypeError |
|
197 | run.main_function.side_effect = AttributeError |
|
198 | with pytest.raises(AttributeError): |
|
199 | run() |
|
200 | assert observer.failed_event.called |
|
201 | assert observer2.failed_event.called |
|
202 | ||
203 | ||
204 | def test_unobserved_run_doesnt_emit(run): |
|
205 | observer = run.observers[0] |