[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[minion-cvs] Add statement coverage support to the unit tests, using...
Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria.mit.edu:/tmp/cvs-serv17168/lib/mixminion
Modified Files:
test.py
Log Message:
Add statement coverage support to the unit tests, using Gareth Rees's
coverage tool.
This is still very much roll-your-own; you need to install coverage.py
yourself and set a magic environment variable. I'll add coments
explaining how eventually.
Index: test.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/test.py,v
retrieving revision 1.158
retrieving revision 1.159
diff -u -d -r1.158 -r1.159
--- test.py 19 Oct 2003 03:12:02 -0000 1.158
+++ test.py 7 Nov 2003 05:44:40 -0000 1.159
@@ -33,6 +33,12 @@
except ImportError:
import mixminion._unittest as unittest
+#DOCDOC
+if os.environ.get("MM_COVERAGE"):
+ import coverage
+ coverage.erase()
+ coverage.start()
+
import mixminion.testSupport
from mixminion.testSupport import mix_mktemp, suspendLog, resumeLog, \
replaceAttribute, undoReplacedAttributes, replaceFunction, \
@@ -6937,3 +6943,11 @@
def testAll(name, args):
initializeGlobals()
unittest.TextTestRunner(verbosity=1).run(testSuite())
+
+ #DOCDOC
+ if os.environ.get("MM_COVERAGE"):
+ allmods = [ mod for name, mod in sys.modules.items()
+ if (mod is not None and
+ name.startswith("mixminion") and
+ name != 'mixminion._minionlib') ]
+ coverage.report(allmods)