Merge pull request #4529 from aparamon/jxmlunit-call-time

Add --junittime=call option
This commit is contained in:
Bruno Oliveira
2018-12-13 13:51:06 -02:00
committed by GitHub
5 changed files with 51 additions and 3 deletions

View File

@@ -153,6 +153,24 @@ class TestPython(object):
val = tnode["time"]
assert round(float(val), 2) >= 0.03
def test_call_time(self, testdir):
testdir.makepyfile(
"""
import time, pytest
def setup_module():
time.sleep(0.1)
def teardown_module():
time.sleep(0.1)
def test_sleep():
time.sleep(0.1)
"""
)
result, dom = runandparse(testdir, "-o", "junit_time=call")
node = dom.find_first_by_tag("testsuite")
tnode = node.find_first_by_tag("testcase")
val = tnode["time"]
assert 0.1 <= round(float(val), 2) < 0.2
def test_setup_error(self, testdir):
testdir.makepyfile(
"""