mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00

For now, even if we have specified to skip the whole module/class via command line, e.g., `oe-selftest -R gotoolchain', the class setup method is still run. This at least results in unnecessary builds, and at worst results in ERROR, if the setup method fails. So improve the skipping mechanism to avoid class setup method to run when specified to skip. (From OE-Core rev: b0b79bf65f5e5e65958090a4a88622b42df896bf) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
52 lines
1.4 KiB
Python
52 lines
1.4 KiB
Python
#
|
|
# Copyright (C) 2016 Intel Corporation
|
|
#
|
|
# SPDX-License-Identifier: MIT
|
|
#
|
|
|
|
import unittest
|
|
|
|
from oeqa.core.exception import OEQAMissingVariable
|
|
|
|
def _validate_td_vars(td, td_vars, type_msg):
|
|
if td_vars:
|
|
for v in td_vars:
|
|
if not v in td:
|
|
raise OEQAMissingVariable("Test %s need %s variable but"\
|
|
" isn't into td" % (type_msg, v))
|
|
|
|
class OETestCase(unittest.TestCase):
|
|
# TestContext and Logger instance set by OETestLoader.
|
|
tc = None
|
|
logger = None
|
|
|
|
# td has all the variables needed by the test cases
|
|
# is the same across all the test cases.
|
|
td = None
|
|
|
|
# td_vars has the variables needed by a test class
|
|
# or test case instance, if some var isn't into td a
|
|
# OEQAMissingVariable exception is raised
|
|
td_vars = None
|
|
|
|
@classmethod
|
|
def _oeSetUpClass(clss):
|
|
_validate_td_vars(clss.td, clss.td_vars, "class")
|
|
if hasattr(clss, 'setUpHooker') and callable(getattr(clss, 'setUpHooker')):
|
|
clss.setUpHooker()
|
|
clss.setUpClassMethod()
|
|
|
|
@classmethod
|
|
def _oeTearDownClass(clss):
|
|
clss.tearDownClassMethod()
|
|
|
|
def _oeSetUp(self):
|
|
for d in self.decorators:
|
|
d.setUpDecorator()
|
|
self.setUpMethod()
|
|
|
|
def _oeTearDown(self):
|
|
for d in self.decorators:
|
|
d.tearDownDecorator()
|
|
self.tearDownMethod()
|