def test_MonitorConfigInterval(self): with self.assertRaises(configparser.NoOptionError): testargs = ["monitor.py", "-f", "tests/monitor-nointerval.ini"] with patch.object(sys, "argv", testargs): monitor.main() with self.assertRaises(ValueError): testargs = ["monitor.py", "-f", "tests/monitor-badinterval.ini"] with patch.object(sys, "argv", testargs): monitor.main()
def test_MonitorConfigInterval(self): with self.assertRaises(SystemExit): testargs = [ "monitor.py", "-f", "tests/mocks/ini/monitor-nointerval.ini" ] with patch.object(sys, "argv", testargs): monitor.main() with self.assertRaises(SystemExit): testargs = [ "monitor.py", "-f", "tests/mocks/ini/monitor-badinterval.ini" ] with patch.object(sys, "argv", testargs): monitor.main()
def run_monitor() -> None: sys.argv = ["monitor.py", "-vH", "--config={}".format(CONFIG)] monitor.main()
from simplemonitor import monitor monitor.main()