def _do_test(pcount): pcount.side_effect = NotImplementedError("cpu_count") from celery.apps.worker import cpu_count self.assertEqual(cpu_count(), 2) pcount.assert_called_with()
def test_cpu_count_no_mp(self): with mask_modules("multiprocessing"): with reset_modules("celery.apps.worker"): from celery.apps.worker import cpu_count self.assertEqual(cpu_count(), 2)