summaryrefslogtreecommitdiff
path: root/functional_tests/test_xunit.py
diff options
context:
space:
mode:
authorJason Pellerin <jpellerin@gmail.com>2009-04-18 19:00:45 +0000
committerJason Pellerin <jpellerin@gmail.com>2009-04-18 19:00:45 +0000
commitc5bd03442781ce1c974920708e958d58d1ff6289 (patch)
tree04041c48ada439b6ca6510bb34007f7dd94b33be /functional_tests/test_xunit.py
parent296fee10bf942cf860326c88d5c5df6e906a8c7b (diff)
downloadnose-c5bd03442781ce1c974920708e958d58d1ff6289.tar.gz
Committed PyCon sprint work.
Diffstat (limited to 'functional_tests/test_xunit.py')
-rw-r--r--functional_tests/test_xunit.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/functional_tests/test_xunit.py b/functional_tests/test_xunit.py
new file mode 100644
index 0000000..77c3e7e
--- /dev/null
+++ b/functional_tests/test_xunit.py
@@ -0,0 +1,36 @@
+import os
+import unittest
+from nose.plugins.xunit import Xunit
+from nose.plugins.skip import Skip
+from nose.plugins import PluginTester
+
+support = os.path.join(os.path.dirname(__file__), 'support')
+xml_results_filename = os.path.join(support, "xunit.xml")
+
+# the plugin is tested better in unit tests.
+# this is just here for a sanity check
+
+class TestXUnitPlugin(PluginTester, unittest.TestCase):
+ activate = '--with-xunit'
+ args = ['-v','--xunit-file=%s' % xml_results_filename]
+ plugins = [Xunit(), Skip()]
+ suitepath = os.path.join(support, 'xunit')
+
+ def runTest(self):
+ print str(self.output)
+
+ assert "ERROR: test_error" in self.output
+ assert "FAIL: test_fail" in self.output
+ assert "test_skip (test_xunit_as_suite.TestForXunit) ... SKIP: skipit" in self.output
+ assert "XML: %s" % xml_results_filename in self.output
+
+ f = open(xml_results_filename,'r')
+ result = f.read()
+ f.close()
+ print result
+
+ assert '<?xml version="1.0" encoding="UTF-8"?>' in result
+ assert '<testsuite name="nosetests" tests="5" errors="1" failures="1" skip="1">' in result
+ assert '<testcase classname="test_xunit_as_suite.TestForXunit" name="test_xunit_as_suite.TestForXunit.test_error" time="0">' in result
+ assert '</testcase>' in result
+ assert '</testsuite>' in result \ No newline at end of file