use runpytest() instead of runpytest_inprocess if a test can run as subprocess as well
--HG-- branch : testrefactor
This commit is contained in:
@@ -15,7 +15,7 @@ class TestModule:
|
||||
p.pyimport()
|
||||
del py.std.sys.modules['test_whatever']
|
||||
b.ensure("test_whatever.py")
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines([
|
||||
"*import*mismatch*",
|
||||
"*imported*test_whatever*",
|
||||
@@ -59,7 +59,7 @@ class TestClass:
|
||||
def __init__(self):
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("-rw")
|
||||
result = testdir.runpytest("-rw")
|
||||
result.stdout.fnmatch_lines_random("""
|
||||
WC1*test_class_with_init_warning.py*__init__*
|
||||
""")
|
||||
@@ -69,7 +69,7 @@ class TestClass:
|
||||
class test(object):
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines([
|
||||
"*collected 0*",
|
||||
])
|
||||
@@ -86,7 +86,7 @@ class TestClass:
|
||||
def teardown_class(cls):
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines([
|
||||
"*1 passed*",
|
||||
])
|
||||
@@ -534,7 +534,7 @@ class TestConftestCustomization:
|
||||
""")
|
||||
testdir.makepyfile("def test_some(): pass")
|
||||
testdir.makepyfile(test_xyz="def test_func(): pass")
|
||||
result = testdir.runpytest_inprocess("--collect-only")
|
||||
result = testdir.runpytest("--collect-only")
|
||||
result.stdout.fnmatch_lines([
|
||||
"*<Module*test_pytest*",
|
||||
"*<MyModule*xyz*",
|
||||
@@ -590,7 +590,7 @@ class TestConftestCustomization:
|
||||
return MyFunction(name, collector)
|
||||
""")
|
||||
testdir.makepyfile("def some(): pass")
|
||||
result = testdir.runpytest_inprocess("--collect-only")
|
||||
result = testdir.runpytest("--collect-only")
|
||||
result.stdout.fnmatch_lines([
|
||||
"*MyFunction*some*",
|
||||
])
|
||||
@@ -648,7 +648,7 @@ class TestTracebackCutting:
|
||||
raise ValueError("xyz")
|
||||
""")
|
||||
p = testdir.makepyfile("def test(hello): pass")
|
||||
result = testdir.runpytest_inprocess(p)
|
||||
result = testdir.runpytest(p)
|
||||
assert result.ret != 0
|
||||
out = result.stdout.str()
|
||||
assert out.find("xyz") != -1
|
||||
@@ -656,7 +656,7 @@ class TestTracebackCutting:
|
||||
numentries = out.count("_ _ _") # separator for traceback entries
|
||||
assert numentries == 0
|
||||
|
||||
result = testdir.runpytest_inprocess("--fulltrace", p)
|
||||
result = testdir.runpytest("--fulltrace", p)
|
||||
out = result.stdout.str()
|
||||
assert out.find("conftest.py:2: ValueError") != -1
|
||||
numentries = out.count("_ _ _ _") # separator for traceback entries
|
||||
@@ -669,7 +669,7 @@ class TestTracebackCutting:
|
||||
x = 17
|
||||
asd
|
||||
""")
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
assert result.ret != 0
|
||||
out = result.stdout.str()
|
||||
assert "x = 1" not in out
|
||||
@@ -678,7 +678,7 @@ class TestTracebackCutting:
|
||||
" *asd*",
|
||||
"E*NameError*",
|
||||
])
|
||||
result = testdir.runpytest_inprocess("--fulltrace")
|
||||
result = testdir.runpytest("--fulltrace")
|
||||
out = result.stdout.str()
|
||||
assert "x = 1" in out
|
||||
assert "x = 2" in out
|
||||
@@ -769,7 +769,7 @@ def test_customized_python_discovery(testdir):
|
||||
""")
|
||||
p2 = p.new(basename=p.basename.replace("test", "check"))
|
||||
p.move(p2)
|
||||
result = testdir.runpytest_inprocess("--collect-only", "-s")
|
||||
result = testdir.runpytest("--collect-only", "-s")
|
||||
result.stdout.fnmatch_lines([
|
||||
"*check_customized*",
|
||||
"*check_simple*",
|
||||
@@ -777,7 +777,7 @@ def test_customized_python_discovery(testdir):
|
||||
"*check_meth*",
|
||||
])
|
||||
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
assert result.ret == 0
|
||||
result.stdout.fnmatch_lines([
|
||||
"*2 passed*",
|
||||
@@ -793,12 +793,12 @@ def test_customized_python_discovery_functions(testdir):
|
||||
def _test_underscore():
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("--collect-only", "-s")
|
||||
result = testdir.runpytest("--collect-only", "-s")
|
||||
result.stdout.fnmatch_lines([
|
||||
"*_test_underscore*",
|
||||
])
|
||||
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
assert result.ret == 0
|
||||
result.stdout.fnmatch_lines([
|
||||
"*1 passed*",
|
||||
@@ -818,7 +818,7 @@ def test_collector_attributes(testdir):
|
||||
def test_hello():
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines([
|
||||
"*1 passed*",
|
||||
])
|
||||
@@ -842,7 +842,7 @@ def test_customize_through_attributes(testdir):
|
||||
def test_hello(self):
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("--collect-only")
|
||||
result = testdir.runpytest("--collect-only")
|
||||
result.stdout.fnmatch_lines([
|
||||
"*MyClass*",
|
||||
"*MyInstance*",
|
||||
@@ -862,6 +862,6 @@ def test_unorderable_types(testdir):
|
||||
return Test
|
||||
TestFoo = make_test()
|
||||
""")
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
assert "TypeError" not in result.stdout.str()
|
||||
assert result.ret == 0
|
||||
|
||||
@@ -33,7 +33,7 @@ class TestFillFixtures:
|
||||
def test_func(some):
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest_inprocess() # "--collect-only")
|
||||
result = testdir.runpytest() # "--collect-only")
|
||||
assert result.ret != 0
|
||||
result.stdout.fnmatch_lines([
|
||||
"*def test_func(some)*",
|
||||
@@ -78,7 +78,7 @@ class TestFillFixtures:
|
||||
def test_method(self, something):
|
||||
assert something is self
|
||||
""")
|
||||
result = testdir.runpytest_inprocess(p)
|
||||
result = testdir.runpytest(p)
|
||||
result.stdout.fnmatch_lines([
|
||||
"*1 passed*"
|
||||
])
|
||||
@@ -119,9 +119,9 @@ class TestFillFixtures:
|
||||
def test_spam(self, spam):
|
||||
assert spam == 'spamspam'
|
||||
""")
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines(["*1 passed*"])
|
||||
result = testdir.runpytest_inprocess(testfile)
|
||||
result = testdir.runpytest(testfile)
|
||||
result.stdout.fnmatch_lines(["*1 passed*"])
|
||||
|
||||
def test_extend_fixture_conftest_module(self, testdir):
|
||||
@@ -142,9 +142,9 @@ class TestFillFixtures:
|
||||
def test_spam(spam):
|
||||
assert spam == 'spamspam'
|
||||
""")
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines(["*1 passed*"])
|
||||
result = testdir.runpytest_inprocess(testfile)
|
||||
result = testdir.runpytest(testfile)
|
||||
result.stdout.fnmatch_lines(["*1 passed*"])
|
||||
|
||||
def test_extend_fixture_conftest_conftest(self, testdir):
|
||||
@@ -168,9 +168,9 @@ class TestFillFixtures:
|
||||
def test_spam(spam):
|
||||
assert spam == "spamspam"
|
||||
"""))
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines(["*1 passed*"])
|
||||
result = testdir.runpytest_inprocess(testfile)
|
||||
result = testdir.runpytest(testfile)
|
||||
result.stdout.fnmatch_lines(["*1 passed*"])
|
||||
|
||||
def test_extend_fixture_conftest_plugin(self, testdir):
|
||||
@@ -195,7 +195,7 @@ class TestFillFixtures:
|
||||
def test_foo(foo):
|
||||
assert foo == 14
|
||||
""")
|
||||
result = testdir.runpytest_inprocess('-s')
|
||||
result = testdir.runpytest('-s')
|
||||
assert result.ret == 0
|
||||
|
||||
def test_extend_fixture_plugin_plugin(self, testdir):
|
||||
@@ -221,7 +221,7 @@ class TestFillFixtures:
|
||||
def test_foo(foo):
|
||||
assert foo == 14
|
||||
""")
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
assert result.ret == 0
|
||||
|
||||
def test_override_parametrized_fixture_conftest_module(self, testdir):
|
||||
@@ -243,9 +243,9 @@ class TestFillFixtures:
|
||||
def test_spam(spam):
|
||||
assert spam == 'spam'
|
||||
""")
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines(["*1 passed*"])
|
||||
result = testdir.runpytest_inprocess(testfile)
|
||||
result = testdir.runpytest(testfile)
|
||||
result.stdout.fnmatch_lines(["*1 passed*"])
|
||||
|
||||
def test_override_parametrized_fixture_conftest_conftest(self, testdir):
|
||||
@@ -270,9 +270,9 @@ class TestFillFixtures:
|
||||
def test_spam(spam):
|
||||
assert spam == "spam"
|
||||
"""))
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines(["*1 passed*"])
|
||||
result = testdir.runpytest_inprocess(testfile)
|
||||
result = testdir.runpytest(testfile)
|
||||
result.stdout.fnmatch_lines(["*1 passed*"])
|
||||
|
||||
def test_override_non_parametrized_fixture_conftest_module(self, testdir):
|
||||
@@ -297,9 +297,9 @@ class TestFillFixtures:
|
||||
assert spam == params['spam']
|
||||
params['spam'] += 1
|
||||
""")
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines(["*3 passed*"])
|
||||
result = testdir.runpytest_inprocess(testfile)
|
||||
result = testdir.runpytest(testfile)
|
||||
result.stdout.fnmatch_lines(["*3 passed*"])
|
||||
|
||||
def test_override_non_parametrized_fixture_conftest_conftest(self, testdir):
|
||||
@@ -327,9 +327,9 @@ class TestFillFixtures:
|
||||
assert spam == params['spam']
|
||||
params['spam'] += 1
|
||||
"""))
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines(["*3 passed*"])
|
||||
result = testdir.runpytest_inprocess(testfile)
|
||||
result = testdir.runpytest(testfile)
|
||||
result.stdout.fnmatch_lines(["*3 passed*"])
|
||||
|
||||
def test_autouse_fixture_plugin(self, testdir):
|
||||
@@ -349,7 +349,7 @@ class TestFillFixtures:
|
||||
def test_foo(request):
|
||||
assert request.function.foo == 7
|
||||
""")
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
assert result.ret == 0
|
||||
|
||||
def test_funcarg_lookup_error(self, testdir):
|
||||
@@ -357,7 +357,7 @@ class TestFillFixtures:
|
||||
def test_lookup_error(unknown):
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines([
|
||||
"*ERROR*test_lookup_error*",
|
||||
"*def test_lookup_error(unknown):*",
|
||||
@@ -386,7 +386,7 @@ class TestFillFixtures:
|
||||
traceback.print_exc()
|
||||
assert sys.exc_info() == (None, None, None)
|
||||
""")
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
assert result.ret == 0
|
||||
|
||||
|
||||
@@ -529,7 +529,7 @@ class TestRequestBasic:
|
||||
def test_second():
|
||||
assert len(l) == 1
|
||||
""")
|
||||
result = testdir.runpytest_inprocess(p)
|
||||
result = testdir.runpytest(p)
|
||||
result.stdout.fnmatch_lines([
|
||||
"*1 error*" # XXX the whole module collection fails
|
||||
])
|
||||
@@ -614,7 +614,7 @@ class TestRequestBasic:
|
||||
"""))
|
||||
p = b.join("test_module.py")
|
||||
p.write("def test_func(arg1): pass")
|
||||
result = testdir.runpytest_inprocess(p, "--fixtures")
|
||||
result = testdir.runpytest(p, "--fixtures")
|
||||
assert result.ret == 0
|
||||
result.stdout.fnmatch_lines("""
|
||||
*fixtures defined*conftest*
|
||||
@@ -783,7 +783,7 @@ class TestRequestCachedSetup:
|
||||
def test_two_different_setups(arg1, arg2):
|
||||
assert arg1 != arg2
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("-v")
|
||||
result = testdir.runpytest("-v")
|
||||
result.stdout.fnmatch_lines([
|
||||
"*1 passed*"
|
||||
])
|
||||
@@ -798,7 +798,7 @@ class TestRequestCachedSetup:
|
||||
def test_two_funcarg(arg1):
|
||||
assert arg1 == 11
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("-v")
|
||||
result = testdir.runpytest("-v")
|
||||
result.stdout.fnmatch_lines([
|
||||
"*1 passed*"
|
||||
])
|
||||
@@ -825,7 +825,7 @@ class TestRequestCachedSetup:
|
||||
def test_check_test0_has_teardown_correct():
|
||||
assert test_0.l == [2]
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("-v")
|
||||
result = testdir.runpytest("-v")
|
||||
result.stdout.fnmatch_lines([
|
||||
"*3 passed*"
|
||||
])
|
||||
@@ -841,7 +841,7 @@ class TestRequestCachedSetup:
|
||||
def test_func(app):
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
assert result.ret != 0
|
||||
result.stdout.fnmatch_lines([
|
||||
"*3/x*",
|
||||
@@ -896,7 +896,7 @@ class TestFixtureUsages:
|
||||
def test_add(arg2):
|
||||
assert arg2 == 2
|
||||
""")
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines([
|
||||
"*ScopeMismatch*involved factories*",
|
||||
"* def arg2*",
|
||||
@@ -918,7 +918,7 @@ class TestFixtureUsages:
|
||||
def test_add(arg1, arg2):
|
||||
assert arg2 == 2
|
||||
""")
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines([
|
||||
"*ScopeMismatch*involved factories*",
|
||||
"* def arg2*",
|
||||
@@ -942,7 +942,7 @@ class TestFixtureUsages:
|
||||
assert arg2 == arg1 + 1
|
||||
assert len(l) == arg1
|
||||
""")
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines([
|
||||
"*2 passed*"
|
||||
])
|
||||
@@ -962,7 +962,7 @@ class TestFixtureUsages:
|
||||
def test_missing(call_fail):
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines("""
|
||||
*pytest.fixture()*
|
||||
*def call_fail(fail)*
|
||||
@@ -1044,7 +1044,7 @@ class TestFixtureUsages:
|
||||
reprec.assertoutcome(passed=2)
|
||||
|
||||
def test_usefixtures_seen_in_showmarkers(self, testdir):
|
||||
result = testdir.runpytest_inprocess("--markers")
|
||||
result = testdir.runpytest("--markers")
|
||||
result.stdout.fnmatch_lines("""
|
||||
*usefixtures(fixturename1*mark tests*fixtures*
|
||||
""")
|
||||
@@ -1311,7 +1311,7 @@ class TestAutouseDiscovery:
|
||||
conftest.move(a.join(conftest.basename))
|
||||
a.join("test_something.py").write("def test_func(): pass")
|
||||
b.join("test_otherthing.py").write("def test_func(): pass")
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines("""
|
||||
*1 passed*1 error*
|
||||
""")
|
||||
@@ -1765,7 +1765,7 @@ class TestFixtureMarker:
|
||||
def test_1(arg):
|
||||
pass
|
||||
""" % method)
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
assert result.ret != 0
|
||||
result.stdout.fnmatch_lines([
|
||||
"*ScopeMismatch*You tried*function*session*request*",
|
||||
@@ -1823,7 +1823,7 @@ class TestFixtureMarker:
|
||||
def test_mismatch(arg):
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines([
|
||||
"*ScopeMismatch*",
|
||||
"*1 error*",
|
||||
@@ -1874,7 +1874,7 @@ class TestFixtureMarker:
|
||||
def test_func4(marg):
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("-v")
|
||||
result = testdir.runpytest("-v")
|
||||
result.stdout.fnmatch_lines("""
|
||||
test_mod1.py::test_func[s1] PASSED
|
||||
test_mod2.py::test_func2[s1] PASSED
|
||||
@@ -1926,7 +1926,7 @@ class TestFixtureMarker:
|
||||
def test_3(self):
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("-vs")
|
||||
result = testdir.runpytest("-vs")
|
||||
result.stdout.fnmatch_lines("""
|
||||
test_class_ordering.py::TestClass2::test_1[1-a] PASSED
|
||||
test_class_ordering.py::TestClass2::test_1[2-a] PASSED
|
||||
@@ -2017,7 +2017,7 @@ class TestFixtureMarker:
|
||||
def test_finish():
|
||||
assert not l
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("-v")
|
||||
result = testdir.runpytest("-v")
|
||||
result.stdout.fnmatch_lines("""
|
||||
*3 passed*
|
||||
""")
|
||||
@@ -2047,7 +2047,7 @@ class TestFixtureMarker:
|
||||
def test_browser(browser):
|
||||
assert browser['visited'] is True
|
||||
"""))
|
||||
reprec = testdir.runpytest_inprocess("-s")
|
||||
reprec = testdir.runpytest("-s")
|
||||
for test in ['test_browser']:
|
||||
reprec.stdout.fnmatch_lines('*Finalized*')
|
||||
|
||||
@@ -2258,7 +2258,7 @@ class TestFixtureMarker:
|
||||
def test_foo(fix):
|
||||
assert 1
|
||||
""")
|
||||
res = testdir.runpytest_inprocess('-v')
|
||||
res = testdir.runpytest('-v')
|
||||
res.stdout.fnmatch_lines([
|
||||
'*test_foo*alpha*',
|
||||
'*test_foo*beta*'])
|
||||
@@ -2275,7 +2275,7 @@ class TestFixtureMarker:
|
||||
def test_foo(fix):
|
||||
assert 1
|
||||
""")
|
||||
res = testdir.runpytest_inprocess('-v')
|
||||
res = testdir.runpytest('-v')
|
||||
res.stdout.fnmatch_lines([
|
||||
'*test_foo*alpha*',
|
||||
'*test_foo*beta*'])
|
||||
@@ -2335,7 +2335,7 @@ class TestErrors:
|
||||
def test_something(gen):
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
assert result.ret != 0
|
||||
result.stdout.fnmatch_lines([
|
||||
"*def gen(qwe123):*",
|
||||
@@ -2361,7 +2361,7 @@ class TestErrors:
|
||||
def test_3():
|
||||
assert l[0] != l[1]
|
||||
""")
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines("""
|
||||
*ERROR*teardown*test_1*
|
||||
*KeyError*
|
||||
@@ -2381,7 +2381,7 @@ class TestErrors:
|
||||
def test_something():
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
assert result.ret != 0
|
||||
result.stdout.fnmatch_lines([
|
||||
"*def gen(qwe123):*",
|
||||
@@ -2395,7 +2395,7 @@ class TestShowFixtures:
|
||||
assert config.option.showfixtures
|
||||
|
||||
def test_show_fixtures(self, testdir):
|
||||
result = testdir.runpytest_inprocess("--fixtures")
|
||||
result = testdir.runpytest("--fixtures")
|
||||
result.stdout.fnmatch_lines([
|
||||
"*tmpdir*",
|
||||
"*temporary directory*",
|
||||
@@ -2403,7 +2403,7 @@ class TestShowFixtures:
|
||||
)
|
||||
|
||||
def test_show_fixtures_verbose(self, testdir):
|
||||
result = testdir.runpytest_inprocess("--fixtures", "-v")
|
||||
result = testdir.runpytest("--fixtures", "-v")
|
||||
result.stdout.fnmatch_lines([
|
||||
"*tmpdir*--*tmpdir.py*",
|
||||
"*temporary directory*",
|
||||
@@ -2420,7 +2420,7 @@ class TestShowFixtures:
|
||||
def arg1():
|
||||
""" hello world """
|
||||
''')
|
||||
result = testdir.runpytest_inprocess("--fixtures", p)
|
||||
result = testdir.runpytest("--fixtures", p)
|
||||
result.stdout.fnmatch_lines("""
|
||||
*tmpdir
|
||||
*fixtures defined from*
|
||||
@@ -2442,7 +2442,7 @@ class TestShowFixtures:
|
||||
def test_hello():
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("--fixtures")
|
||||
result = testdir.runpytest("--fixtures")
|
||||
result.stdout.fnmatch_lines("""
|
||||
*tmpdir*
|
||||
*fixtures defined from*conftest*
|
||||
@@ -2468,7 +2468,7 @@ class TestShowFixtures:
|
||||
|
||||
"""
|
||||
''')
|
||||
result = testdir.runpytest_inprocess("--fixtures", p)
|
||||
result = testdir.runpytest("--fixtures", p)
|
||||
result.stdout.fnmatch_lines("""
|
||||
* fixtures defined from test_show_fixtures_trimmed_doc *
|
||||
arg2
|
||||
@@ -2496,7 +2496,7 @@ class TestContextManagerFixtureFuncs:
|
||||
print ("test2 %s" % arg1)
|
||||
assert 0
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("-s")
|
||||
result = testdir.runpytest("-s")
|
||||
result.stdout.fnmatch_lines("""
|
||||
*setup*
|
||||
*test1 1*
|
||||
@@ -2519,7 +2519,7 @@ class TestContextManagerFixtureFuncs:
|
||||
def test_2(arg1):
|
||||
print ("test2 %s" % arg1)
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("-s")
|
||||
result = testdir.runpytest("-s")
|
||||
result.stdout.fnmatch_lines("""
|
||||
*setup*
|
||||
*test1 1*
|
||||
@@ -2537,7 +2537,7 @@ class TestContextManagerFixtureFuncs:
|
||||
def test_1(arg1):
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("-s")
|
||||
result = testdir.runpytest("-s")
|
||||
result.stdout.fnmatch_lines("""
|
||||
*pytest.fail*setup*
|
||||
*1 error*
|
||||
@@ -2553,7 +2553,7 @@ class TestContextManagerFixtureFuncs:
|
||||
def test_1(arg1):
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("-s")
|
||||
result = testdir.runpytest("-s")
|
||||
result.stdout.fnmatch_lines("""
|
||||
*pytest.fail*teardown*
|
||||
*1 passed*1 error*
|
||||
@@ -2569,7 +2569,7 @@ class TestContextManagerFixtureFuncs:
|
||||
def test_1(arg1):
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("-s")
|
||||
result = testdir.runpytest("-s")
|
||||
result.stdout.fnmatch_lines("""
|
||||
*fixture function*
|
||||
*test_yields*:2*
|
||||
@@ -2585,7 +2585,7 @@ class TestContextManagerFixtureFuncs:
|
||||
def test_1(arg1):
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("-s")
|
||||
result = testdir.runpytest("-s")
|
||||
result.stdout.fnmatch_lines("""
|
||||
*yield_fixture*requires*yield*
|
||||
*yield_fixture*
|
||||
@@ -2601,7 +2601,7 @@ class TestContextManagerFixtureFuncs:
|
||||
def test_1(arg1):
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("-s")
|
||||
result = testdir.runpytest("-s")
|
||||
result.stdout.fnmatch_lines("""
|
||||
*fixture*cannot use*yield*
|
||||
*def arg1*
|
||||
|
||||
@@ -246,7 +246,7 @@ class TestMetafunc:
|
||||
assert x in (10,20)
|
||||
assert y == 2
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("-v")
|
||||
result = testdir.runpytest("-v")
|
||||
result.stdout.fnmatch_lines([
|
||||
"*test_simple*1-2*",
|
||||
"*test_simple*2-2*",
|
||||
@@ -290,7 +290,7 @@ class TestMetafunc:
|
||||
def test_meth(self, x, y):
|
||||
assert 0, x
|
||||
""")
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
assert result.ret == 1
|
||||
result.assert_outcomes(failed=6)
|
||||
|
||||
@@ -330,7 +330,7 @@ class TestMetafunc:
|
||||
def test_3(self, arg, arg2):
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("-v")
|
||||
result = testdir.runpytest("-v")
|
||||
assert result.ret == 0
|
||||
result.stdout.fnmatch_lines("""
|
||||
*test_1*1*
|
||||
@@ -372,7 +372,7 @@ class TestMetafuncFunctional:
|
||||
assert metafunc.function == unbound
|
||||
assert metafunc.cls == TestClass
|
||||
""")
|
||||
result = testdir.runpytest_inprocess(p, "-v")
|
||||
result = testdir.runpytest(p, "-v")
|
||||
result.assert_outcomes(passed=2)
|
||||
|
||||
def test_addcall_with_two_funcargs_generators(self, testdir):
|
||||
@@ -389,7 +389,7 @@ class TestMetafuncFunctional:
|
||||
def test_myfunc(self, arg1, arg2):
|
||||
assert arg1 == arg2
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("-v", p)
|
||||
result = testdir.runpytest("-v", p)
|
||||
result.stdout.fnmatch_lines([
|
||||
"*test_myfunc*0*PASS*",
|
||||
"*test_myfunc*1*FAIL*",
|
||||
@@ -410,7 +410,7 @@ class TestMetafuncFunctional:
|
||||
def test_func2(arg1):
|
||||
assert arg1 in (10, 20)
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("-v", p)
|
||||
result = testdir.runpytest("-v", p)
|
||||
result.stdout.fnmatch_lines([
|
||||
"*test_func1*0*PASS*",
|
||||
"*test_func1*1*FAIL*",
|
||||
@@ -427,7 +427,7 @@ class TestMetafuncFunctional:
|
||||
def test_hello(xyz):
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest_inprocess(p)
|
||||
result = testdir.runpytest(p)
|
||||
result.assert_outcomes(passed=1)
|
||||
|
||||
|
||||
@@ -450,7 +450,7 @@ class TestMetafuncFunctional:
|
||||
def test_myfunc(self, arg1, arg2):
|
||||
assert arg1 == arg2
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("-v", p)
|
||||
result = testdir.runpytest("-v", p)
|
||||
result.stdout.fnmatch_lines([
|
||||
"*test_myfunc*hello*PASS*",
|
||||
"*test_myfunc*world*FAIL*",
|
||||
@@ -466,7 +466,7 @@ class TestMetafuncFunctional:
|
||||
def test_myfunc(self, hello):
|
||||
assert hello == "world"
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("-v", p)
|
||||
result = testdir.runpytest("-v", p)
|
||||
result.stdout.fnmatch_lines([
|
||||
"*test_myfunc*hello*PASS*",
|
||||
"*1 passed*"
|
||||
@@ -483,7 +483,7 @@ class TestMetafuncFunctional:
|
||||
assert not hasattr(self, 'x')
|
||||
self.x = 1
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("-v", p)
|
||||
result = testdir.runpytest("-v", p)
|
||||
result.stdout.fnmatch_lines([
|
||||
"*test_func*0*PASS*",
|
||||
"*test_func*1*PASS*",
|
||||
@@ -501,7 +501,7 @@ class TestMetafuncFunctional:
|
||||
def setup_method(self, func):
|
||||
self.val = 1
|
||||
""")
|
||||
result = testdir.runpytest_inprocess(p)
|
||||
result = testdir.runpytest(p)
|
||||
result.assert_outcomes(passed=1)
|
||||
|
||||
def test_parametrize_functional2(self, testdir):
|
||||
@@ -512,7 +512,7 @@ class TestMetafuncFunctional:
|
||||
def test_hello(arg1, arg2):
|
||||
assert 0, (arg1, arg2)
|
||||
""")
|
||||
result = testdir.runpytest_inprocess()
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines([
|
||||
"*(1, 4)*",
|
||||
"*(1, 5)*",
|
||||
@@ -537,7 +537,7 @@ class TestMetafuncFunctional:
|
||||
def test_func1(arg1, arg2):
|
||||
assert arg1 == 11
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("-v", p)
|
||||
result = testdir.runpytest("-v", p)
|
||||
result.stdout.fnmatch_lines([
|
||||
"*test_func1*1*PASS*",
|
||||
"*1 passed*"
|
||||
@@ -558,7 +558,7 @@ class TestMetafuncFunctional:
|
||||
def test_func(arg2):
|
||||
assert arg2 == 10
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("-v", p)
|
||||
result = testdir.runpytest("-v", p)
|
||||
result.stdout.fnmatch_lines([
|
||||
"*test_func*1*PASS*",
|
||||
"*1 passed*"
|
||||
@@ -574,7 +574,7 @@ class TestMetafuncFunctional:
|
||||
def test_function(a, b):
|
||||
assert a == b
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("-v")
|
||||
result = testdir.runpytest("-v")
|
||||
assert result.ret == 1
|
||||
result.stdout.fnmatch_lines_random([
|
||||
"*test_function*basic*PASSED",
|
||||
@@ -591,7 +591,7 @@ class TestMetafuncFunctional:
|
||||
def test_function(a, b):
|
||||
assert 1
|
||||
""")
|
||||
result = testdir.runpytest_inprocess("-v")
|
||||
result = testdir.runpytest("-v")
|
||||
result.stdout.fnmatch_lines("""
|
||||
*test_function*1-b0*
|
||||
*test_function*1.3-b1*
|
||||
@@ -647,7 +647,7 @@ class TestMetafuncFunctional:
|
||||
def test_function():
|
||||
pass
|
||||
""")
|
||||
reprec = testdir.runpytest_inprocess()
|
||||
reprec = testdir.runpytest()
|
||||
reprec.assert_outcomes(passed=1)
|
||||
|
||||
def test_generate_tests_only_done_in_subdir(self, testdir):
|
||||
@@ -679,7 +679,7 @@ class TestMetafuncFunctional:
|
||||
test_x = make_tests()
|
||||
test_y = make_tests()
|
||||
""")
|
||||
reprec = testdir.runpytest_inprocess()
|
||||
reprec = testdir.runpytest()
|
||||
reprec.assert_outcomes(passed=4)
|
||||
|
||||
@pytest.mark.issue463
|
||||
|
||||
Reference in New Issue
Block a user