Skip to content

Commit

Permalink
test: perf: tighten crucial important tests, add to pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Oct 8, 2020
1 parent 4db32a3 commit ab32d02
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ test:
tox -e perf

testnose:
nosetests tqdm -d -v
nosetests -d -v tqdm

testsetup:
@make README.rst
Expand All @@ -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:
Expand Down Expand Up @@ -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)"
Expand Down
8 changes: 4 additions & 4 deletions tqdm/tests/tests_perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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):
Expand Down

0 comments on commit ab32d02

Please sign in to comment.