@@ -186,7 +186,7 @@ def __init__(self, config, file=None):
186
186
# self.writer will be deprecated in pytest-3.4
187
187
self .writer = self ._tw
188
188
self ._screen_width = self ._tw .fullwidth
189
- self .is_fspath_extra_width = False
189
+ self ._is_fspath_past_edge = False
190
190
self .currentfspath = None
191
191
self .reportchars = getreportopt (config )
192
192
self .hasmarkup = self ._tw .hasmarkup
@@ -217,11 +217,11 @@ def write_fspath_result(self, nodeid, res):
217
217
fspath = self .startdir .bestrelpath (fspath )
218
218
self ._tw .line ()
219
219
self ._tw .write (fspath + " " )
220
- width = self . _tw . fullwidth - self . _tw . chars_on_current_line
221
- if 0 < width < 10 or self ._tw .chars_on_current_line % self ._screen_width > self . _screen_width - 10 :
220
+
221
+ if self . _screen_width - self . _MAX_LEN_LEFT <= self ._tw .chars_on_current_line % self ._screen_width :
222
222
self ._tw .line ()
223
- elif width < 0 :
224
- self .is_fspath_extra_width = True
223
+ if self . _tw . fullwidth - self . _tw . chars_on_current_line < 0 :
224
+ self ._is_fspath_past_edge = True
225
225
self ._tw .write (res )
226
226
227
227
def write_ensure_prefix (self , prefix , extra = "" , ** kwargs ):
@@ -361,13 +361,26 @@ def pytest_runtest_logfinish(self, nodeid):
361
361
self ._write_progress_information_filling_space ()
362
362
else :
363
363
past_edge = self ._tw .chars_on_current_line + self ._PROGRESS_LENGTH + 1 >= self ._screen_width
364
- width = self ._tw .chars_on_current_line % self ._screen_width + 9
365
- if past_edge and self .is_fspath_extra_width and width >= self ._screen_width :
366
- self .is_fspath_extra_width = False
367
- elif past_edge and not self .is_fspath_extra_width :
368
- msg = self ._get_progress_information_message ()
369
- self ._tw .write (msg + '\n ' , cyan = True )
370
-
364
+ width = self ._tw .chars_on_current_line % self ._screen_width + self ._MAX_LEN_LEFT + 1
365
+ # if past_edge and self.is_fspath_extra_width and width >= self._screen_width:
366
+ if past_edge :
367
+ if self ._is_fspath_past_edge and width > self ._screen_width :
368
+ self ._is_fspath_past_edge = False
369
+ # print('HEY')
370
+ # msg = self._get_progress_information_message()
371
+ # self._tw.write(msg + '\n', cyan=True)
372
+ # elif not self.is_fspath_extra_width:
373
+ if not self ._is_fspath_past_edge :
374
+ msg = self ._get_progress_information_message ()
375
+ self ._tw .write (msg + '\n ' , cyan = True )
376
+ # if not self.is_fspath_extra_width:
377
+ # msg = self._get_progress_information_message()
378
+ # self._tw.write(msg + '\n', cyan=True)
379
+ # elif past_edge and not self.is_fspath_extra_width:
380
+ # msg = self._get_progress_information_message()
381
+ # self._tw.write(msg + '\n', cyan=True)
382
+
383
+ _MAX_LEN_LEFT = len ('. [ 80%]' )
371
384
_PROGRESS_LENGTH = len (' [100%]' )
372
385
373
386
def _get_progress_information_message (self ):
@@ -381,9 +394,9 @@ def _get_progress_information_message(self):
381
394
382
395
def _write_progress_information_filling_space (self ):
383
396
msg = self ._get_progress_information_message ()
384
- if self .is_fspath_extra_width :
397
+ if self ._is_fspath_past_edge :
385
398
fill = ' ' * (self ._tw .fullwidth - self ._tw .chars_on_current_line % self ._screen_width - len (msg ) - 1 )
386
- self .is_fspath_extra_width = False
399
+ self ._is_fspath_past_edge = False
387
400
else :
388
401
fill = ' ' * (self ._tw .fullwidth - self ._tw .chars_on_current_line - len (msg ) - 1 )
389
402
self .write (fill + msg , cyan = True )
0 commit comments