def __init__(self, config, instances): self._loopduration = parse_time(config.get(LOOP_DURATION)) self._looprepeats = config.get(LOOP_REPEATS) if self._loopduration and self._looprepeats: raise MutuallyExclusiveConfigOptions( 'schedule.duration and schedule.repeats cannot be combined') self._messagebus = None self._run_queue_empty_dispatcher = None self._test_run_started_dispatcher = None self._run_queue_initialized_dispatcher = None self._original_run_queue = None self._cycle_run_queue = None self._start_time = None
def testparse_time_throws_exception_if_invalid_input(self): too_many_numbers = '4:3:2:1' invalid_seperator = '5;2' not_a_number = 'test' with self.assertRaises(ConfigException): parse_time(too_many_numbers) with self.assertRaises(ConfigException): parse_time(invalid_seperator) with self.assertRaises(ConfigException): parse_time(not_a_number)
def testparse_time_parses_time(self): only_seconds = '522' only_minutes = '15:0' only_hours = '1:0:0' seconds_and_minutes = '3:15' hours_and_minutes = '1:2:0' all_three = '3:2:1' more_than_60_seconds = '3:80' more_than_60_minutes = '100:0' self.assertEqual(parse_time(only_seconds), 522) self.assertEqual(parse_time(only_minutes), 900) self.assertEqual(parse_time(only_hours), 3600) self.assertEqual(parse_time(seconds_and_minutes), 195) self.assertEqual(parse_time(hours_and_minutes), 3720) self.assertEqual(parse_time(all_three), 10921) self.assertEqual(parse_time(more_than_60_seconds), 260) self.assertEqual(parse_time(more_than_60_minutes), 6000)
def __init__(self, config, instances): self._timeout = parse_time(config.get(COMMAND_TIMEOUT)) self._hard_exit_timeout = config.get(COMMAND_TIMEOUT_EXIT_DELAY) self._command_complete_event = threading.Event()
def testparse_time_falsy_time_string_returns_none(self): self.assertIsNone(parse_time(''), None) self.assertIsNone(parse_time(None), None)