Unit test "auto" cpu detection

Use that instead of an acceptance test: on travis it would result in over 16 slaves being spawned,
which caused weird crashes on multiprocessing module during teardown

Fix #30
This commit is contained in:
Bruno Oliveira
2015-12-14 22:51:41 -02:00
parent 7dedb272ad
commit 0127cac3f9
2 changed files with 11 additions and 11 deletions

View File

@@ -25,6 +25,17 @@ def test_dist_options(testdir):
assert config.option.dist == "load"
def test_auto_detect_cpus(testdir, monkeypatch):
import multiprocessing
monkeypatch.setattr(multiprocessing, 'cpu_count', lambda: 99)
config = testdir.parseconfigure("-n2")
assert config.getoption('numprocesses') == 2
config = testdir.parseconfigure("-nauto")
assert config.getoption('numprocesses') == 99
class TestDistOptions:
def test_getxspecs(self, testdir):
config = testdir.parseconfigure("--tx=popen", "--tx", "ssh=xyz")