]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Allow pdb debugging in manually-invoked tests.
authorMaru Newby <marun@redhat.com>
Tue, 9 Apr 2013 02:33:03 +0000 (02:33 +0000)
committerMaru Newby <marun@redhat.com>
Tue, 9 Apr 2013 02:46:40 +0000 (02:46 +0000)
 * The old behavior required setting environment variables to
   disable capture of stdout and stderr to allow debugging via pdb.
   The new behavior requires enabling capture of stdout/stderr
   instead. This is already the case in nova.
 * testr behavior is unmodified.
 * Tip 'o the hat to Robert Collins (lifeless)

Change-Id: Ica021eeab07d5a540ce42436c9cc8000c3fd239a

.testr.conf
quantum/tests/base.py

index 9339183aa0c6f4909bec61545cdaf4a06dc0ff81..54f82b36281b5b71869ac0b5e03bd53f564477ee 100644 (file)
@@ -1,4 +1,4 @@
 [DEFAULT]
-test_command=${PYTHON:-python} -m subunit.run discover -t ./ quantum/tests/unit $LISTOPT $IDOPTION
+test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ quantum/tests/unit $LISTOPT $IDOPTION
 test_id_option=--load-list $IDFILE
 test_list_option=--list
index 95664490aacc051754ee2fee8dd5b599e567c8a8..42f48dd2887202c995e967643cb7ffb31f1d744f 100644 (file)
@@ -50,10 +50,10 @@ class BaseTestCase(testtools.TestCase):
 
         self.addCleanup(CONF.reset)
 
-        if os.environ.get('OS_STDOUT_NOCAPTURE') not in TRUE_STRING:
+        if os.environ.get('OS_STDOUT_CAPTURE') in TRUE_STRING:
             stdout = self.useFixture(fixtures.StringStream('stdout')).stream
             self.useFixture(fixtures.MonkeyPatch('sys.stdout', stdout))
-        if os.environ.get('OS_STDERR_NOCAPTURE') not in TRUE_STRING:
+        if os.environ.get('OS_STDERR_CAPTURE') in TRUE_STRING:
             stderr = self.useFixture(fixtures.StringStream('stderr')).stream
             self.useFixture(fixtures.MonkeyPatch('sys.stderr', stderr))
         self.stubs = stubout.StubOutForTesting()