From bae0505d78227ae026cecc330aab195ed2d3bd91 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl>
Date: Wed, 20 May 2020 17:37:18 +0200
Subject: [PATCH] conditionalize close_future on availability of opentracing

---
 coolamqp/attaches/utils.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/coolamqp/attaches/utils.py b/coolamqp/attaches/utils.py
index 97ae562..603f891 100644
--- a/coolamqp/attaches/utils.py
+++ b/coolamqp/attaches/utils.py
@@ -13,6 +13,11 @@ def close_future(fut: Future, span):  # type: (Future, opentracing.Span) -> Futu
     """
     To be called as a Future callback, means to close the span
     """
+    try:
+        import opentracing
+    except ImportError:
+        return fut
+
     def inner_close(fut):
         exc = fut.exception()
         if exc is not None:
-- 
GitLab