def setup_events_processes(cls, events_device: bool, events_main_device: bool, registry_patcher: bool): """Setup own copy of Events Device machinery.""" cls.temp_dir = tempfile.mkdtemp() cls.events_processes_registry = EventsProcessesRegistry( log_dir=cls.temp_dir) if registry_patcher: cls.events_processes_registry_patcher = \ unittest.mock.patch("sdcm.sct_events.base.SctEvent._events_processes_registry", cls.events_processes_registry) cls.events_processes_registry_patcher.start() if events_device: start_events_device(_registry=cls.events_processes_registry) elif events_main_device: start_events_main_device(_registry=cls.events_processes_registry) time.sleep(EVENTS_DEVICE_START_DELAY) cls.events_main_device = get_events_main_device( _registry=cls.events_processes_registry)
def setUpClass(cls): cls.temp_dir = tempfile.mkdtemp() start_events_device(cls.temp_dir) time.sleep(10)
def events(): temp_dir = tempfile.mkdtemp() start_events_device(temp_dir) yield EventsLogUtils(temp_dir=temp_dir) stop_events_device()