@@ -454,6 +454,14 @@ def showfspath(self, value: bool | None) -> None:
454
454
def showlongtestinfo (self ) -> bool :
455
455
return self .config .get_verbosity (Config .VERBOSITY_TEST_CASES ) > 0
456
456
457
+ @property
458
+ def reported_progress (self ) -> int :
459
+ """The amount of items reported in the progress so far.
460
+
461
+ :meta private:
462
+ """
463
+ return len (self ._progress_nodeids_reported )
464
+
457
465
def hasopt (self , char : str ) -> bool :
458
466
char = {"xfailed" : "x" , "skipped" : "s" }.get (char , char )
459
467
return char in self .reportchars
@@ -684,7 +692,7 @@ def pytest_runtest_logreport(self, report: TestReport) -> None:
684
692
@property
685
693
def _is_last_item (self ) -> bool :
686
694
assert self ._session is not None
687
- return len ( self ._progress_nodeids_reported ) == self ._session .testscollected
695
+ return self .reported_progress == self ._session .testscollected
688
696
689
697
@hookimpl (wrapper = True )
690
698
def pytest_runtestloop (self ) -> Generator [None , object , object ]:
@@ -694,7 +702,7 @@ def pytest_runtestloop(self) -> Generator[None, object, object]:
694
702
if (
695
703
self .config .get_verbosity (Config .VERBOSITY_TEST_CASES ) <= 0
696
704
and self ._show_progress_info
697
- and self ._progress_nodeids_reported
705
+ and self .reported_progress
698
706
):
699
707
self ._write_progress_information_filling_space ()
700
708
@@ -705,7 +713,7 @@ def _get_progress_information_message(self) -> str:
705
713
collected = self ._session .testscollected
706
714
if self ._show_progress_info == "count" :
707
715
if collected :
708
- progress = len ( self ._progress_nodeids_reported )
716
+ progress = self .reported_progress
709
717
counter_format = f"{{:{ len (str (collected ))} d}}"
710
718
format_string = f" [{ counter_format } /{{}}]"
711
719
return format_string .format (progress , collected )
@@ -742,7 +750,7 @@ def _get_progress_information_message(self) -> str:
742
750
)
743
751
return ""
744
752
if collected :
745
- return f" [{ len ( self ._progress_nodeids_reported ) * 100 // collected :3d} %]"
753
+ return f" [{ self .reported_progress * 100 // collected :3d} %]"
746
754
return " [100%]"
747
755
748
756
def _write_progress_information_if_past_edge (self ) -> None :
0 commit comments