File 0001-Skip-test-for-testr-hook-being-installed-when-testr-.patch of Package python-pbr

From a4f27ca3972f88e1f494a95ac74fb0c582dd59dd Mon Sep 17 00:00:00 2001
From: Dirk Mueller <>
Date: Fri, 14 Sep 2018 23:14:47 +0200
Subject: [PATCH] Skip test for testr hook being installed when testr is not

pbr only depends on testrepository in the test requirements, so
packaging efforts can decide to skip the dependency if they want to.
As stestr is going to replace testrepository going forward, it makes
sense to make dependencies to testrepository optional.

Skip the test that requires testrepository in that scenario.

Change-Id: I28c30411a5a6fdb071ebcc35e65ce1f4f1242498
 pbr/tests/ | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/pbr/tests/ b/pbr/tests/
index 0fcf96c..3f74790 100644
--- a/pbr/tests/
+++ b/pbr/tests/
@@ -41,7 +41,9 @@
 import os
 from testtools import matchers
+from testtools import skipUnless
+from pbr import testr_command
 from pbr.tests import base
 from pbr.tests import util
@@ -66,6 +68,7 @@ class TestHooks(base.BaseTestCase):
         assert 'test_hook_1\ntest_hook_2' in stdout
         assert return_code == 0
+    @skipUnless(testr_command.have_testr, "testrepository not available")
     def test_custom_commands_known(self):
         stdout, _, return_code = self.run_setup('--help-commands')