Merge pull request #232 from verdesmarald/master
Don't create DSession in collect-only mode
This commit is contained in:
@@ -262,6 +262,17 @@ class TestDistribution:
|
||||
child.close()
|
||||
# assert ret == 2
|
||||
|
||||
def test_dist_with_collectonly(self, testdir):
|
||||
p1 = testdir.makepyfile("""
|
||||
def test_ok():
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest(p1, "-n1", "--collect-only")
|
||||
assert result.ret == 0
|
||||
result.stdout.fnmatch_lines([
|
||||
"*collected 1 item*",
|
||||
])
|
||||
|
||||
|
||||
class TestDistEach:
|
||||
def test_simple(self, testdir):
|
||||
|
||||
@@ -44,6 +44,36 @@ def test_auto_detect_cpus(testdir, monkeypatch):
|
||||
assert config.getoption('numprocesses') == 99
|
||||
|
||||
|
||||
def test_boxed_with_collect_only(testdir):
|
||||
from xdist.plugin import pytest_cmdline_main as check_options
|
||||
config = testdir.parseconfigure("-n1", "--boxed")
|
||||
check_options(config)
|
||||
assert config.option.forked
|
||||
|
||||
config = testdir.parseconfigure("-n1", "--collect-only")
|
||||
check_options(config)
|
||||
assert not config.option.forked
|
||||
|
||||
config = testdir.parseconfigure("-n1", "--boxed", "--collect-only")
|
||||
check_options(config)
|
||||
assert config.option.forked
|
||||
|
||||
|
||||
def test_dsession_with_collect_only(testdir):
|
||||
from xdist.plugin import pytest_cmdline_main as check_options
|
||||
from xdist.plugin import pytest_configure as configure
|
||||
|
||||
config = testdir.parseconfigure("-n1")
|
||||
check_options(config)
|
||||
configure(config)
|
||||
assert config.pluginmanager.hasplugin("dsession")
|
||||
|
||||
config = testdir.parseconfigure("-n1", "--collect-only")
|
||||
check_options(config)
|
||||
configure(config)
|
||||
assert not config.pluginmanager.hasplugin("dsession")
|
||||
|
||||
|
||||
class TestDistOptions:
|
||||
def test_getxspecs(self, testdir):
|
||||
config = testdir.parseconfigure("--tx=popen", "--tx", "ssh=xyz")
|
||||
|
||||
Reference in New Issue
Block a user