@@ 192-201 (lines=10) @@ | ||
189 | assert observer2.interrupted_event.called |
|
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): |
|
@@ 180-189 (lines=10) @@ | ||
177 | assert observer2.completed_event.called |
|
178 | ||
179 | ||
180 | def test_run_exception_in_interrupted_event_is_caught(run): |
|
181 | observer = run.observers[0] |
|
182 | observer2 = mock.Mock(priority=20) |
|
183 | run.observers.append(observer2) |
|
184 | observer.interrupted_event.side_effect = TypeError |
|
185 | run.main_function.side_effect = KeyboardInterrupt |
|
186 | with pytest.raises(KeyboardInterrupt): |
|
187 | run() |
|
188 | assert observer.interrupted_event.called |
|
189 | assert observer2.interrupted_event.called |
|
190 | ||
191 | ||
192 | def test_run_exception_in_failed_event_is_caught(run): |