summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-07-11 11:54:20 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-07-18 10:18:41 +0100
commitd9de34ce9906399ae9845d0434e2b2b1642bf46a (patch)
tree6b6ef677d1db920a93a71ab444a91efec39d9919 /meta/lib
parent4e4958cba2e083eac20e2770e04bfc7d56d9db42 (diff)
downloadpoky-d9de34ce9906399ae9845d0434e2b2b1642bf46a.tar.gz
oeqa/runner: Simplify code
There doesn't appear to be any reason we need this _results indirection any more so remove it. (From OE-Core rev: b618261811c48ff3b98eab1b340a8cd09ef183c6) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/core/context.py1
-rw-r--r--meta/lib/oeqa/core/decorator/depends.py4
-rw-r--r--meta/lib/oeqa/core/runner.py15
-rwxr-xr-xmeta/lib/oeqa/core/tests/test_data.py4
4 files changed, 8 insertions, 16 deletions
diff --git a/meta/lib/oeqa/core/context.py b/meta/lib/oeqa/core/context.py
index 8cdfbf834f..f174c4bbcf 100644
--- a/meta/lib/oeqa/core/context.py
+++ b/meta/lib/oeqa/core/context.py
@@ -27,7 +27,6 @@ class OETestContext(object):
27 self.logger = logger 27 self.logger = logger
28 self._registry = {} 28 self._registry = {}
29 self._registry['cases'] = collections.OrderedDict() 29 self._registry['cases'] = collections.OrderedDict()
30 self._results = {}
31 30
32 def _read_modules_from_manifest(self, manifest): 31 def _read_modules_from_manifest(self, manifest):
33 if not os.path.exists(manifest): 32 if not os.path.exists(manifest):
diff --git a/meta/lib/oeqa/core/decorator/depends.py b/meta/lib/oeqa/core/decorator/depends.py
index 99eccc1268..69c604d8f4 100644
--- a/meta/lib/oeqa/core/decorator/depends.py
+++ b/meta/lib/oeqa/core/decorator/depends.py
@@ -63,12 +63,10 @@ def _order_test_case_by_depends(cases, depends):
63 return [cases[case_id] for case_id in cases_ordered] 63 return [cases[case_id] for case_id in cases_ordered]
64 64
65def _skipTestDependency(case, depends): 65def _skipTestDependency(case, depends):
66 results = case.tc._results
67
68 skipReasons = ['errors', 'failures', 'skipped'] 66 skipReasons = ['errors', 'failures', 'skipped']
69 67
70 for reason in skipReasons: 68 for reason in skipReasons:
71 for test, _ in results[reason]: 69 for test, _ in getattr(case.tc.results, reason):
72 if test.id() in depends: 70 if test.id() in depends:
73 raise SkipTest("Test case %s depends on %s and was in %s." \ 71 raise SkipTest("Test case %s depends on %s and was in %s." \
74 % (case.id(), test.id(), reason)) 72 % (case.id(), test.id(), reason))
diff --git a/meta/lib/oeqa/core/runner.py b/meta/lib/oeqa/core/runner.py
index 6adbe3827b..0f84a1d280 100644
--- a/meta/lib/oeqa/core/runner.py
+++ b/meta/lib/oeqa/core/runner.py
@@ -47,8 +47,10 @@ class OETestResult(_TestResult):
47 self.endtime = {} 47 self.endtime = {}
48 self.progressinfo = {} 48 self.progressinfo = {}
49 49
50 # Inject into tc so that TestDepends decorator can see results
51 tc.results = self
52
50 self.tc = tc 53 self.tc = tc
51 self._tc_map_results()
52 54
53 def startTest(self, test): 55 def startTest(self, test):
54 # May have been set by concurrencytest 56 # May have been set by concurrencytest
@@ -56,13 +58,6 @@ class OETestResult(_TestResult):
56 self.starttime[test.id()] = time.time() 58 self.starttime[test.id()] = time.time()
57 super(OETestResult, self).startTest(test) 59 super(OETestResult, self).startTest(test)
58 60
59 def _tc_map_results(self):
60 self.tc._results['failures'] = self.failures
61 self.tc._results['errors'] = self.errors
62 self.tc._results['skipped'] = self.skipped
63 self.tc._results['expectedFailures'] = self.expectedFailures
64 self.tc._results['successes'] = self.successes
65
66 def stopTest(self, test): 61 def stopTest(self, test):
67 self.endtime[test.id()] = time.time() 62 self.endtime[test.id()] = time.time()
68 super(OETestResult, self).stopTest(test) 63 super(OETestResult, self).stopTest(test)
@@ -80,7 +75,7 @@ class OETestResult(_TestResult):
80 msg = "%s - OK - All required tests passed" % component 75 msg = "%s - OK - All required tests passed" % component
81 else: 76 else:
82 msg = "%s - FAIL - Required tests failed" % component 77 msg = "%s - FAIL - Required tests failed" % component
83 skipped = len(self.tc._results['skipped']) 78 skipped = len(self.skipped)
84 if skipped: 79 if skipped:
85 msg += " (skipped=%d)" % skipped 80 msg += " (skipped=%d)" % skipped
86 self.tc.logger.info(msg) 81 self.tc.logger.info(msg)
@@ -88,7 +83,7 @@ class OETestResult(_TestResult):
88 def _getDetailsNotPassed(self, case, type, desc): 83 def _getDetailsNotPassed(self, case, type, desc):
89 found = False 84 found = False
90 85
91 for (scase, msg) in self.tc._results[type]: 86 for (scase, msg) in getattr(self, type):
92 # XXX: When XML reporting is enabled scase is 87 # XXX: When XML reporting is enabled scase is
93 # xmlrunner.result._TestInfo instance instead of 88 # xmlrunner.result._TestInfo instance instead of
94 # string. 89 # string.
diff --git a/meta/lib/oeqa/core/tests/test_data.py b/meta/lib/oeqa/core/tests/test_data.py
index 320468cbe4..21b6c68b8a 100755
--- a/meta/lib/oeqa/core/tests/test_data.py
+++ b/meta/lib/oeqa/core/tests/test_data.py
@@ -21,7 +21,7 @@ class TestData(TestBase):
21 21
22 tc = self._testLoader(modules=self.modules) 22 tc = self._testLoader(modules=self.modules)
23 self.assertEqual(False, tc.runTests().wasSuccessful()) 23 self.assertEqual(False, tc.runTests().wasSuccessful())
24 for test, data in tc._results['errors']: 24 for test, data in tc.errors:
25 expect = False 25 expect = False
26 if expectedException in data: 26 if expectedException in data:
27 expect = True 27 expect = True
@@ -34,7 +34,7 @@ class TestData(TestBase):
34 34
35 tc = self._testLoader(d=d, modules=self.modules) 35 tc = self._testLoader(d=d, modules=self.modules)
36 self.assertEqual(False, tc.runTests().wasSuccessful()) 36 self.assertEqual(False, tc.runTests().wasSuccessful())
37 for test, data in tc._results['failures']: 37 for test, data in tc.failures:
38 expect = False 38 expect = False
39 if expectedError in data: 39 if expectedError in data:
40 expect = True 40 expect = True