def test_tab_loop(self): tab = Tab('one_sec', verbose=False).every(seconds=1).run(time_logger, 'one_sec') with PrintCatcher() as catcher: tab._loop(max_iter=3) self.assertEqual(catcher.text.count('one_sec'), 3)
def test_tab_loop_anchored(self): now = datetime.datetime.now() + datetime.timedelta(seconds=1) tab = Tab('one_sec', verbose=False).every(seconds=1).starting(now).run( time_logger, 'one_sec') with PrintCatcher() as catcher: tab._loop(max_iter=3) self.assertEqual(catcher.text.count('one_sec'), 3)
def test_robust_error(self): tab = Tab('one_sec', verbose=False).every(seconds=1).run(error_raisor, 'one_sec') tab._loop(max_iter=1)
def test_non_robust_error(self): tab = Tab('one_sec', verbose=False, robust=False).every(seconds=1).run(error_raisor, 'one_sec') with self.assertRaises(ExpectedException): tab._loop(max_iter=1)