def test_win32(self): old = os.environ.get("NUMBER_OF_PROCESSORS", None) try: os.environ["NUMBER_OF_PROCESSORS"] = "2" self.assertEqual(cpu_count(), 2) finally: if old is not None: os.environ["NUMBER_OF_PROCESSORS"] = old
def test_bsd(self): self.assertEqual(cpu_count(), 3)
def test_native(self): self.assertTrue(cpu_count() > 0)