diff rhodecode/tests/__init__.py @ 3674:ff2ea58debb5 beta

fixed ldap tests when ldap lib is installed
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 04 Apr 2013 18:31:15 +0200
parents 8a86836fad64
children 3563bb7b4b82 d7488551578e
line wrap: on
line diff
--- a/rhodecode/tests/__init__.py	Thu Apr 04 17:49:03 2013 +0200
+++ b/rhodecode/tests/__init__.py	Thu Apr 04 18:31:15 2013 +0200
@@ -52,7 +52,7 @@
 
 __all__ = [
     'parameterized', 'environ', 'url', 'get_new_dir', 'TestController',
-    'SkipTest',
+    'SkipTest', 'ldap_lib_installed',
     'TESTS_TMP_PATH', 'HG_REPO', 'GIT_REPO', 'NEW_HG_REPO', 'NEW_GIT_REPO',
     'HG_FORK', 'GIT_FORK', 'TEST_USER_ADMIN_LOGIN', 'TEST_USER_ADMIN_PASS',
     'TEST_USER_REGULAR_LOGIN', 'TEST_USER_REGULAR_PASS',
@@ -117,6 +117,15 @@
 GIT_REMOTE_REPO = jn(TESTS_TMP_PATH, GIT_REPO)
 HG_REMOTE_REPO = jn(TESTS_TMP_PATH, HG_REPO)
 
+#skip ldap tests if LDAP lib is not installed
+ldap_lib_installed = False
+try:
+    import ldap
+    ldap_lib_installed = True
+except ImportError:
+    # means that python-ldap is not installed
+    pass
+
 
 def get_new_dir(title):
     """