aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/oetest.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/oetest.py')
-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 3816c1ae9b3..0be61c2f0aa 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