diff options
author | Daniel Hahler <git@thequod.de> | 2018-11-07 19:29:55 +0100 |
---|---|---|
committer | Daniel Hahler <git@thequod.de> | 2018-11-07 19:29:55 +0100 |
commit | f840521854d15288b57315c56b620001dd534d12 (patch) | |
tree | ef32484fe7d71dd185be549fb6a801cf753b6509 | |
parent | 134b103605ffbe50ea5175cfeecb8d033458fbd0 (diff) | |
download | pytest-f840521854d15288b57315c56b620001dd534d12.tar.gz |
harden test_collect_init_tests
-rw-r--r-- | testing/test_collection.py | 19 |
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() |