@@ -971,19 +971,19 @@ def test_calls_showall(self, pytester: Pytester, mock_timing) -> None:
971
971
pytester .makepyfile (self .source )
972
972
result = pytester .runpytest_inprocess ("--durations=0" )
973
973
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 )
975
975
976
976
def test_calls_showall_verbose (self , pytester : Pytester , mock_timing ) -> None :
977
977
pytester .makepyfile (self .source )
978
978
result = pytester .runpytest_inprocess ("--durations=0" , "-vv" )
979
979
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 )
981
981
982
982
def test_calls_showall_durationsmin (self , pytester : Pytester , mock_timing ) -> None :
983
983
pytester .makepyfile (self .source )
984
984
result = pytester .runpytest_inprocess ("--durations=0" , "--durations-min=0.015" )
985
985
assert result .ret == 0
986
- TestDurations .check_tests_in_output (result .stdout .lines , "3" )
986
+ TestDurations .check_tests_in_output (result .stdout .lines , 3 )
987
987
988
988
def test_calls_showall_durationsmin_verbose (
989
989
self , pytester : Pytester , mock_timing
@@ -993,16 +993,22 @@ def test_calls_showall_durationsmin_verbose(
993
993
"--durations=0" , "--durations-min=0.015" , "-vv"
994
994
)
995
995
assert result .ret == 0
996
- TestDurations .check_tests_in_output (result .stdout .lines , "3" )
996
+ TestDurations .check_tests_in_output (result .stdout .lines , 3 )
997
997
998
998
@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 (
1001
1004
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
+ )
1004
1010
)
1005
- assert found_test_numbers == expected_test_numbers
1011
+ assert found_test_numbers == set ( expected_test_numbers )
1006
1012
1007
1013
def test_with_deselected (self , pytester : Pytester , mock_timing ) -> None :
1008
1014
pytester .makepyfile (self .source )
0 commit comments