@@ -387,7 +387,7 @@ def __init__(self, config: Config, file: TextIO | None = None) -> None:
387
387
self .reportchars = getreportopt (config )
388
388
self .foldskipped = config .option .fold_skipped
389
389
self .hasmarkup = self ._tw .hasmarkup
390
- self .isatty = file .isatty ()
390
+ self ._isatty = file .isatty ()
391
391
self ._progress_nodeids_reported : set [str ] = set ()
392
392
self ._timing_nodeids_reported : set [str ] = set ()
393
393
self ._show_progress_info = self ._determine_show_progress_info ()
@@ -514,6 +514,9 @@ def write_line(self, line: str | bytes, **markup: bool) -> None:
514
514
self .ensure_newline ()
515
515
self ._tw .line (line , ** markup )
516
516
517
+ def isatty (self ) -> bool :
518
+ return self ._isatty
519
+
517
520
def rewrite (self , line : str , ** markup : bool ) -> None :
518
521
"""Rewinds the terminal cursor to the beginning and writes the given line.
519
522
@@ -766,7 +769,7 @@ def _width_of_current_line(self) -> int:
766
769
return self ._tw .width_of_current_line
767
770
768
771
def pytest_collection (self ) -> None :
769
- if self .isatty :
772
+ if self .isatty () :
770
773
if self .config .option .verbose >= 0 :
771
774
self .write ("collecting ... " , flush = True , bold = True )
772
775
elif self .config .option .verbose >= 1 :
@@ -779,7 +782,7 @@ def pytest_collectreport(self, report: CollectReport) -> None:
779
782
self ._add_stats ("skipped" , [report ])
780
783
items = [x for x in report .result if isinstance (x , Item )]
781
784
self ._numcollected += len (items )
782
- if self .isatty :
785
+ if self .isatty () :
783
786
self .report_collect ()
784
787
785
788
def report_collect (self , final : bool = False ) -> None :
@@ -811,7 +814,7 @@ def report_collect(self, final: bool = False) -> None:
811
814
line += f" / { skipped } skipped"
812
815
if self ._numcollected > selected :
813
816
line += f" / { selected } selected"
814
- if self .isatty :
817
+ if self .isatty () :
815
818
self .rewrite (line , bold = True , erase = True )
816
819
if final :
817
820
self .write ("\n " )
0 commit comments