Merge pull request #646 from kroeschl/numprocesses-logical
Add explicit 'logical' choice to --numprocesses flag
This commit is contained in:
@@ -69,6 +69,12 @@ def test_auto_detect_cpus(testdir, monkeypatch):
|
||||
assert config.getoption("numprocesses") == 0
|
||||
assert config.getoption("dist") == "no"
|
||||
|
||||
config = testdir.parseconfigure("-nlogical", "--pdb")
|
||||
check_options(config)
|
||||
assert config.getoption("usepdb")
|
||||
assert config.getoption("numprocesses") == 0
|
||||
assert config.getoption("dist") == "no"
|
||||
|
||||
monkeypatch.delattr(os, "sched_getaffinity", raising=False)
|
||||
monkeypatch.setenv("TRAVIS", "true")
|
||||
config = testdir.parseconfigure("-nauto")
|
||||
@@ -81,12 +87,16 @@ def test_auto_detect_cpus_psutil(testdir, monkeypatch):
|
||||
|
||||
psutil = pytest.importorskip("psutil")
|
||||
|
||||
monkeypatch.setattr(psutil, "cpu_count", lambda logical=True: 42)
|
||||
monkeypatch.setattr(psutil, "cpu_count", lambda logical=True: 84 if logical else 42)
|
||||
|
||||
config = testdir.parseconfigure("-nauto")
|
||||
check_options(config)
|
||||
assert config.getoption("numprocesses") == 42
|
||||
|
||||
config = testdir.parseconfigure("-nlogical")
|
||||
check_options(config)
|
||||
assert config.getoption("numprocesses") == 84
|
||||
|
||||
|
||||
def test_hook_auto_num_workers(testdir, monkeypatch):
|
||||
from xdist.plugin import pytest_cmdline_main as check_options
|
||||
@@ -101,6 +111,10 @@ def test_hook_auto_num_workers(testdir, monkeypatch):
|
||||
check_options(config)
|
||||
assert config.getoption("numprocesses") == 42
|
||||
|
||||
config = testdir.parseconfigure("-nlogical")
|
||||
check_options(config)
|
||||
assert config.getoption("numprocesses") == 42
|
||||
|
||||
|
||||
def test_boxed_with_collect_only(testdir):
|
||||
from xdist.plugin import pytest_cmdline_main as check_options
|
||||
|
||||
Reference in New Issue
Block a user