コード例 #1
0
ファイル: test_config.py プロジェクト: kura/blackhole
 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
ファイル: test_config.py プロジェクト: kura/blackhole
 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()