summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2014-10-15 12:46:51 -0700
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2014-10-22 13:11:55 -0500
commit9c08059110a62a926128c5f2ec0b726ef1083822 (patch)
treec1f1fa0f1d37b8a0cc619576f5b0268b04e701d3
parenta73d70b7fa79b988c97e8c258bc2b6c29224bf01 (diff)
downloadbcfg2-9c08059110a62a926128c5f2ec0b726ef1083822.tar.gz
bcfg2-9c08059110a62a926128c5f2ec0b726ef1083822.tar.bz2
bcfg2-9c08059110a62a926128c5f2ec0b726ef1083822.zip
testsuite: capture stderr by default
This quiets down a lot of tests, especially for option parsing.
-rw-r--r--testsuite/Testsrc/Testlib/TestOptions/__init__.py2
-rw-r--r--testsuite/common.py13
2 files changed, 15 insertions, 0 deletions
diff --git a/testsuite/Testsrc/Testlib/TestOptions/__init__.py b/testsuite/Testsrc/Testlib/TestOptions/__init__.py
index 00e250356..688f4e54c 100644
--- a/testsuite/Testsrc/Testlib/TestOptions/__init__.py
+++ b/testsuite/Testsrc/Testlib/TestOptions/__init__.py
@@ -73,7 +73,9 @@ class OptionTestCase(Bcfg2TestCase):
def setUpClass(cls):
# ensure that the option parser actually reads config files
Parser.unit_test = False
+ Bcfg2TestCase.setUpClass()
@classmethod
def tearDownClass(cls):
Parser.unit_test = True
+ Bcfg2TestCase.tearDownClass()
diff --git a/testsuite/common.py b/testsuite/common.py
index 5a08f8db5..49579d7ef 100644
--- a/testsuite/common.py
+++ b/testsuite/common.py
@@ -119,6 +119,19 @@ class Bcfg2TestCase(TestCase):
:func:`assertXMLEqual`, a useful assertion method given all the
XML used by Bcfg2.
"""
+ capture_stderr = True
+
+ @classmethod
+ def setUpClass(cls):
+ cls._stderr = sys.stderr
+ if cls.capture_stderr:
+ sys.stderr = sys.stdout
+
+ @classmethod
+ def tearDownClass(cls):
+ if cls.capture_stderr:
+ sys.stderr = cls._stderr
+
def assertXMLEqual(self, el1, el2, msg=None):
""" Test that the two XML trees given are equal. """
if msg is None: