introduce a new --junitprefix option to influence xml reporting.

also internally avoid some redundant code.

--HG--
branch : trunk
This commit is contained in:
holger krekel
2010-06-09 16:18:47 +02:00
parent 0c04577f9f
commit bc6ead1a3c
3 changed files with 42 additions and 16 deletions

View File

@@ -119,6 +119,28 @@ class TestPython:
classname="test_failure_escape.test_failure_escape",
name="test_func[&]")
def test_junit_prefixing(self, testdir):
testdir.makepyfile("""
def test_func():
assert 0
class TestHello:
def test_hello(self):
pass
""")
result, dom = runandparse(testdir, "--junitprefix=xyz")
assert result.ret
node = dom.getElementsByTagName("testsuite")[0]
assert_attr(node, failures=1, tests=2)
tnode = node.getElementsByTagName("testcase")[0]
assert_attr(tnode,
classname="xyz.test_junit_prefixing.test_junit_prefixing",
name="test_func")
tnode = node.getElementsByTagName("testcase")[1]
assert_attr(tnode,
classname="xyz.test_junit_prefixing.test_junit_prefixing."
"TestHello",
name="test_hello")
def test_xfailure_function(self, testdir):
testdir.makepyfile("""
import py