@@ -971,19 +971,19 @@ def test_calls_showall(self, pytester: Pytester, mock_timing) -> None:
971971 pytester .makepyfile (self .source )
972972 result = pytester .runpytest_inprocess ("--durations=0" )
973973 assert result .ret == 0
974- TestDurations .check_tests_in_output (result .stdout .lines , "23" )
974+ TestDurations .check_tests_in_output (result .stdout .lines , 2 , 3 )
975975
976976 def test_calls_showall_verbose (self , pytester : Pytester , mock_timing ) -> None :
977977 pytester .makepyfile (self .source )
978978 result = pytester .runpytest_inprocess ("--durations=0" , "-vv" )
979979 assert result .ret == 0
980- TestDurations .check_tests_in_output (result .stdout .lines , "123" )
980+ TestDurations .check_tests_in_output (result .stdout .lines , 1 , 2 , 3 )
981981
982982 def test_calls_showall_durationsmin (self , pytester : Pytester , mock_timing ) -> None :
983983 pytester .makepyfile (self .source )
984984 result = pytester .runpytest_inprocess ("--durations=0" , "--durations-min=0.015" )
985985 assert result .ret == 0
986- TestDurations .check_tests_in_output (result .stdout .lines , "3" )
986+ TestDurations .check_tests_in_output (result .stdout .lines , 3 )
987987
988988 def test_calls_showall_durationsmin_verbose (
989989 self , pytester : Pytester , mock_timing
@@ -993,16 +993,22 @@ def test_calls_showall_durationsmin_verbose(
993993 "--durations=0" , "--durations-min=0.015" , "-vv"
994994 )
995995 assert result .ret == 0
996- TestDurations .check_tests_in_output (result .stdout .lines , "3" )
996+ TestDurations .check_tests_in_output (result .stdout .lines , 3 )
997997
998998 @staticmethod
999- def check_tests_in_output (lines : Sequence [str ], expected_test_numbers : str ) -> None :
1000- found_test_numbers = "" .join (
999+ def check_tests_in_output (
1000+ lines : Sequence [str ], * expected_test_numbers : int
1001+ ) -> None :
1002+ number_of_tests = 3
1003+ found_test_numbers = set (
10011004 test_number
1002- for test_number in "123"
1003- if any (f"test_{ test_number } " in line and " call " in line for line in lines )
1005+ for test_number in range (1 , number_of_tests + 1 )
1006+ if any (
1007+ line .endswith (f"test_{ test_number } " ) and " call " in line
1008+ for line in lines
1009+ )
10041010 )
1005- assert found_test_numbers == expected_test_numbers
1011+ assert found_test_numbers == set ( expected_test_numbers )
10061012
10071013 def test_with_deselected (self , pytester : Pytester , mock_timing ) -> None :
10081014 pytester .makepyfile (self .source )
0 commit comments