def __init__(self, config, ctx, emit=None): super(TimedProbe, self).__init__(config, ctx, emit) if 'interval' not in self.pluginmgr_config: raise ValueError('interval not set in config') self.interval = parse_interval(self.pluginmgr_config['interval']) self.run_level = 0
def __init__(self, config, ctx, emit=None): super().__init__(config, ctx, emit) if "interval" not in self.pluginmgr_config: raise ValueError("interval not set in config") self.interval = parse_interval(self.pluginmgr_config["interval"]) self.run_level = 0
def __init__(self, config, ctx, emit=None): if 'interval' not in config: raise ValueError('interval not set in config') self.interval = parse_interval(config['interval']) # TODO move to fping self.count = int(config.get('count', 0)) self.run_level = 0 super(TimedProbe, self).__init__(config, ctx, emit)
def test_parse_interval(): assert 1 == parse_interval('1s') assert .5 == parse_interval('500ms') assert 300 == parse_interval('5m') assert 3600 == parse_interval('1h') assert 86400 == parse_interval('1d') with pytest.raises(ValueError): parse_interval('1x')
def test_parse_interval(): assert 1 == parse_interval("1s") assert 0.5 == parse_interval("500ms") assert 300 == parse_interval("5m") assert 3600 == parse_interval("1h") assert 86400 == parse_interval("1d") assert 90 == parse_interval("1m30s") assert 90.5 == parse_interval("1m30.5s") assert 3661 == parse_interval("1h1m1s") assert 86401 == parse_interval("1d1s") assert 1800 == parse_interval("0.5h") with pytest.raises(ValueError): parse_interval("1x")
def test_parse_interval(): assert 1 == parse_interval('1s') assert .5 == parse_interval('500ms') assert 300 == parse_interval('5m') assert 3600 == parse_interval('1h') assert 86400 == parse_interval('1d') assert 90 == parse_interval("1m30s") assert 90.5 == parse_interval("1m30.5s") assert 3661 == parse_interval("1h1m1s") assert 86401 == parse_interval("1d1s") assert 1800 == parse_interval("0.5h") with pytest.raises(ValueError): parse_interval('1x')