Пример #1
0
 def test_ok(self):
     cfile = create_config(("workers=4",))
     conf = Config(cfile).load()
     with mock.patch("multiprocessing.cpu_count", return_value=4):
         conf.test_workers()
     assert conf.workers is 4
Пример #2
0
 def test_ok(self):
     cfile = create_config(("workers=4", ))
     conf = Config(cfile).load()
     with mock.patch("multiprocessing.cpu_count", return_value=4):
         conf.test_workers()
     assert conf.workers is 4
Пример #3
0
 def test_more_than_cpus(self):
     conf = Config(None).load()
     with mock.patch(
         "multiprocessing.cpu_count", return_value=0
     ), pytest.raises(ConfigException):
         conf.test_workers()
Пример #4
0
 def test_more_than_cpus(self):
     conf = Config(None).load()
     with mock.patch("multiprocessing.cpu_count",
                     return_value=0), pytest.raises(ConfigException):
         conf.test_workers()