tests: fnmatch_lines: use list

For strings fnmatch_lines converts it into a Source objects, splitted on
newlines.  This is not necessary here, and it is more consistent to use
lists here in the first place.
This commit is contained in:
Daniel Hahler
2019-03-23 11:36:18 +01:00
parent 15d608867d
commit 08f3b02dfc
16 changed files with 58 additions and 56 deletions

View File

@@ -560,7 +560,7 @@ class TestFunction(object):
"""
)
result = testdir.runpytest()
result.stdout.fnmatch_lines("* 2 passed, 1 skipped in *")
result.stdout.fnmatch_lines(["* 2 passed, 1 skipped in *"])
def test_parametrize_skip(self, testdir):
testdir.makepyfile(
@@ -575,7 +575,7 @@ class TestFunction(object):
"""
)
result = testdir.runpytest()
result.stdout.fnmatch_lines("* 2 passed, 1 skipped in *")
result.stdout.fnmatch_lines(["* 2 passed, 1 skipped in *"])
def test_parametrize_skipif_no_skip(self, testdir):
testdir.makepyfile(
@@ -590,7 +590,7 @@ class TestFunction(object):
"""
)
result = testdir.runpytest()
result.stdout.fnmatch_lines("* 1 failed, 2 passed in *")
result.stdout.fnmatch_lines(["* 1 failed, 2 passed in *"])
def test_parametrize_xfail(self, testdir):
testdir.makepyfile(
@@ -605,7 +605,7 @@ class TestFunction(object):
"""
)
result = testdir.runpytest()
result.stdout.fnmatch_lines("* 2 passed, 1 xfailed in *")
result.stdout.fnmatch_lines(["* 2 passed, 1 xfailed in *"])
def test_parametrize_passed(self, testdir):
testdir.makepyfile(
@@ -620,7 +620,7 @@ class TestFunction(object):
"""
)
result = testdir.runpytest()
result.stdout.fnmatch_lines("* 2 passed, 1 xpassed in *")
result.stdout.fnmatch_lines(["* 2 passed, 1 xpassed in *"])
def test_parametrize_xfail_passed(self, testdir):
testdir.makepyfile(
@@ -635,7 +635,7 @@ class TestFunction(object):
"""
)
result = testdir.runpytest()
result.stdout.fnmatch_lines("* 3 passed in *")
result.stdout.fnmatch_lines(["* 3 passed in *"])
def test_function_original_name(self, testdir):
items = testdir.getitems(
@@ -833,7 +833,7 @@ class TestConftestCustomization(object):
)
# Use runpytest_subprocess, since we're futzing with sys.meta_path.
result = testdir.runpytest_subprocess()
result.stdout.fnmatch_lines("*1 passed*")
result.stdout.fnmatch_lines(["*1 passed*"])
def test_setup_only_available_in_subdir(testdir):
@@ -1298,14 +1298,14 @@ def test_keep_duplicates(testdir):
def test_package_collection_infinite_recursion(testdir):
testdir.copy_example("collect/package_infinite_recursion")
result = testdir.runpytest()
result.stdout.fnmatch_lines("*1 passed*")
result.stdout.fnmatch_lines(["*1 passed*"])
def test_package_collection_init_given_as_argument(testdir):
"""Regression test for #3749"""
p = testdir.copy_example("collect/package_init_given_as_arg")
result = testdir.runpytest(p / "pkg" / "__init__.py")
result.stdout.fnmatch_lines("*1 passed*")
result.stdout.fnmatch_lines(["*1 passed*"])
def test_package_with_modules(testdir):

View File

@@ -536,7 +536,7 @@ class TestRequestBasic(object):
"""
)
result = testdir.runpytest_subprocess()
result.stdout.fnmatch_lines("* 1 passed in *")
result.stdout.fnmatch_lines(["* 1 passed in *"])
def test_getfixturevalue_recursive(self, testdir):
testdir.makeconftest(
@@ -598,7 +598,7 @@ class TestRequestBasic(object):
"""
)
result = testdir.runpytest()
result.stdout.fnmatch_lines("* 2 passed in *")
result.stdout.fnmatch_lines(["* 2 passed in *"])
@pytest.mark.parametrize("getfixmethod", ("getfixturevalue", "getfuncargvalue"))
def test_getfixturevalue(self, testdir, getfixmethod):
@@ -787,7 +787,7 @@ class TestRequestBasic(object):
"""Regression test for #3057"""
testdir.copy_example("fixtures/test_getfixturevalue_dynamic.py")
result = testdir.runpytest()
result.stdout.fnmatch_lines("*1 passed*")
result.stdout.fnmatch_lines(["*1 passed*"])
def test_funcargnames_compatattr(self, testdir):
testdir.makepyfile(
@@ -1527,7 +1527,7 @@ class TestFixtureManagerParseFactories(object):
def test_collect_custom_items(self, testdir):
testdir.copy_example("fixtures/custom_item")
result = testdir.runpytest("foo")
result.stdout.fnmatch_lines("*passed*")
result.stdout.fnmatch_lines(["*passed*"])
class TestAutouseDiscovery(object):
@@ -2609,7 +2609,7 @@ class TestFixtureMarker(object):
)
reprec = testdir.runpytest("-s")
for test in ["test_browser"]:
reprec.stdout.fnmatch_lines("*Finalized*")
reprec.stdout.fnmatch_lines(["*Finalized*"])
def test_class_scope_with_normal_tests(self, testdir):
testpath = testdir.makepyfile(
@@ -3450,7 +3450,7 @@ class TestContextManagerFixtureFuncs(object):
"""
)
result = testdir.runpytest("-s")
result.stdout.fnmatch_lines("*mew*")
result.stdout.fnmatch_lines(["*mew*"])
class TestParameterizedSubRequest(object):