From 822b803fb0d7e260628230c680b4975c1a3e0900 Mon Sep 17 00:00:00 2001 From: Kenneth Giusti <kgiusti@gmail.com> Date: Thu, 3 Dec 2015 14:22:50 -0500 Subject: [PATCH] Skip Cyrus SASL tests if proton does not support Cyrus SASL Change-Id: I265d17a2c92b97777a5a97683b95427825872d3a Closes-Bug: #1508523 --- oslo_messaging/tests/test_amqp_driver.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/oslo_messaging/tests/test_amqp_driver.py b/oslo_messaging/tests/test_amqp_driver.py index 4e3b750fe..e73f4916c 100644 --- a/oslo_messaging/tests/test_amqp_driver.py +++ b/oslo_messaging/tests/test_amqp_driver.py @@ -38,6 +38,11 @@ pyngus = importutils.try_import("pyngus") if pyngus: from oslo_messaging._drivers.protocols.amqp import driver as amqp_driver +# The Cyrus-based SASL tests can only be run if the installed version of proton +# has been built with Cyrus SASL support. +_proton = importutils.try_import("proton") +CYRUS_ENABLED = (pyngus and pyngus.VERSION >= (2, 0, 0) and _proton + and getattr(_proton.SASL, "extended", lambda: False)()) LOG = logging.getLogger(__name__) @@ -354,8 +359,7 @@ class TestAuthentication(test_utils.BaseTestCase): driver.cleanup() -@testtools.skipUnless(pyngus and pyngus.VERSION >= (2, 0, 0), - "pyngus module not present") +@testtools.skipUnless(CYRUS_ENABLED, "Cyrus SASL not supported") class TestCyrusAuthentication(test_utils.BaseTestCase): """Test the driver's Cyrus SASL integration"""