def test_close_stops_flush_thread(self): interface.state.flush_thread = interface._FlushThread(10) interface.state.flush_thread.start() self.assertTrue(interface.state.flush_thread.is_alive()) interface.close() self.assertFalse(interface.state.flush_thread.is_alive())
def tearDown(self): # It's important to call close() before un-setting the mock state object, # because any FlushThread started by the test is stored in that mock state # and needs to be stopped before running any other tests. interface.close() super(GlobalsTest, self).tearDown()