From b8ea5404dd387aa9f414a44113610d395777b778 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 19 Nov 2012 14:15:23 +0000 Subject: * tests/test_all.py: - Write general test status output to stdout, not stderr. --- debian/changelog | 2 ++ tests/test_all.py | 13 +++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 25125971..2fbfc3b4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,8 @@ python-apt (0.8.8ubuntu4) UNRELEASED; urgency=low * tests/test_debfile_multiarch.py: - Don't log warnings when skipping tests; the resulting stderr output causes autopkgtest to fail. + * tests/test_all.py: + - Write general test status output to stdout, not stderr. -- Colin Watson Mon, 19 Nov 2012 11:57:28 +0000 diff --git a/tests/test_all.py b/tests/test_all.py index 0f548781..0eccfa91 100644 --- a/tests/test_all.py +++ b/tests/test_all.py @@ -33,17 +33,22 @@ def get_library_dir(): plat_specifier) return os.path.abspath(library_dir) +class MyTestRunner(unittest.runner.TextTestRunner): + def __init__(self, *args, **kwargs): + kwargs["stream"] = sys.stdout + super(MyTestRunner, self).__init__(*args, **kwargs) + if __name__ == '__main__': if not os.access("/etc/apt/sources.list", os.R_OK): - sys.stderr.write("[tests] Skipping because sources.list is not readable\n") + sys.stdout.write("[tests] Skipping because sources.list is not readable\n") sys.exit(0) - sys.stderr.write("[tests] Running on %s\n" % sys.version.replace("\n", "")) + sys.stdout.write("[tests] Running on %s\n" % sys.version.replace("\n", "")) dirname = os.path.dirname(__file__) if dirname: os.chdir(dirname) library_dir = get_library_dir() - sys.stderr.write("Using library_dir: '%s'" % library_dir) + sys.stdout.write("Using library_dir: '%s'" % library_dir) if library_dir: sys.path.insert(0, os.path.abspath(library_dir)) @@ -51,4 +56,4 @@ if __name__ == '__main__': if path.endswith('.py') and os.path.isfile(path): exec('from %s import *' % path[:-3]) - unittest.main() + unittest.main(testRunner=MyTestRunner) -- cgit v1.2.3