def test_getting_api_before_start_raises_exception(): # pylint:disable=redefined-outer-name assert not Service.is_running() with pytest.raises(AgentNotAvailableException): Service.api()
def stop_if_running(): if Service.is_running(): with Service.api() as api: api.stop()