[Python-checkins] r87041 - python/branches/py3k/Lib/test/test_cfgparser.py
lukasz.langa
python-checkins at python.org
Sat Dec 4 14:48:13 CET 2010
Author: lukasz.langa
Date: Sat Dec 4 14:48:13 2010
New Revision: 87041
Log:
support for checking test coverage added.
70% coverage at the moment (not tragic but needs work).
Modified:
python/branches/py3k/Lib/test/test_cfgparser.py
Modified: python/branches/py3k/Lib/test/test_cfgparser.py
==============================================================================
--- python/branches/py3k/Lib/test/test_cfgparser.py (original)
+++ python/branches/py3k/Lib/test/test_cfgparser.py Sat Dec 4 14:48:13 2010
@@ -2,8 +2,9 @@
import configparser
import io
import os
-import unittest
+import sys
import textwrap
+import unittest
import warnings
from test import support
@@ -1084,6 +1085,17 @@
ConfigParserTestCaseNonStandardDefaultSection,
)
+def test_coverage(coverdir):
+ trace = support.import_module('trace')
+ tracer=trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix,], trace=0,
+ count=1)
+ tracer.run('test_main()')
+ r=tracer.results()
+ print("Writing coverage results...")
+ r.write_results(show_missing=True, summary=True, coverdir=coverdir)
if __name__ == "__main__":
- test_main()
+ if "-c" in sys.argv:
+ test_coverage('/tmp/cmd.cover')
+ else:
+ test_main()
More information about the Python-checkins
mailing list