@@ -353,18 +353,15 @@ def test_terminate_on_hangingnode(testdir):
|
|||||||
result.stdout.fnmatch_lines(["*killed*my*", ])
|
result.stdout.fnmatch_lines(["*killed*my*", ])
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.xfail(reason='see #30')
|
|
||||||
def test_auto_detect_cpus(testdir, monkeypatch):
|
def test_auto_detect_cpus(testdir, monkeypatch):
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
monkeypatch.setattr(multiprocessing, 'cpu_count', lambda: 3)
|
count = multiprocessing.cpu_count()
|
||||||
testdir.makeconftest("""
|
testdir.makeconftest("""
|
||||||
def pytest_unconfigure(config):
|
def pytest_configure(config):
|
||||||
with open('cpus', 'w') as f:
|
print("numprocesses: (%s)" % config.getoption("numprocesses"))
|
||||||
f.write('cpus = %s' % config.option.numprocesses)
|
|
||||||
""")
|
""")
|
||||||
testdir.inline_run('-n=auto')
|
result = testdir.runpytest('-n=auto', '-s')
|
||||||
cpus_file = testdir.tmpdir.join('cpus')
|
result.stdout.fnmatch_lines(["*numprocesses: (%s)*" % count])
|
||||||
assert cpus_file.read() == 'cpus = 3'
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.xfail(reason="works if run outside test suite", run=False)
|
@pytest.mark.xfail(reason="works if run outside test suite", run=False)
|
||||||
|
|||||||
Reference in New Issue
Block a user