From 8a34a75963c337ebe3de0ece71a46bba4cddec49 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Thu, 29 Oct 2015 10:34:47 +0000 Subject: [PATCH] monor coverage fix, flake8 tests for examples --- Makefile | 1 + examples/simple_examples.py | 25 +++++++++++++------------ tox.ini | 1 + 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 65572c9e..ce7a23a6 100644 --- a/Makefile +++ b/Makefile @@ -9,4 +9,5 @@ test: nosetests tqdm -v coverage: + rm -f .coverage # coverage erase nosetests tqdm --with-coverage --cover-package=tqdm -v diff --git a/examples/simple_examples.py b/examples/simple_examples.py index 9efb8c62..03e6dfbd 100644 --- a/examples/simple_examples.py +++ b/examples/simple_examples.py @@ -12,18 +12,19 @@ for i in trange(16, leave=True): # Profiling/overhead tests stmts = ( - # Benchmark - '[i for i in xrange(int(1e8))]', - # Basic demo - 'import tqdm; [i for i in tqdm.trange(int(1e8))]', - # Some decorations - 'import tqdm; [i for i in tqdm.trange(int(1e8), miniters=int(1e6),' - ' ascii=True, desc="cool", dynamic_ncols=True)]', - # Experimental GUI demo - 'import tqdm; [i for i in tqdm.trange(int(1e8), gui=True)]', - # Comparison to https://code.google.com/p/python-progressbar/ - 'from progressbar.progressbar import ProgressBar;' - ' [i for i in ProgressBar()(xrange(int(1e8)))]') + # Benchmark + '[i for i in xrange(int(1e8))]', + # Basic demo + 'import tqdm; [i for i in tqdm.trange(int(1e8))]', + # Some decorations + 'import tqdm; [i for i in tqdm.trange(int(1e8), miniters=int(1e6),' + ' ascii=True, desc="cool", dynamic_ncols=True)]', + # Experimental GUI demo + 'import tqdm; [i for i in tqdm.trange(int(1e8), gui=True)]', + # Comparison to https://code.google.com/p/python-progressbar/ + 'from progressbar.progressbar import ProgressBar;' + ' [i for i in ProgressBar()(xrange(int(1e8)))]') + for s in stmts: print s print timeit(stmt=s, number=1), 'seconds' diff --git a/tox.ini b/tox.ini index cec4e905..90ac0c26 100644 --- a/tox.ini +++ b/tox.ini @@ -21,3 +21,4 @@ basepython = python2.7 deps = flake8 commands = flake8 --count --statistics tqdm/ + flake8 --count --statistics examples/