From ab32d02ec6f6f55a523fd4d7055a462ed2820915 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Thu, 8 Oct 2020 13:57:50 +0100 Subject: [PATCH] test: perf: tighten crucial important tests, add to pre-commit --- Makefile | 11 ++++++----- tqdm/tests/tests_perf.py | 8 ++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index d9091cad..eec2922d 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,7 @@ test: tox -e perf testnose: - nosetests tqdm -d -v + nosetests -d -v tqdm testsetup: @make README.rst @@ -62,14 +62,14 @@ testsetup: testcoverage: @make coverclean - nosetests tqdm --with-coverage --cover-package=tqdm --cover-erase --cover-min-percentage=80 --ignore-files="tests_perf\.py" -d -v + nosetests -d -v tqdm --ignore-files="tests_perf\.py" --with-coverage --cover-package=tqdm --cover-erase --cover-min-percentage=80 testperf: # do not use coverage (which is extremely slow) - nosetests tqdm/tests/tests_perf.py -d -v + nosetests -d -v tqdm/tests/tests_perf.py testtimer: - nosetests tqdm --with-timer -d -v + nosetests -d -v tqdm --with-timer # another performance test, to check evolution across commits testasv: @@ -121,7 +121,8 @@ pre-commit: # quick sanity checks @make testsetup flake8 -j 8 --count --statistics tqdm/ examples/ - nosetests tqdm --ignore-files="tests_(perf|keras)\.py" -e "pandas|monitoring" -d + nosetests -d tqdm --ignore-files="tests_(perf|keras)\.py" -e "pandas|monitoring" + nosetests -d tqdm/tests/tests_perf.py -m basic_overhead prebuildclean: @+python -c "import shutil; shutil.rmtree('build', True)" @+python -c "import shutil; shutil.rmtree('dist', True)" diff --git a/tqdm/tests/tests_perf.py b/tqdm/tests/tests_perf.py index a708e86c..8e808f7d 100644 --- a/tqdm/tests/tests_perf.py +++ b/tqdm/tests/tests_perf.py @@ -172,7 +172,7 @@ def assert_performance(thresh, name_left, time_left, name_right, time_right): @with_setup(pretest, posttest) @retry_on_except() -def test_iter_overhead(): +def test_iter_basic_overhead(): """Test overhead of iteration based tqdm""" total = int(1e6) @@ -191,12 +191,12 @@ def test_iter_overhead(): a += i our_file.write(a) - assert_performance(6, 'trange', time_tqdm(), 'range', time_bench()) + assert_performance(3, 'trange', time_tqdm(), 'range', time_bench()) @with_setup(pretest, posttest) @retry_on_except() -def test_manual_overhead(): +def test_manual_basic_overhead(): """Test overhead of manual tqdm""" total = int(1e6) @@ -215,7 +215,7 @@ def test_manual_overhead(): a += i our_file.write(a) - assert_performance(6, 'tqdm', time_tqdm(), 'range', time_bench()) + assert_performance(5, 'tqdm', time_tqdm(), 'range', time_bench()) def worker(total, blocking=True):