mirror of
https://gitlab.nic.cz/knot/knot-dns.git
synced 2026-06-09 00:22:42 -04:00
tests-extra: fix progress cleanup when pause is called
This commit is contained in:
parent
4f0645048e
commit
7103cc7f0f
3 changed files with 8 additions and 6 deletions
|
|
@ -27,14 +27,10 @@ outs_dir = None
|
|||
def nothing():
|
||||
pass
|
||||
|
||||
def clear_line():
|
||||
if sys.stdout.isatty():
|
||||
print("\r\x1b[K", end='')
|
||||
|
||||
def progress_print(cntr, lock, func = nothing, *args, **kwargs):
|
||||
if sys.stdout.isatty():
|
||||
lock.acquire()
|
||||
clear_line()
|
||||
dnstest.utils.clear_line()
|
||||
func(*args, **kwargs)
|
||||
print(f"(Processed tests {cntr}/{TASK_COUNT})", end='', flush=True)
|
||||
lock.release()
|
||||
|
|
@ -380,7 +376,7 @@ def main(args):
|
|||
msg_skips = ", SKIPPED: %i" % skip_cnt if skip_cnt > 0 else ""
|
||||
msg_res = ", FAILED: %i" % fail_cnt if fail_cnt > 0 else ", SUCCESS"
|
||||
|
||||
clear_line()
|
||||
dnstest.utils.clear_line()
|
||||
log.info(msg_time + msg_cases + msg_skips + msg_res)
|
||||
|
||||
if fail_cnt:
|
||||
|
|
|
|||
|
|
@ -349,6 +349,7 @@ class Test(object):
|
|||
time.sleep(seconds)
|
||||
|
||||
def pause(self, msg=None):
|
||||
clear_line()
|
||||
input(test_info() + ((", " + msg) if msg else ""))
|
||||
|
||||
def rel_sleep(self, seconds):
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import enum
|
|||
import inspect
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
|
||||
from dnstest.context import Context
|
||||
|
|
@ -139,3 +140,7 @@ def compare_sections(section1, srv1name, section2, srv2name, name):
|
|||
|
||||
if different:
|
||||
detail_log(SEP)
|
||||
|
||||
def clear_line():
|
||||
if sys.stdout.isatty():
|
||||
print("\r\x1b[K", end='')
|
||||
|
|
|
|||
Loading…
Reference in a new issue