diff options
-rwxr-xr-x | bitbake/bin/bitbake-selftest | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/bitbake/bin/bitbake-selftest b/bitbake/bin/bitbake-selftest index 1e00e33271..380e003619 100755 --- a/bitbake/bin/bitbake-selftest +++ b/bitbake/bin/bitbake-selftest | |||
@@ -37,6 +37,24 @@ for t in tests: | |||
37 | __import__(t) | 37 | __import__(t) |
38 | 38 | ||
39 | 39 | ||
40 | # Set-up logging | ||
41 | class StdoutStreamHandler(logging.StreamHandler): | ||
42 | """Special handler so that unittest is able to capture stdout""" | ||
43 | def __init__(self): | ||
44 | # Override __init__() because we don't want to set self.stream here | ||
45 | logging.Handler.__init__(self) | ||
46 | |||
47 | @property | ||
48 | def stream(self): | ||
49 | # We want to dynamically write wherever sys.stdout is pointing to | ||
50 | return sys.stdout | ||
51 | |||
52 | |||
53 | handler = StdoutStreamHandler() | ||
54 | bb.logger.addHandler(handler) | ||
55 | bb.logger.setLevel(logging.DEBUG) | ||
56 | |||
57 | |||
40 | ENV_HELP = """\ | 58 | ENV_HELP = """\ |
41 | Environment variables: | 59 | Environment variables: |
42 | BB_SKIP_NETTESTS set to 'yes' in order to skip tests using network | 60 | BB_SKIP_NETTESTS set to 'yes' in order to skip tests using network |
@@ -51,4 +69,4 @@ class main(unittest.main): | |||
51 | 69 | ||
52 | 70 | ||
53 | if __name__ == '__main__': | 71 | if __name__ == '__main__': |
54 | main(defaultTest=tests) | 72 | main(defaultTest=tests, buffer=True) |