From 166e1bc5dcae974ff39b99e3d51d2b67a18dde71 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Fri, 8 Nov 2019 23:20:43 +0000 Subject: [PATCH] liting and minor tidy --- tqdm/tests/tests_perf.py | 12 ++++++------ tqdm/tests/tests_synchronisation.py | 7 +++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/tqdm/tests/tests_perf.py b/tqdm/tests/tests_perf.py index ffc6d90a..6cb7a6ee 100644 --- a/tqdm/tests/tests_perf.py +++ b/tqdm/tests/tests_perf.py @@ -222,11 +222,11 @@ def test_manual_overhead(): def worker(total, blocking=True): def incr_bar(x): with closing(StringIO()) as our_file: - with tqdm(total=x, file=our_file, - lock_args=None if blocking else (False,), - miniters=1, mininterval=0, maxinterval=0) as t: - for i in range(total): - t.update() + for _ in trange( + total, file=our_file, + lock_args=None if blocking else (False,), + miniters=1, mininterval=0, maxinterval=0): + pass return x + 1 return incr_bar @@ -243,7 +243,7 @@ def test_lock_args(): import sys total = 8 - subtotal = 100 + subtotal = 1000 tqdm.set_lock(RLock()) with ThreadPoolExecutor(total) as pool: diff --git a/tqdm/tests/tests_synchronisation.py b/tqdm/tests/tests_synchronisation.py index 149e4636..f399f156 100644 --- a/tqdm/tests/tests_synchronisation.py +++ b/tqdm/tests/tests_synchronisation.py @@ -1,5 +1,5 @@ from __future__ import division -from tqdm import tqdm, TMonitor +from tqdm import tqdm, trange, TMonitor from tests_tqdm import with_setup, pretest, posttest, SkipTest, \ StringIO, closing from tests_tqdm import DiscreteTimer, cpu_timify @@ -43,9 +43,8 @@ def incr(x): def incr_bar(x): with closing(StringIO()) as our_file: - with tqdm(total=x, lock_args=(False,), file=our_file) as t: - for i in range(x): - t.update() + for _ in trange(x, lock_args=(False,), file=our_file): + pass return incr(x)