From: Brian Warner <warner@lothar.com>
Date: Tue, 9 Sep 2014 00:27:20 +0000 (-0700)
Subject: coverage2el.py: update to current coverage-3.7.1 API
X-Git-Tag: allmydata-tahoe-1.10.1a1~141
X-Git-Url: https://git.rkrishnan.org/simplejson/components/com_hotproperty/cyclelanguage?a=commitdiff_plain;h=5ddbf288b8559b1ad5692c3bb6bb2149b59fe006;p=tahoe-lafs%2Ftahoe-lafs.git

coverage2el.py: update to current coverage-3.7.1 API
---

diff --git a/misc/coding_tools/coverage2el.py b/misc/coding_tools/coverage2el.py
index a3d8d545..53c83951 100644
--- a/misc/coding_tools/coverage2el.py
+++ b/misc/coding_tools/coverage2el.py
@@ -1,21 +1,8 @@
-
-import os.path
 from coverage import coverage, summary, misc
 
 class ElispReporter(summary.SummaryReporter):
-    def report(self):
-        try:
-            # coverage-3.4 has both omit= and include= . include= is applied
-            # first, then omit= removes items from what's left. These are
-            # tested with fnmatch, against fully-qualified filenames.
-            self.find_code_units(None,
-                                 omit=[os.path.abspath("src/allmydata/test/*")],
-                                 include=[os.path.abspath("src/allmydata/*")])
-        except TypeError:
-            # coverage-3.3 only had omit=
-            self.find_code_units(None, ["/System", "/Library", "/usr/lib",
-                                        "support/lib", "src/allmydata/test"])
-
+    def report(self, morfs=None):
+        self.find_code_units(morfs)
         out = open(".coverage.el", "w")
         out.write("""
 ;; This is an elisp-readable form of the coverage data. It defines a
@@ -48,9 +35,11 @@ class ElispReporter(summary.SummaryReporter):
         out.close()
 
 def main():
-    c = coverage()
+    c = coverage() # defaults to data_file=.coverage
     c.load()
-    ElispReporter(c).report()
+    c._harvest_data()
+    c.config.from_args(include="src/*")
+    ElispReporter(c, c.config).report()
 
 if __name__ == '__main__':
     main()