diff options
author | Łukasz Langa <lukasz@langa.pl> | 2010-12-04 13:48:13 (GMT) |
---|---|---|
committer | Łukasz Langa <lukasz@langa.pl> | 2010-12-04 13:48:13 (GMT) |
commit | 535c0773a5df9ffbb47861e880e11c27a1282314 (patch) | |
tree | 3db4ee0b617bf417f4a36419c308b7355af2902f /Lib/test | |
parent | f24a0d90a92378ef0904d6bf9695c6b2edcee079 (diff) | |
download | cpython-535c0773a5df9ffbb47861e880e11c27a1282314.zip cpython-535c0773a5df9ffbb47861e880e11c27a1282314.tar.gz cpython-535c0773a5df9ffbb47861e880e11c27a1282314.tar.bz2 |
support for checking test coverage added.
70% coverage at the moment (not tragic but needs work).
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_cfgparser.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Lib/test/test_cfgparser.py b/Lib/test/test_cfgparser.py index 24158ad..2ea80dc 100644 --- a/Lib/test/test_cfgparser.py +++ b/Lib/test/test_cfgparser.py @@ -2,8 +2,9 @@ import collections import configparser import io import os -import unittest +import sys import textwrap +import unittest import warnings from test import support @@ -1084,6 +1085,17 @@ def test_main(): 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() |