Raise :exc:`RuntimeError` if the installed :mod:`~twisted.internet.reactor` does not match the specified import path or if no reactor is installed.
(reactor_path: str)
| 165 | |
| 166 | |
| 167 | def verify_installed_reactor(reactor_path: str) -> None: |
| 168 | """Raise :exc:`RuntimeError` if the installed |
| 169 | :mod:`~twisted.internet.reactor` does not match the specified import |
| 170 | path or if no reactor is installed.""" |
| 171 | if not is_reactor_installed(): |
| 172 | raise RuntimeError( |
| 173 | "verify_installed_reactor() called without an installed reactor." |
| 174 | ) |
| 175 | |
| 176 | from twisted.internet import reactor |
| 177 | |
| 178 | expected_reactor_type = load_object(reactor_path) |
| 179 | reactor_type = type(reactor) |
| 180 | if not reactor_type == expected_reactor_type: |
| 181 | raise RuntimeError( |
| 182 | f"The installed reactor ({global_object_name(reactor_type)}) " |
| 183 | f"does not match the requested one ({reactor_path})" |
| 184 | ) |
| 185 | |
| 186 | |
| 187 | def verify_installed_asyncio_event_loop(loop_path: str) -> None: |
no test coverage detected