From 3f4f637ec2078aa568d1c53e730eccf9d70f49fe Mon Sep 17 00:00:00 2001 From: dongwenjuan Date: Thu, 20 Oct 2016 07:20:29 +0100 Subject: [PATCH] read data from stdout instead of stderr As oslo.log upgrades to 3.17.0, the `use_stderr` now defaults to False. Signed-off-by: dongwenjuan Change-Id: I648bf6b8f216d18ba7bc1f243615adde3f069c16 --- aodh/tests/unit/test_bin.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/aodh/tests/unit/test_bin.py b/aodh/tests/unit/test_bin.py index adf39bc4a..ce9e25114 100644 --- a/aodh/tests/unit/test_bin.py +++ b/aodh/tests/unit/test_bin.py @@ -47,11 +47,12 @@ class BinTestCase(base.BaseTestCase): subp = subprocess.Popen(['aodh-expirer', '-d', "--config-file=%s" % self.tempfile], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) - __, err = subp.communicate() + out, __ = subp.communicate() self.assertEqual(0, subp.poll()) self.assertIn(b"Nothing to clean, database alarm history " - b"time to live is disabled", err) + b"time to live is disabled", out) def test_run_expirer_ttl_enabled(self): content = ("[database]\n" @@ -65,13 +66,14 @@ class BinTestCase(base.BaseTestCase): subp = subprocess.Popen(['aodh-expirer', '-d', "--config-file=%s" % self.tempfile], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) - __, err = subp.communicate() + out, __ = subp.communicate() self.assertEqual(0, subp.poll()) msg = "Dropping alarm history data with TTL 1" if six.PY3: msg = msg.encode('utf-8') - self.assertIn(msg, err) + self.assertIn(msg, out) class BinEvaluatorTestCase(base.BaseTestCase):