summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Collins <rbtcollins@hp.com>2015-04-14 12:12:56 +1200
committerRobert Collins <rbtcollins@hp.com>2015-04-14 13:49:57 +1200
commit82f3b535c058984fcc62426de8b955ffcef7ef33 (patch)
tree03555055211720022ca6c67fc93d1027cfade4c2
parentaa30d0c465c2fcaf8b93aed9b788b8196beef5e7 (diff)
downloadpbr-82f3b535c058984fcc62426de8b955ffcef7ef33.tar.gz
Better diagnostics on test failure
I was tracking down some test failures, which turned out to be a missing Python.h, but this was hard to figure out without the stderr output. Change-Id: I0d0cf2440f5cd8b6ba3c0278fe7be5006a602a34
-rw-r--r--pbr/tests/test_hooks.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/pbr/tests/test_hooks.py b/pbr/tests/test_hooks.py
index b9e874a..e355408 100644
--- a/pbr/tests/test_hooks.py
+++ b/pbr/tests/test_hooks.py
@@ -41,7 +41,8 @@
import os
import textwrap
-from testtools.matchers import Contains
+from testtools.content import text_content
+from testtools.matchers import Contains, EndsWith
from pbr.tests import base
from pbr.tests import util
@@ -83,13 +84,14 @@ class TestHooks(base.BaseTestCase):
assert 'build_ext post-hook' not in stdout
assert return_code == 0
- stdout, _, return_code = self.run_setup('build_ext')
+ stdout, stderr, return_code = self.run_setup('build_ext')
+ self.addDetailUniqueName('stderr', text_content(stderr))
assert textwrap.dedent("""
running build_ext
running pre_hook pbr_testpackage._setup_hooks.test_pre_hook for command build_ext
build_ext pre-hook
""") in stdout # flake8: noqa
- assert stdout.endswith('build_ext post-hook')
+ self.expectThat(stdout, EndsWith('build_ext post-hook'))
assert return_code == 0
def test_custom_commands_known(self):