def setUp(self): self.context = open_dependency_context(supply_fs=True, supply_logging=True) self.context.inject(StreamHandler, EmptyFake()) EventBroker.reset() subscribe_event_handlers(self) self.skip_events = 0
def __init__(self): self._log = dependency(logger_for_module)(__name__) config = config_for_module(__name__) self.element_find_timeout = config.browser_element_find_timeout self.page_load_timeout = config.browser_page_load_timeout self._driver = dependency(launch_browser)() self._failure_detected = False subscribe_event_handlers(self)
def setUp(self): close_all_dependency_contexts() EventBroker.reset() subscribe_event_handlers(self) self.suite_name = "EarElephant" self.xml_report = None self.compiler = ResultCompiler() self.compiler.activate() self.sut = JunitReporter() self.sut.activate()
def test_ignores_method_not_starting_with_on(self): class Thing: def __init__(self): self.was_called = False def test_skipped(self, **kwargs): self.was_called = True thing = Thing() subscribe_event_handlers(thing) EventBroker.publish(event=TestEvent.test_skipped) assert not thing.was_called, "Handler was detected inapproprately"
def test_subscribes_recognized_handler_to_matching_event(self): class Thing: def __init__(self): self.was_called = False def on_test_skipped(self, **kwargs): self.was_called = True thing = Thing() subscribe_event_handlers(thing) EventBroker.publish(event=TestEvent.test_skipped) assert thing.was_called, "Subscriber was not called"
def setUp(self): self.context = open_dependency_context(supply_env=True, supply_fs=True, supply_logging=True) self.context.inject(StreamHandler, EmptyFake()) EventBroker.reset() subscribe_event_handlers(self) self.skip_events = 0 self.skip_msg = "intentional" self.suite_teardown_ran = False self.test_setup_ran = False self.test_teardown_ran = False
def __init__(self): subscribe_event_handlers(self) config = config_for_module(__name__) log = logger_for_module(__name__) self._proxies = {} if config.http_proxy: proxy = config.http_proxy self._proxies["http"] = proxy log.debug(f"Using HTTP proxy {proxy}") if config.https_proxy: proxy = config.https_proxy self._proxies["https"] = proxy log.debug(f"(Using HTTPS proxy {proxy}") self._exception_callbacks = {} self._logger = logger_for_module(__name__) self._session = None self._persistent_headers = {} self._transcript = Transcript() self._verify_certs = config.https_verify_certs log.debug(f"Socket timeout: {self._socket_timeout()}")
def attempt(): subscribe_event_handlers(Thing())
def activate(self): subscribe_event_handlers(self)
def setUp(self): self.context = open_dependency_context(supply_logging=True) EventBroker.reset() subscribe_event_handlers(self) disable_default_reporters()