summaryrefslogtreecommitdiff
path: root/lab
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2016-02-13 11:10:17 -0500
committerNed Batchelder <ned@nedbatchelder.com>2016-02-13 11:10:17 -0500
commit34d63dbfd76dc3a6091ac95225155212e5b1debf (patch)
tree30723405dd79499b6ab5e28001abf3dfb047ab6a /lab
parent24145b0bb0368868b8aa2e8cc0eb43324533367d (diff)
downloadpython-coveragepy-git-34d63dbfd76dc3a6091ac95225155212e5b1debf.tar.gz
Helper to parse a lot of files to test the parser
Diffstat (limited to 'lab')
-rw-r--r--lab/parse_all.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/lab/parse_all.py b/lab/parse_all.py
new file mode 100644
index 00000000..37606838
--- /dev/null
+++ b/lab/parse_all.py
@@ -0,0 +1,19 @@
+"""Parse every Python file in a tree."""
+
+import os
+import sys
+
+from coverage.misc import CoverageException
+from coverage.parser import PythonParser
+
+for root, dirnames, filenames in os.walk(sys.argv[1]):
+ for filename in filenames:
+ if filename.endswith(".py"):
+ filename = os.path.join(root, filename)
+ print(":: {}".format(filename))
+ try:
+ par = PythonParser(filename=filename)
+ par.parse_source()
+ par.arcs()
+ except Exception as exc:
+ print(" ** {}".format(exc))