summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2018-11-07 19:29:55 +0100
committerDaniel Hahler <git@thequod.de>2018-11-07 19:29:55 +0100
commitf840521854d15288b57315c56b620001dd534d12 (patch)
treeef32484fe7d71dd185be549fb6a801cf753b6509
parent134b103605ffbe50ea5175cfeecb8d033458fbd0 (diff)
downloadpytest-f840521854d15288b57315c56b620001dd534d12.tar.gz
harden test_collect_init_tests
-rw-r--r--testing/test_collection.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/testing/test_collection.py b/testing/test_collection.py
index c7cde090e..18033b9c0 100644
--- a/testing/test_collection.py
+++ b/testing/test_collection.py
@@ -975,31 +975,34 @@ def test_collect_init_tests(testdir):
result.stdout.fnmatch_lines(
[
"collected 2 items",
- "<Package *",
+ "<Package */tests'>",
" <Module '__init__.py'>",
" <Function 'test_init'>",
- "<Module 'tests/test_foo.py'>",
- " <Function 'test_foo'>",
+ " <Module 'test_foo.py'>",
+ " <Function 'test_foo'>",
]
)
- # XXX: Same as before, but different order.
+ # Same as before, but different order.
result = testdir.runpytest(".", "tests", "--collect-only")
result.stdout.fnmatch_lines(
[
"collected 2 items",
- "<Package *",
+ "<Package */tests'>",
" <Module '__init__.py'>",
" <Function 'test_init'>",
- "<Package *",
" <Module 'test_foo.py'>",
" <Function 'test_foo'>",
]
)
result = testdir.runpytest("./tests/test_foo.py", "--collect-only")
- result.stdout.fnmatch_lines(["*<Module 'test_foo.py'>", "*<Function 'test_foo'>"])
+ result.stdout.fnmatch_lines(
+ ["<Package */tests'>", " <Module 'test_foo.py'>", " <Function 'test_foo'>"]
+ )
assert "test_init" not in result.stdout.str()
result = testdir.runpytest("./tests/__init__.py", "--collect-only")
- result.stdout.fnmatch_lines(["*<Module '__init__.py'>", "*<Function 'test_init'>"])
+ result.stdout.fnmatch_lines(
+ ["<Package */tests'>", " <Module '__init__.py'>", " <Function 'test_init'>"]
+ )
assert "test_foo" not in result.stdout.str()