Add progress bar visuals to tests.

This commit is contained in:
kenkeiras 2017-05-24 22:37:44 +02:00
parent 8e304b2a09
commit e0a5f02c34
3 changed files with 31 additions and 4 deletions

View file

@ -0,0 +1,15 @@
def show_progbar(done, total, msg=''):
total_blocks = 10
blocks_done = (done * total_blocks) // total
blocks_to_go = total_blocks - blocks_done
print('\r\x1b[K' # Go to the start of the line
'\x1b[0m' # Restart the "style"
'|' # Put the first "|"
+ blocks_done * '' # Completed blocks
+ blocks_to_go * ' ' # Uncompleted blocks
+ '\x1b[7m|\x1b[0m' # End the bar
+ ' '
+ msg # Add message
+ '\r' # Go back to the start
, end='')