diff options
author | Georg Brandl <georg@python.org> | 2014-09-20 10:45:42 +0200 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-09-20 10:45:42 +0200 |
commit | a2672219887812c8719d950a14e2705e4d4d08f6 (patch) | |
tree | ae9f80c8b6889b9815b0588601418f5dbb8ad738 /tests/test_examplefiles.py | |
parent | 263571018b4057691369c7e8b567f36c66326dd0 (diff) | |
download | pygments-a2672219887812c8719d950a14e2705e4d4d08f6.tar.gz |
Do not pass the stats dict, it screws up -v output
Diffstat (limited to 'tests/test_examplefiles.py')
-rw-r--r-- | tests/test_examplefiles.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/test_examplefiles.py b/tests/test_examplefiles.py index 96816bf0..eabb0cf7 100644 --- a/tests/test_examplefiles.py +++ b/tests/test_examplefiles.py @@ -20,10 +20,13 @@ from pygments.util import ClassNotFound STORE_OUTPUT = False +STATS = {} + # generate methods def test_example_files(): - stats = {} + global STATS + STATS = {} testdir = os.path.dirname(__file__) outdir = os.path.join(testdir, 'examplefiles', 'output') if STORE_OUTPUT and not os.path.isdir(outdir): @@ -59,10 +62,10 @@ def test_example_files(): 'nor is of the form <lexer>_filename ' 'for overriding, thus no lexer found.' % fn) - yield check_lexer, lx, absfn, outfn, stats + yield check_lexer, lx, absfn, outfn N = 7 - stats = list(stats.items()) + stats = list(STATS.items()) stats.sort(key=lambda x: x[1][1]) print('\nExample files that took longest absolute time:') for fn, t in stats[-N:]: @@ -74,7 +77,7 @@ def test_example_files(): print('%-30s %6d chars %8.2f ms %7.3f ms/char' % ((fn,) + t)) -def check_lexer(lx, absfn, outfn, stats): +def check_lexer(lx, absfn, outfn): fp = open(absfn, 'rb') try: text = fp.read() @@ -99,7 +102,7 @@ def check_lexer(lx, absfn, outfn, stats): (lx, absfn, val, len(u''.join(ntext))) tokens.append((type, val)) t2 = time.time() - stats[os.path.basename(absfn)] = (len(text), + STATS[os.path.basename(absfn)] = (len(text), 1000 * (t2 - t1), 1000 * (t2 - t1) / len(text)) if u''.join(ntext) != text: print('\n'.join(difflib.unified_diff(u''.join(ntext).splitlines(), |