Context that verifies signal is called before exiting.
(signal, **expected)
| 106 | |
| 107 | @contextmanager |
| 108 | def assert_signal_called(signal, **expected): |
| 109 | """Context that verifies signal is called before exiting.""" |
| 110 | handler = Mock() |
| 111 | |
| 112 | def on_call(**kwargs): |
| 113 | return handler(**kwargs) |
| 114 | |
| 115 | signal.connect(on_call) |
| 116 | try: |
| 117 | yield handler |
| 118 | finally: |
| 119 | signal.disconnect(on_call) |
| 120 | handler.assert_called_with(signal=signal, **expected) |
| 121 | |
| 122 | |
| 123 | @pytest.fixture |
nothing calls this directly
no test coverage detected