[Python-modules-commits] [python-cement] 11/13: Skip tests if pybars 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 fdc13a0fe2adb52ec2a77b4464b13d297251e8f8
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date:   Mon Jul 18 20:04:37 2016 +0200

    Skip tests if pybars package is not found.
---
 tests/ext/handlebars_tests.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/tests/ext/handlebars_tests.py b/tests/ext/handlebars_tests.py
index 91779cd..c81b7fd 100644
--- a/tests/ext/handlebars_tests.py
+++ b/tests/ext/handlebars_tests.py
@@ -6,6 +6,11 @@ from cement.core import exc, foundation, handler, backend, controller
 from cement.utils import test
 from nose.plugins.attrib import attr
 
+try:
+    import pybars
+except ImportError:
+    pybars = None
+
 class HandlebarsTestApp(test.TestApp):
     class Meta:
         extensions = ['handlebars']
@@ -14,11 +19,15 @@ class HandlebarsTestApp(test.TestApp):
         template_dirs = []
         handlebars_helpers = {}
         handlebars_partials = ['test_partial_template.handlebars']
-        
- at attr('ext_handlebars')        
+
+ at attr('ext_handlebars')
 class HandlebarsExtTestCase(test.CementExtTestCase):
     app_class = HandlebarsTestApp
 
+    def setUp(self):
+        if not pybars:
+            self.skipTest("No pybars module installed")
+
     def test_handlebars(self):
         self.app.setup()
         rando = random.random()

-- 
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