diff --git a/kallithea/tests/__init__.py b/kallithea/tests/__init__.py --- a/kallithea/tests/__init__.py +++ b/kallithea/tests/__init__.py @@ -41,7 +41,7 @@ from pylons.util import ContextObj from routes.util import URLGenerator from webtest import TestApp -from nose.plugins.skip import SkipTest +import pytest from kallithea.lib.compat import unittest from kallithea import is_windows @@ -57,9 +57,11 @@ if not is_windows: log = logging.getLogger(__name__) +skipif = pytest.mark.skipif + __all__ = [ - 'parameterized', 'environ', 'url', 'TestController', - 'SkipTest', 'ldap_lib_installed', 'pam_lib_installed', 'BaseTestCase', 'init_stack', + 'skipif', 'parameterized', 'environ', 'url', 'TestController', + 'ldap_lib_installed', 'pam_lib_installed', 'BaseTestCase', 'init_stack', '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_ADMIN_EMAIL', 'TEST_USER_REGULAR_LOGIN', 'TEST_USER_REGULAR_PASS', diff --git a/kallithea/tests/functional/test_admin_auth_settings.py b/kallithea/tests/functional/test_admin_auth_settings.py --- a/kallithea/tests/functional/test_admin_auth_settings.py +++ b/kallithea/tests/functional/test_admin_auth_settings.py @@ -21,10 +21,9 @@ class TestAuthSettingsController(TestCon action='index')) response.mustcontain('Authentication Plugins') + @skipif(not ldap_lib_installed, reason='skipping due to missing ldap lib') def test_ldap_save_settings(self): self.log_user() - if not ldap_lib_installed: - raise SkipTest('skipping due to missing ldap lib') params = self._enable_plugins('kallithea.lib.auth_modules.auth_internal,kallithea.lib.auth_modules.auth_ldap') params.update({'auth_ldap_host': u'dc.example.com', @@ -51,10 +50,9 @@ class TestAuthSettingsController(TestCon self.assertEqual(new_settings['auth_ldap_host'], u'dc.example.com', 'fail db write compare') + @skipif(not ldap_lib_installed, reason='skipping due to missing ldap lib') def test_ldap_error_form_wrong_port_number(self): self.log_user() - if not ldap_lib_installed: - raise SkipTest('skipping due to missing ldap lib') params = self._enable_plugins('kallithea.lib.auth_modules.auth_internal,kallithea.lib.auth_modules.auth_ldap') params.update({'auth_ldap_host': '', @@ -78,10 +76,9 @@ class TestAuthSettingsController(TestCon response.mustcontain("""""" """Please enter a number""") + @skipif(not ldap_lib_installed, reason='skipping due to missing ldap lib') def test_ldap_error_form(self): self.log_user() - if not ldap_lib_installed: - raise SkipTest('skipping due to missing ldap lib') params = self._enable_plugins('kallithea.lib.auth_modules.auth_internal,kallithea.lib.auth_modules.auth_ldap') params.update({'auth_ldap_host': 'Host', @@ -245,12 +242,10 @@ class TestAuthSettingsController(TestCon self.assertEqual(new_settings['auth_crowd_host'], u'hostname', 'fail db write compare') + @skipif(not pam_lib_installed, reason='skipping due to missing pam lib') def test_pam_save_settings(self): self.log_user() - if not pam_lib_installed: - raise SkipTest('skipping due to missing pam lib') - params = self._enable_plugins('kallithea.lib.auth_modules.auth_internal,kallithea.lib.auth_modules.auth_pam') params.update({'auth_pam_service': 'kallithea', 'auth_pam_gecos': '^foo-.*'})