diff options
author | Daniel Hahler <git@thequod.de> | 2020-04-09 21:47:12 +0200 |
---|---|---|
committer | Daniel Hahler <git@thequod.de> | 2020-04-09 21:49:30 +0200 |
commit | 0b5d2ff526fdff018459ad971da33ca8114b3d80 (patch) | |
tree | a1b4dda1e7b0f0eb662e00ca76bacba4ac3e6f90 /testing/test_terminal.py | |
parent | f136b79f1a5df99753fd4e0c5290fcee1eb45f47 (diff) | |
download | pytest-0b5d2ff526fdff018459ad971da33ca8114b3d80.tar.gz |
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 88d564519..72c67cc39 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)""") |