@@ -226,12 +226,21 @@ def test_log_2():
226226
227227
228228def test_log_cli_default_level_sections (testdir , request ):
229- """Check that with live logging enable we are printing the correct headers during setup/call/teardown."""
229+ """Check that with live logging enable we are printing the correct headers during
230+ start/setup/call/teardown/finish."""
230231 filename = request .node .name + '.py'
231232 testdir .makepyfile ('''
232233 import pytest
233234 import logging
234235
236+ @pytest.hookimpl(hookwrapper=True)
237+ def pytest_runtest_logstart():
238+ logging.warning('>>>>> START >>>>>')
239+
240+ @pytest.hookimpl(hookwrapper=True)
241+ def pytest_runtest_logfinish():
242+ logging.warning('<<<<< END <<<<<<<')
243+
235244 @pytest.fixture
236245 def fix(request):
237246 logging.warning("log message from setup of {}".format(request.node.name))
@@ -252,22 +261,30 @@ def test_log_2(fix):
252261 result = testdir .runpytest ()
253262 result .stdout .fnmatch_lines ([
254263 '{}::test_log_1 ' .format (filename ),
264+ '*-- live log start --*' ,
265+ '*WARNING*log >>>>> START >>>>> *' ,
255266 '*-- live log setup --*' ,
256267 '*WARNING*log message from setup of test_log_1*' ,
257268 '*-- live log call --*' ,
258269 '*WARNING*log message from test_log_1*' ,
259270 'PASSED *50%*' ,
260271 '*-- live log teardown --*' ,
261272 '*WARNING*log message from teardown of test_log_1*' ,
273+ '*-- live log finish --*' ,
274+ '*WARNING*log <<<<< END <<<<<<< *' ,
262275
263276 '{}::test_log_2 ' .format (filename ),
277+ '*-- live log start --*' ,
278+ '*WARNING*log >>>>> START >>>>> *' ,
264279 '*-- live log setup --*' ,
265280 '*WARNING*log message from setup of test_log_2*' ,
266281 '*-- live log call --*' ,
267282 '*WARNING*log message from test_log_2*' ,
268283 'PASSED *100%*' ,
269284 '*-- live log teardown --*' ,
270285 '*WARNING*log message from teardown of test_log_2*' ,
286+ '*-- live log finish --*' ,
287+ '*WARNING*log <<<<< END <<<<<<< *' ,
271288 '=* 2 passed in *=' ,
272289 ])
273290
0 commit comments