class TestThreadsMonitor(unittest.TestCase): """ Tests for `ThreadsMonitor`. """ def setUp(self): self._logger = MagicMock() self._monitor = ThreadsMonitor(self._logger, timedelta(microseconds=1)) def test_do_log_record(self): self._monitor.do_log_record() self.assertEqual(self._logger.record.call_count, 1) call_args = self._logger.record.call_args[0] self.assertEqual(call_args[0], MEASURED_NUMBER_OF_THREADS) self.assertGreaterEqual(call_args[1], 1)
def setUp(self): self._logger = MagicMock() self._monitor = ThreadsMonitor(self._logger, timedelta(microseconds=1))