[svn r62981] allowing conftest to set default values for options
--HG-- branch : trunk
This commit is contained in:
@@ -252,6 +252,31 @@ class TestPyTest:
|
||||
])
|
||||
assert result.ret == 1
|
||||
|
||||
def test_dist_testing_conftest_specified(self, testdir):
|
||||
p1 = testdir.makepyfile("""
|
||||
import py
|
||||
def test_fail0():
|
||||
assert 0
|
||||
def test_fail1():
|
||||
raise ValueError()
|
||||
def test_ok():
|
||||
pass
|
||||
def test_skip():
|
||||
py.test.skip("hello")
|
||||
""",
|
||||
)
|
||||
testdir.makeconftest("""
|
||||
pytest_option_hosts='popen,popen,popen'
|
||||
""")
|
||||
result = testdir.runpytest(p1, '-d')
|
||||
result.stdout.fnmatch_lines([
|
||||
"HOSTUP: popen*Python*",
|
||||
#"HOSTUP: localhost*Python*",
|
||||
#"HOSTUP: localhost*Python*",
|
||||
"*2 failed, 1 passed, 1 skipped*",
|
||||
])
|
||||
assert result.ret == 1
|
||||
|
||||
def test_dist_tests_with_crash(self, testdir):
|
||||
if not hasattr(py.std.os, 'kill'):
|
||||
py.test.skip("no os.kill")
|
||||
|
||||
@@ -40,6 +40,12 @@ class TestConfigCmdlineParsing:
|
||||
group.addoption("--option4", action="store", type="int")
|
||||
assert group.options[3].default == ("NO", "DEFAULT")
|
||||
|
||||
def test_parser_addoption_default_conftest(self, testdir, monkeypatch):
|
||||
import os
|
||||
testdir.makeconftest("pytest_option_verbose=True")
|
||||
config = testdir.parseconfig()
|
||||
assert config.option.verbose
|
||||
|
||||
def test_config_cmdline_options_only_lowercase(self, testdir):
|
||||
testdir.makepyfile(conftest="""
|
||||
import py
|
||||
|
||||
Reference in New Issue
Block a user