[Python-modules-commits] [python-cement] 10/13: Skip tests if redis package is not found.

Michael Fladischer fladi at moszumanska.debian.org
Thu Sep 8 08:26:40 UTC 2016


This is an automated email from the git hooks/post-receive script.

fladi pushed a commit to branch master
in repository python-cement.

commit 159c9974debeeca6b640d5615b6d19b46d0050bd
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date:   Mon Jul 18 20:04:09 2016 +0200

    Skip tests if redis package is not found.
---
 tests/ext/redis_tests.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/ext/redis_tests.py b/tests/ext/redis_tests.py
index 6fea662..cc71bda 100644
--- a/tests/ext/redis_tests.py
+++ b/tests/ext/redis_tests.py
@@ -1,18 +1,23 @@
 """Tests for cement.ext.ext_redis."""
 
 import sys
-import redis
 from time import sleep
 from random import random
 from cement.core import handler
 from cement.utils import test
 from cement.utils.misc import init_defaults
 
+try:
+    import redis
+except ImportError:
+    redis = None
 
 class RedisExtTestCase(test.CementTestCase):
 
     def setUp(self):
         super(RedisExtTestCase, self).setUp()
+        if not redis:
+            self.skipTest("No redis module installed")
         self.key = "cement-tests-random-key-%s" % random()
         defaults = init_defaults('tests', 'cache.redis')
         defaults['cache.redis']['host'] = '127.0.0.1'

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-cement.git



More information about the Python-modules-commits mailing list