@@ -147,8 +147,6 @@ def __init__(self, config, file=None):
147
147
self .reportchars = getreportopt (config )
148
148
self .hasmarkup = self .writer .hasmarkup
149
149
self .isatty = file .isatty ()
150
- self ._current_line_chars = 0
151
- self ._install_line_chars_tracker ()
152
150
self ._progress_items_reported = 0
153
151
154
152
@property
@@ -161,28 +159,6 @@ def _tw(self):
161
159
stacklevel = 2 )
162
160
return self .writer
163
161
164
- @staticmethod
165
- def _new_tw_write (msg , ** kw ):
166
- terminal_reporter = kw .pop ('_terminal_reporter' )
167
- original_write = kw .pop ('_original_write' )
168
- fields = msg .rsplit ('\n ' , 1 )
169
- if '\n ' in msg :
170
- terminal_reporter ._current_line_chars = len (fields [- 1 ])
171
- else :
172
- terminal_reporter ._current_line_chars += len (fields [- 1 ])
173
- original_write (msg , ** kw )
174
-
175
- def _install_line_chars_tracker (self ):
176
- """
177
-
178
- :return:
179
- """
180
- import functools
181
- import weakref
182
- self .writer .write = functools .partial (self ._new_tw_write ,
183
- _terminal_reporter = weakref .proxy (self ),
184
- _original_write = self .writer .write )
185
-
186
162
def hasopt (self , char ):
187
163
char = {'xfailed' : 'x' , 'skipped' : 's' }.get (char , char )
188
164
return char in self .reportchars
@@ -329,7 +305,7 @@ def _maybe_write_progress_information(self):
329
305
self ._write_progress_information_filling_space ()
330
306
return
331
307
332
- past_right_side = self ._current_line_chars + self ._PROGRESS_LENGTH + 1 >= self ._screen_width
308
+ past_right_side = self .writer . chars_on_current_line + self ._PROGRESS_LENGTH + 1 >= self ._screen_width
333
309
if past_right_side :
334
310
msg = self ._get_progress_information_message ()
335
311
self .writer .line (msg )
@@ -342,7 +318,7 @@ def _get_progress_information_message(self):
342
318
343
319
def _write_progress_information_filling_space (self ):
344
320
msg = self ._get_progress_information_message ()
345
- fill = ' ' * (self .writer .fullwidth - self ._current_line_chars - len (msg ) - 1 )
321
+ fill = ' ' * (self .writer .fullwidth - self .writer . chars_on_current_line - len (msg ) - 1 )
346
322
self .write (fill + msg )
347
323
348
324
def pytest_collection (self ):
0 commit comments