poky/meta/lib/oeqa/core/tests/common.py
Aníbal Limón a4eef558c9 oeqa/core/tests: Add tests of OEQA Threaded mode
Add needed tests to validate the OEQA Threaded mode, the remaining
parts are tested by the OEQA without Threaded mode.

- test_loader.py: Add a test to validate rules when creating the
list of test suites.
- test_decorators.py: Add oetimeout test because the threaded mode
uses Timer instead of signal.

[YOCTO #11450]

(From OE-Core rev: fb9d91ca34c1b5d3e0034f5135e71f964fca5b82)

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-02 13:36:14 +01:00

46 lines
1.4 KiB
Python

# Copyright (C) 2016 Intel Corporation
# Released under the MIT license (see COPYING.MIT)
import sys
import os
import unittest
import logging
import os
logger = logging.getLogger("oeqa")
logger.setLevel(logging.INFO)
consoleHandler = logging.StreamHandler()
formatter = logging.Formatter('OEQATest: %(message)s')
consoleHandler.setFormatter(formatter)
logger.addHandler(consoleHandler)
def setup_sys_path():
directory = os.path.dirname(os.path.abspath(__file__))
oeqa_lib = os.path.realpath(os.path.join(directory, '../../../'))
if not oeqa_lib in sys.path:
sys.path.insert(0, oeqa_lib)
class TestBase(unittest.TestCase):
def setUp(self):
self.logger = logger
directory = os.path.dirname(os.path.abspath(__file__))
self.cases_path = os.path.join(directory, 'cases')
def _testLoader(self, d={}, modules=[], tests=[], filters={}):
from oeqa.core.context import OETestContext
tc = OETestContext(d, self.logger)
tc.loadTests(self.cases_path, modules=modules, tests=tests,
filters=filters)
return tc
def _testLoaderThreaded(self, d={}, modules=[],
tests=[], filters={}):
from oeqa.core.threaded import OETestContextThreaded
tc = OETestContextThreaded(d, self.logger)
tc.loadTests(self.cases_path, modules=modules, tests=tests,
filters=filters)
return tc