]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
coverage2el.py: update to current coverage-3.7.1 API
authorBrian Warner <warner@lothar.com>
Tue, 9 Sep 2014 00:27:20 +0000 (17:27 -0700)
committerBrian Warner <warner@lothar.com>
Tue, 9 Sep 2014 16:47:13 +0000 (09:47 -0700)
misc/coding_tools/coverage2el.py

index a3d8d545617b6f6283a4a82414d4ff7bab513a70..53c83951a2f0fae00e2bb03777e1a3839cc13a1f 100644 (file)
@@ -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()