Add the python API for applying filters to a string and being able to register functions as filters. Filter functions are pure functions where an input is translated into an output and there are no external data accesses. This means translations can be cached as they won't change. (Bitbake rev: 7d25d7511ca14213eea78ee739d260295cfa4045) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
1.9 KiB
Executable File
#!/usr/bin/env python3
Copyright (C) 2012 Richard Purdie
SPDX-License-Identifier: GPL-2.0-only
import os import sys, logging import warnings warnings.simplefilter("default") sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(file)), 'lib'))
import unittest try: import bb import hashserv import prserv import layerindexlib except RuntimeError as exc: sys.exit(str(exc))
tests = ["bb.tests.codeparser", "bb.tests.color", "bb.tests.cooker", "bb.tests.cow", "bb.tests.data", "bb.tests.event", "bb.tests.fetch", "bb.tests.parse", "bb.tests.runqueue", "bb.tests.siggen", "bb.tests.utils", "bb.tests.compression", "bb.tests.filter", "hashserv.tests", "prserv.tests", "layerindexlib.tests.layerindexobj", "layerindexlib.tests.restapi", "layerindexlib.tests.cooker"]
for t in tests: t = '.'.join(t.split('.')[:3]) import(t)
Set-up logging
class StdoutStreamHandler(logging.StreamHandler): """Special handler so that unittest is able to capture stdout""" def init(self): # Override init() because we don't want to set self.stream here logging.Handler.init(self)
@property
def stream(self):
# We want to dynamically write wherever sys.stdout is pointing to
return sys.stdout
handler = StdoutStreamHandler() bb.logger.addHandler(handler) bb.logger.setLevel(logging.DEBUG)
ENV_HELP = """
Environment variables:
BB_SKIP_NETTESTS set to 'yes' in order to skip tests using network
connection
BB_TMPDIR_NOCLEAN set to 'yes' to preserve test tmp directories
"""
class main(unittest.main): def _print_help(self, *args, **kwargs): super(main, self)._print_help(*args, **kwargs) print(ENV_HELP)
if name == 'main': main(defaultTest=tests, buffer=True)