summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucian Musat <george.l.musat@intel.com>2015-09-23 18:40:25 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-23 22:08:13 +0100
commit22bd8a600823306d7c5965a9a69b8e8888993513 (patch)
tree7afaa8c9662c1dd2c0e0ca178f74c4d84397337b
parent555e8d110435cf4af1e1ab4699c2fa55898e9d80 (diff)
downloadopenembedded-core-contrib-22bd8a600823306d7c5965a9a69b8e8888993513.tar.gz
openembedded-core-contrib-22bd8a600823306d7c5965a9a69b8e8888993513.tar.bz2
openembedded-core-contrib-22bd8a600823306d7c5965a9a69b8e8888993513.zip
oeqa/oetest: Remove bb as requirement for oetest.
In order for the test export runner to work oetest needs to be separated from bitbake environment. There is no need to use bb import here so we can use a logger instead. Signed-off-by: Lucian Musat <george.l.musat@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/oetest.py29
1 files changed, 21 insertions, 8 deletions
diff --git a/meta/lib/oeqa/oetest.py b/meta/lib/oeqa/oetest.py
index 3816c1ae9b..0be61c2f0a 100644
--- a/meta/lib/oeqa/oetest.py
+++ b/meta/lib/oeqa/oetest.py
@@ -11,10 +11,16 @@ import os, re, mmap
import unittest
import inspect
import subprocess
-import bb
+try:
+ import bb
+except ImportError:
+ pass
+import logging
from oeqa.utils.decorators import LogResults, gettag
from sys import exc_info, exc_clear
+logger = logging.getLogger("BitBake")
+
def getVar(obj):
#extend form dict, if a variable didn't exists, need find it in testcase
class VarDict(dict):
@@ -89,7 +95,7 @@ def loadTests(tc, type="runtime"):
suite.dependencies.append(dep_suite)
break
else:
- bb.warn("Test %s was declared as @skipUnlessPassed('%s') but that test is either not defined or not active. Will run the test anyway." %
+ logger.warning("Test %s was declared as @skipUnlessPassed('%s') but that test is either not defined or not active. Will run the test anyway." %
(test, depends_on))
# Use brute-force topological sort to determine ordering. Sort by
# depth (higher depth = must run later), with original ordering to
@@ -114,19 +120,26 @@ def custom_verbose(msg, *args, **kwargs):
_buffer += msg
else:
_buffer += msg
- bb.plain(_buffer.rstrip("\n"), *args, **kwargs)
+ try:
+ bb.plain(_buffer.rstrip("\n"), *args, **kwargs)
+ except NameError:
+ logger.info(_buffer.rstrip("\n"), *args, **kwargs)
_buffer = ""
def runTests(tc, type="runtime"):
suite = loadTests(tc, type)
- bb.note("Test modules %s" % tc.testslist)
+ logger.info("Test modules %s" % tc.testslist)
if hasattr(tc, "tagexp") and tc.tagexp:
- bb.note("Filter test cases by tags: %s" % tc.tagexp)
- bb.note("Found %s tests" % suite.countTestCases())
+ logger.info("Filter test cases by tags: %s" % tc.tagexp)
+ logger.info("Found %s tests" % suite.countTestCases())
runner = unittest.TextTestRunner(verbosity=2)
- if bb.msg.loggerDefaultVerbose:
- runner.stream.write = custom_verbose
+ try:
+ if bb.msg.loggerDefaultVerbose:
+ runner.stream.write = custom_verbose
+ except NameError:
+ # Not in bb environment?
+ pass
result = runner.run(suite)
return result