selftests: Fix all unittests to use test state

Signed-off-by: NLucas Meneghel Rodrigues <lmr@redhat.com>
上级 baa0861f
......@@ -29,6 +29,7 @@ if os.path.isdir(os.path.join(basedir, 'avocado')):
from avocado.plugins import jsonresult
from avocado import test
from avocado import job
class _Stream(object):
......@@ -53,7 +54,7 @@ class JSONResultTest(unittest.TestCase):
self.test_result = jsonresult.JSONTestResult(stream, args)
self.test_result.filename = self.tmpfile[1]
self.test_result.start_tests()
self.test1 = test.Test()
self.test1 = test.Test(job=job.Job())
self.test1.status = 'PASS'
self.test1.time_elapsed = 1.23
......@@ -63,7 +64,7 @@ class JSONResultTest(unittest.TestCase):
def testAddSuccess(self):
self.test_result.start_test(self.test1)
self.test_result.end_test(self.test1)
self.test_result.end_test(self.test1.get_state())
self.test_result.end_tests()
self.assertTrue(self.test_result.json)
with open(self.test_result.filename) as fp:
......
......@@ -69,7 +69,7 @@ class VMResultTest(unittest.TestCase):
time=tst['time'],
status=tst['status'])
self.test_result.start_test(test)
self.test_result.check_test(test)
self.test_result.check_test(test.get_state())
if not status.mapping[test.status]:
failures.append(test.tagged_name)
self.test_result.end_tests()
......
......@@ -29,6 +29,7 @@ if os.path.isdir(os.path.join(basedir, 'avocado')):
from avocado.plugins import xunit
from avocado import test
from avocado import job
class ParseXMLError(Exception):
......@@ -43,7 +44,7 @@ class xUnitSucceedTest(unittest.TestCase):
args.xunit_output = self.tmpfile[1]
self.test_result = xunit.xUnitTestResult(args=args)
self.test_result.start_tests()
self.test1 = test.Test()
self.test1 = test.Test(job=job.Job())
self.test1.status = 'PASS'
self.test1.time_elapsed = 1.23
......@@ -53,7 +54,7 @@ class xUnitSucceedTest(unittest.TestCase):
def testAddSuccess(self):
self.test_result.start_test(self.test1)
self.test_result.end_test(self.test1)
self.test_result.end_test(self.test1.get_state())
self.test_result.end_tests()
self.assertTrue(self.test_result.xml)
with open(self.test_result.output) as fp:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册