@@ -769,15 +769,17 @@ def test_foo(subtests):
769769 with subtests.test("sub1"):
770770 print("sub1 stdout")
771771 logging.info("sub1 logging")
772+ logging.debug("sub1 logging debug")
772773
773774 with subtests.test("sub2"):
774775 print("sub2 stdout")
775776 logging.info("sub2 logging")
777+ logging.debug("sub2 logging debug")
776778 assert False
777779 """
778780 )
779781
780- def test_capturing (self , pytester : pytest .Pytester ) -> None :
782+ def test_capturing_info (self , pytester : pytest .Pytester ) -> None :
781783 self .create_file (pytester )
782784 result = pytester .runpytest ("--log-level=INFO" )
783785 result .stdout .fnmatch_lines (
@@ -786,7 +788,29 @@ def test_capturing(self, pytester: pytest.Pytester) -> None:
786788 "*-- Captured stdout call --*" ,
787789 "sub2 stdout" ,
788790 "*-- Captured log call ---*" ,
789- "INFO root:test_capturing.py:12 sub2 logging" ,
791+ "INFO * before" ,
792+ "INFO * sub1 logging" ,
793+ "INFO * sub2 logging" ,
794+ "*== short test summary info ==*" ,
795+ ]
796+ )
797+ result .stdout .no_fnmatch_line ("sub1 logging debug" )
798+ result .stdout .no_fnmatch_line ("sub2 logging debug" )
799+
800+ def test_capturing_debug (self , pytester : pytest .Pytester ) -> None :
801+ self .create_file (pytester )
802+ result = pytester .runpytest ("--log-level=DEBUG" )
803+ result .stdout .fnmatch_lines (
804+ [
805+ "*___ test_foo [[]sub2[]] __*" ,
806+ "*-- Captured stdout call --*" ,
807+ "sub2 stdout" ,
808+ "*-- Captured log call ---*" ,
809+ "INFO * before" ,
810+ "INFO * sub1 logging" ,
811+ "DEBUG * sub1 logging debug" ,
812+ "INFO * sub2 logging" ,
813+ "DEBUG * sub2 logging debug" ,
790814 "*== short test summary info ==*" ,
791815 ]
792816 )
0 commit comments