Skip to content

Commit 0d7525e

Browse files
committed
Harden test_collect_init_tests
Fails with: E Failed: nomatch: 'collected 2 items' E and: '==================================================================================== test session starts =====================================================================================' E and: 'platform linux -- Python 3.6.6, pytest-3.10.1.dev18+g01c8fab1, py-1.7.0, pluggy-0.8.0' E and: "hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('…/Vcs/pytest/.hypothesis/examples')" E and: 'rootdir: /tmp/pytest-of-user/pytest-683/test_collect_init_tests0, inifile: pytest.ini' E and: 'plugins: testmon-0.9.13, hypothesis-3.71.10' E exact match: 'collected 2 items' E fnmatch: '<Package *' E with: "<Package '/tmp/pytest-of-user/pytest-683/test_collect_init_tests0/tests'>" E nomatch: " <Module '__init__.py'>" E and: " <Package '/tmp/pytest-of-user/pytest-683/test_collect_init_tests0/tests'>" E and: " <Module '__init__.py'>" E and: " <Function 'test_init'>" E and: " <Module 'test_foo.py'>" E and: " <Function 'test_foo'>" E and: '' E and: '================================================================================ no tests ran in 0.02 seconds ================================================================================' E and: '' E remains unmatched: " <Module '__init__.py'>" …/Vcs/pytest/testing/test_collection.py:970: Failed
1 parent 176d274 commit 0d7525e

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

testing/test_collection.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -951,19 +951,23 @@ def test_collect_init_tests(testdir):
951951
result = testdir.runpytest(p, "--collect-only")
952952
result.stdout.fnmatch_lines(
953953
[
954-
"*<Module '__init__.py'>",
955-
"*<Function 'test_init'>",
956-
"*<Module 'test_foo.py'>",
957-
"*<Function 'test_foo'>",
954+
"collected 2 items",
955+
"<Package *",
956+
" <Module '__init__.py'>",
957+
" <Function 'test_init'>",
958+
" <Module 'test_foo.py'>",
959+
" <Function 'test_foo'>",
958960
]
959961
)
960962
result = testdir.runpytest("./tests", "--collect-only")
961963
result.stdout.fnmatch_lines(
962964
[
963-
"*<Module '__init__.py'>",
964-
"*<Function 'test_init'>",
965-
"*<Module 'test_foo.py'>",
966-
"*<Function 'test_foo'>",
965+
"collected 2 items",
966+
"<Package *",
967+
" <Module '__init__.py'>",
968+
" <Function 'test_init'>",
969+
" <Module 'test_foo.py'>",
970+
" <Function 'test_foo'>",
967971
]
968972
)
969973
result = testdir.runpytest("./tests/test_foo.py", "--collect-only")

0 commit comments

Comments
 (0)