use config.getoption instead of deprecated config.getvalue

and adapt a few tests to also run against pytest-2.6.0.dev
This commit is contained in:
holger krekel
2014-05-14 08:13:56 +02:00
parent eb639d19ec
commit de377c1001
3 changed files with 7 additions and 7 deletions

View File

@@ -311,9 +311,9 @@ class TestTerminalReporting:
""") """)
result = testdir.runpytest("-n1", "-v") result = testdir.runpytest("-n1", "-v")
result.stdout.fnmatch_lines_random([ result.stdout.fnmatch_lines_random([
"*PASS*test_pass_skip_fail.py:2: *test_ok*", "*PASS*test_pass_skip_fail.py?2*test_ok*",
"*SKIP*test_pass_skip_fail.py:4: *test_skip*", "*SKIP*test_pass_skip_fail.py?4*test_skip*",
"*FAIL*test_pass_skip_fail.py:6: *test_func*", "*FAIL*test_pass_skip_fail.py?6*test_func*",
]) ])
result.stdout.fnmatch_lines([ result.stdout.fnmatch_lines([
"*def test_func():", "*def test_func():",
@@ -328,7 +328,7 @@ class TestTerminalReporting:
""") """)
result = testdir.runpytest("-n1", "-v") result = testdir.runpytest("-n1", "-v")
result.stdout.fnmatch_lines([ result.stdout.fnmatch_lines([
"*FAIL*test_fail_platinfo.py:1: *test_func*", "*FAIL*test_fail_platinfo.py*1*test_func*",
"*0*Python*", "*0*Python*",
"*def test_func():", "*def test_func():",
"> assert 0", "> assert 0",

View File

@@ -7,7 +7,7 @@ pytest_plugins = "pytester"
def pytest_addoption(parser): def pytest_addoption(parser):
parser.addoption('--gx', parser.addoption('--gx',
action="append", dest="gspecs", default=None, action="append", dest="gspecs",
help=("add a global test environment, XSpec-syntax. ")) help=("add a global test environment, XSpec-syntax. "))
def pytest_funcarg__specssh(request): def pytest_funcarg__specssh(request):

View File

@@ -53,14 +53,14 @@ def pytest_addhooks(pluginmanager):
def pytest_cmdline_main(config): def pytest_cmdline_main(config):
check_options(config) check_options(config)
if config.getvalue("looponfail"): if config.getoption("looponfail"):
from xdist.looponfail import looponfail_main from xdist.looponfail import looponfail_main
looponfail_main(config) looponfail_main(config)
return 2 # looponfail only can get stop with ctrl-C anyway return 2 # looponfail only can get stop with ctrl-C anyway
def pytest_configure(config, __multicall__): def pytest_configure(config, __multicall__):
__multicall__.execute() __multicall__.execute()
if config.getvalue("dist") != "no": if config.getoption("dist") != "no":
from xdist.dsession import DSession from xdist.dsession import DSession
session = DSession(config) session = DSession(config)
config.pluginmanager.register(session, "dsession") config.pluginmanager.register(session, "dsession")