diff options
author | Ran Benita <ran@unusedvar.com> | 2020-05-05 21:31:21 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-05 21:31:21 +0300 |
commit | d7d627b1e897890ab337ff88edd47850bc7d49d9 (patch) | |
tree | 77ed9972d31757a8ae07dd9b5b1303097caf8a89 /testing/test_terminal.py | |
parent | 46d768503e0fc524fe778a9c0acc0de2eee0bc26 (diff) | |
parent | 0b5d2ff526fdff018459ad971da33ca8114b3d80 (diff) | |
download | pytest-d7d627b1e897890ab337ff88edd47850bc7d49d9.tar.gz |
Merge pull request #7064 from blueyed/fix-_printcollecteditems-doc-upstream
Fix/improve printing of docs for collected items
Diffstat (limited to 'testing/test_terminal.py')
-rw-r--r-- | testing/test_terminal.py | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/testing/test_terminal.py b/testing/test_terminal.py index d2857ca77..0f5b4cb68 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -353,17 +353,33 @@ class TestCollectonly: result = testdir.runpytest("--collect-only", "-rs") result.stdout.fnmatch_lines(["*ERROR collecting*"]) - def test_collectonly_display_test_description(self, testdir): + def test_collectonly_displays_test_description( + self, testdir: Testdir, dummy_yaml_custom_test + ) -> None: + """Used dummy_yaml_custom_test for an Item without ``obj``.""" testdir.makepyfile( """ def test_with_description(): - \""" This test has a description. - \""" - assert True - """ + ''' This test has a description. + + more1. + more2.''' + """ ) result = testdir.runpytest("--collect-only", "--verbose") - result.stdout.fnmatch_lines([" This test has a description."]) + result.stdout.fnmatch_lines( + [ + "<YamlFile test1.yaml>", + " <YamlItem test1.yaml>", + "<Module test_collectonly_displays_test_description.py>", + " <Function test_with_description>", + " This test has a description.", + " ", + " more1.", + " more2.", + ], + consecutive=True, + ) def test_collectonly_failed_module(self, testdir): testdir.makepyfile("""raise ValueError(0)""") |