[SCM] GUI front-end for Debian Live. branch, master, updated. 1ad3ce3a2310adcc3f54d947751f88a5c6526caa

Chris Lamb chris at chris-lamb.co.uk
Tue Mar 4 12:58:58 UTC 2008


The following commit has been merged in the master branch:
commit 1ad3ce3a2310adcc3f54d947751f88a5c6526caa
Author: Chris Lamb <chris at chris-lamb.co.uk>
Date:   Tue Mar 4 12:58:46 2008 +0000

    Add test coverage metrics.
    
    Signed-off-by: Chris Lamb <chris at chris-lamb.co.uk>

diff --git a/.gitignore b/.gitignore
index 0d20b64..004a8d7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
 *.pyc
+.coverage
diff --git a/tests/test_coverage.py b/tests/test_coverage.py
new file mode 100755
index 0000000..519105a
--- /dev/null
+++ b/tests/test_coverage.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+
+import os
+import sys
+import commands
+
+def coverage(cmd, show=False):
+    status, output = commands.getstatusoutput('python-coverage %s ' % cmd)
+    if status != 0:
+        print >>sys.stderr, output
+        sys.exit(-1)
+    elif show:
+        print output
+
+def module_files():
+    for dir, _, files in os.walk('DebianLive'):
+        for filename in files:
+            if filename.endswith('.py'):
+                yield os.path.join(dir, filename)
+
+def purge():
+    try:
+        os.unlink('.coverage')
+    except OSError:
+        pass
+
+if __name__ == '__main__':
+    os.chdir(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+    purge()
+    coverage('-x %s' % 'tests/test_all.py')
+    coverage(' -r -m %s' % " ".join([x for x in module_files()]), show=True)
+    purge()

-- 
GUI front-end for Debian Live.



More information about the debian-live-changes mailing list