diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-07-11 11:54:20 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-12-16 14:31:27 +0000 |
| commit | d8dc75de8b62b08a77cb2915bdc9c3f9f2f37239 (patch) | |
| tree | 91940a434485255df797de6c339c527109384a83 | |
| parent | 58678f5aa7ce1ada53508cceb64834152f72f582 (diff) | |
| download | poky-d8dc75de8b62b08a77cb2915bdc9c3f9f2f37239.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)
(From OE-Core rev: ab271b49d9b55ea271d519c3a4da0b639a07f0bb)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/lib/oeqa/core/context.py | 1 | ||||
| -rw-r--r-- | meta/lib/oeqa/core/decorator/depends.py | 4 | ||||
| -rw-r--r-- | meta/lib/oeqa/core/runner.py | 15 | ||||
| -rwxr-xr-x | meta/lib/oeqa/core/tests/test_data.py | 4 |
4 files changed, 8 insertions, 16 deletions
diff --git a/meta/lib/oeqa/core/context.py b/meta/lib/oeqa/core/context.py index acd547416f..ef008454ff 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 | ||
| 65 | def _skipTestDependency(case, depends): | 65 | def _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 374d30cc38..50122f22b1 100644 --- a/meta/lib/oeqa/core/runner.py +++ b/meta/lib/oeqa/core/runner.py | |||
| @@ -44,8 +44,10 @@ class OETestResult(_TestResult): | |||
| 44 | 44 | ||
| 45 | self.successes = [] | 45 | self.successes = [] |
| 46 | 46 | ||
| 47 | # Inject into tc so that TestDepends decorator can see results | ||
| 48 | tc.results = self | ||
| 49 | |||
| 47 | self.tc = tc | 50 | self.tc = tc |
| 48 | self._tc_map_results() | ||
| 49 | 51 | ||
| 50 | def startTest(self, test): | 52 | def startTest(self, test): |
| 51 | # Allow us to trigger the testcase buffer mode on a per test basis | 53 | # Allow us to trigger the testcase buffer mode on a per test basis |
| @@ -55,13 +57,6 @@ class OETestResult(_TestResult): | |||
| 55 | self.buffer = test.buffer | 57 | self.buffer = test.buffer |
| 56 | super(OETestResult, self).startTest(test) | 58 | super(OETestResult, self).startTest(test) |
| 57 | 59 | ||
| 58 | def _tc_map_results(self): | ||
| 59 | self.tc._results['failures'] = self.failures | ||
| 60 | self.tc._results['errors'] = self.errors | ||
| 61 | self.tc._results['skipped'] = self.skipped | ||
| 62 | self.tc._results['expectedFailures'] = self.expectedFailures | ||
| 63 | self.tc._results['successes'] = self.successes | ||
| 64 | |||
| 65 | def logSummary(self, component, context_msg=''): | 60 | def logSummary(self, component, context_msg=''): |
| 66 | elapsed_time = self.tc._run_end_time - self.tc._run_start_time | 61 | elapsed_time = self.tc._run_end_time - self.tc._run_start_time |
| 67 | self.tc.logger.info("SUMMARY:") | 62 | self.tc.logger.info("SUMMARY:") |
| @@ -73,7 +68,7 @@ class OETestResult(_TestResult): | |||
| 73 | msg = "%s - OK - All required tests passed" % component | 68 | msg = "%s - OK - All required tests passed" % component |
| 74 | else: | 69 | else: |
| 75 | msg = "%s - FAIL - Required tests failed" % component | 70 | msg = "%s - FAIL - Required tests failed" % component |
| 76 | skipped = len(self.tc._results['skipped']) | 71 | skipped = len(self.skipped) |
| 77 | if skipped: | 72 | if skipped: |
| 78 | msg += " (skipped=%d)" % skipped | 73 | msg += " (skipped=%d)" % skipped |
| 79 | self.tc.logger.info(msg) | 74 | self.tc.logger.info(msg) |
| @@ -81,7 +76,7 @@ class OETestResult(_TestResult): | |||
| 81 | def _getDetailsNotPassed(self, case, type, desc): | 76 | def _getDetailsNotPassed(self, case, type, desc): |
| 82 | found = False | 77 | found = False |
| 83 | 78 | ||
| 84 | for (scase, msg) in self.tc._results[type]: | 79 | for (scase, msg) in getattr(self, type): |
| 85 | # XXX: When XML reporting is enabled scase is | 80 | # XXX: When XML reporting is enabled scase is |
| 86 | # xmlrunner.result._TestInfo instance instead of | 81 | # xmlrunner.result._TestInfo instance instead of |
| 87 | # string. | 82 | # 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 |
