diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/farm/html/run_a_xml_1.py (renamed from test/farm/html/run_a_xml.py) | 12 | ||||
-rw-r--r-- | test/farm/html/run_a_xml_2.py | 20 | ||||
-rw-r--r-- | test/farm/html/src/coverage.xml | 20 | ||||
-rw-r--r-- | test/farm/html/src/run_a_xml_2.ini | 3 | ||||
-rw-r--r-- | test/test_cmdline.py | 2 | ||||
-rw-r--r-- | test/test_config.py | 6 |
6 files changed, 56 insertions, 7 deletions
diff --git a/test/farm/html/run_a_xml.py b/test/farm/html/run_a_xml_1.py index dabfa61f..7f4805ef 100644 --- a/test/farm/html/run_a_xml.py +++ b/test/farm/html/run_a_xml_1.py @@ -1,20 +1,20 @@ def html_it(): - """Run coverage and make an XML report for x.""" + """Run coverage and make an XML report for a.""" import coverage cov = coverage.coverage() cov.start() import a cov.stop() - cov.xml_report(a, outfile="../xml/coverage.xml") + cov.xml_report(a, outfile="../xml_1/coverage.xml") import os -if not os.path.exists("xml"): - os.makedirs("xml") +if not os.path.exists("xml_1"): + os.makedirs("xml_1") runfunc(html_it, rundir="src") -compare("gold_x_xml", "xml", scrubs=[ +compare("gold_x_xml", "xml_1", scrubs=[ (r' timestamp="\d+"', ' timestamp="TIMESTAMP"'), (r' version="[-.\w]+"', ' version="VERSION"'), ]) -clean("xml") +clean("xml_1") diff --git a/test/farm/html/run_a_xml_2.py b/test/farm/html/run_a_xml_2.py new file mode 100644 index 00000000..b08d7960 --- /dev/null +++ b/test/farm/html/run_a_xml_2.py @@ -0,0 +1,20 @@ +def html_it(): + """Run coverage and make an XML report for a.""" + import coverage + cov = coverage.coverage(config_file="run_a_xml_2.ini") + cov.start() + import a + cov.stop() + cov.xml_report(a) + +import os +if not os.path.exists("xml_2"): + os.makedirs("xml_2") + +runfunc(html_it, rundir="src") + +compare("gold_x_xml", "xml_2", scrubs=[ + (r' timestamp="\d+"', ' timestamp="TIMESTAMP"'), + (r' version="[-.\w]+"', ' version="VERSION"'), + ]) +clean("xml_2") diff --git a/test/farm/html/src/coverage.xml b/test/farm/html/src/coverage.xml new file mode 100644 index 00000000..bc517328 --- /dev/null +++ b/test/farm/html/src/coverage.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" ?>
+<!DOCTYPE coverage
+ SYSTEM 'http://cobertura.sourceforge.net/xml/coverage-03.dtd'>
+<coverage branch-rate="0.0" line-rate="0.666666666667" timestamp="1263087779313" version="3.3a1">
+ <!-- Generated by coverage.py: http://nedbatchelder.com/code/coverage -->
+ <packages>
+ <package branch-rate="0.0" complexity="0.0" line-rate="0.666666666667" name=".">
+ <classes>
+ <class branch-rate="0.0" complexity="0.0" filename="a.py" line-rate="0.666666666667" name="a">
+ <methods/>
+ <lines>
+ <line hits="1" number="3"/>
+ <line hits="1" number="5"/>
+ <line hits="0" number="7"/>
+ </lines>
+ </class>
+ </classes>
+ </package>
+ </packages>
+</coverage>
diff --git a/test/farm/html/src/run_a_xml_2.ini b/test/farm/html/src/run_a_xml_2.ini new file mode 100644 index 00000000..8d28f97b --- /dev/null +++ b/test/farm/html/src/run_a_xml_2.ini @@ -0,0 +1,3 @@ +# Put all the XML output in xml_2 +[xml] +output = ../xml_2/coverage.xml diff --git a/test/test_cmdline.py b/test/test_cmdline.py index 9196873f..56242681 100644 --- a/test/test_cmdline.py +++ b/test/test_cmdline.py @@ -482,7 +482,7 @@ class NewCmdLineTest(CmdLineTest): """) self.cmd_executes("xml -o -", self.INIT_LOAD + """\ .xml_report(ignore_errors=None, omit_prefixes=None, morfs=[], - outfile=None) + outfile="-") """) self.cmd_executes("xml --omit fooey", self.INIT_LOAD + """\ .xml_report(ignore_errors=None, omit_prefixes=["fooey"], morfs=[], diff --git a/test/test_config.py b/test/test_config.py index 478f1150..f4bd65bf 100644 --- a/test/test_config.py +++ b/test/test_config.py @@ -93,6 +93,7 @@ class ConfigFileTest(CoverageTest): """Tests of the config file settings in particular.""" def test_config_file_settings(self): + # This sample file tries to use lots of variation of syntax... self.make_file(".coveragerc", """\ # This is a settings file for coverage.py [run] @@ -119,6 +120,9 @@ class ConfigFileTest(CoverageTest): directory = c:\\tricky\\dir.somewhere + [xml] + output=mycov.xml + """) cov = coverage.coverage() @@ -137,3 +141,5 @@ class ConfigFileTest(CoverageTest): ) self.assertEqual(cov.config.html_dir, r"c:\tricky\dir.somewhere") + + self.assertEqual(cov.config.xml_output, "mycov.xml") |