@@ -30,6 +30,7 @@ def test_arg1(arg1):
30
30
"*fixtures used by test_arg1*" ,
31
31
"*(test_fixtures_in_module.py:9)*" ,
32
32
"arg1 -- test_fixtures_in_module.py:6" ,
33
+ " arg1 docstring"
33
34
]
34
35
)
35
36
result .stdout .no_fnmatch_line ("*_arg0*" )
@@ -179,3 +180,73 @@ def foo():
179
180
assert result .ret == 0
180
181
181
182
result .stdout .fnmatch_lines (["*collected 2 items*" ])
183
+
184
+ def test_multiline_docstring_in_module (pytester : Pytester ) -> None :
185
+ p = pytester .makepyfile (
186
+ '''
187
+ import pytest
188
+ @pytest.fixture
189
+ def arg1():
190
+ """Docstring content that spans across multiple lines,
191
+ through second line,
192
+ and through third line.
193
+
194
+ Docstring content that extends into a second paragraph.
195
+
196
+ Docstring content that extends into a third paragraph.
197
+ """
198
+ def test_arg1(arg1):
199
+ pass
200
+ '''
201
+ )
202
+
203
+ result = pytester .runpytest ("--fixtures-per-test" , p )
204
+ assert result .ret == 0
205
+
206
+ result .stdout .fnmatch_lines (
207
+ [
208
+ "*fixtures used by test_arg1*" ,
209
+ "*(test_multiline_docstring_in_module.py:13)*" ,
210
+ "arg1 -- test_multiline_docstring_in_module.py:3" ,
211
+ " Docstring content that spans across multiple lines," ,
212
+ " through second line," ,
213
+ " and through third line."
214
+ ]
215
+ )
216
+
217
+ def test_verbose_include_multiline_docstring (pytester : Pytester ) -> None :
218
+ p = pytester .makepyfile (
219
+ '''
220
+ import pytest
221
+ @pytest.fixture
222
+ def arg1():
223
+ """Docstring content that spans across multiple lines,
224
+ through second line,
225
+ and through third line.
226
+
227
+ Docstring content that extends into a second paragraph.
228
+
229
+ Docstring content that extends into a third paragraph.
230
+ """
231
+ def test_arg1(arg1):
232
+ pass
233
+ '''
234
+ )
235
+
236
+ result = pytester .runpytest ("--fixtures-per-test" , "-v" , p )
237
+ assert result .ret == 0
238
+
239
+ result .stdout .fnmatch_lines (
240
+ [
241
+ "*fixtures used by test_arg1*" ,
242
+ "*(test_verbose_include_multiline_docstring.py:13)*" ,
243
+ "arg1 -- test_verbose_include_multiline_docstring.py:3" ,
244
+ " Docstring content that spans across multiple lines," ,
245
+ " through second line," ,
246
+ " and through third line." ,
247
+ " " ,
248
+ " Docstring content that extends into a second paragraph." ,
249
+ " " ,
250
+ " Docstring content that extends into a third paragraph."
251
+ ]
252
+ )
0 commit comments