예제 #1
0
 def test_tasker_commands(self):
     import datetime
     reusables.add_stream_handler("reusables")
     tasker = ExampleAddTasker(max_tasks=4, run_until=datetime.datetime.now() + datetime.timedelta(minutes=1))
     tasker.command_queue.put("change task size 1")
     tasker.command_queue.put("pause")
     tasker.command_queue.put("unpause")
     tasker.command_queue.put("stop")
     tasker.put(5)
     tasker.main_loop()
     r = tasker.get_state()
     assert r['stopped'], r
     assert tasker.max_tasks == 1, tasker.max_tasks
예제 #2
0
 def test_add_simple_handlers(self):
     logger = reusables.get_logger("test1")
     reusables.remove_all_handlers("test1")
     reusables.add_stream_handler("test1")
     assert isinstance(logger.handlers[0], logging.StreamHandler)
     reusables.remove_all_handlers("test1")