Changeset - 68ac6055d4b2
[Not reviewed]
default
0 1 0
Thomas De Schampheleire - 10 years ago 2016-05-14 21:27:12
thomas.de.schampheleire@gmail.com
pytest migration: remove original TestController and BaseTestCase

Since all tests have been migrated to TestControllerPytest, we can remove
these classes.
1 file changed with 2 insertions and 17 deletions:
0 comments (0 inline, 0 general)
kallithea/tests/__init__.py
Show inline comments
 
@@ -58,14 +58,14 @@ if not is_windows:
 
log = logging.getLogger(__name__)
 

	
 
skipif = pytest.mark.skipif
 
parametrize = pytest.mark.parametrize
 

	
 
__all__ = [
 
    'skipif', 'parametrize', 'parameterized', 'environ', 'url', 'TestController', 'TestControllerPytest',
 
    'ldap_lib_installed', 'pam_lib_installed', 'BaseTestCase', 'init_stack',
 
    'skipif', 'parametrize', 'parameterized', 'environ', 'url', 'TestControllerPytest',
 
    'ldap_lib_installed', 'pam_lib_installed', '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',
 
    'TEST_USER_REGULAR_EMAIL', 'TEST_USER_REGULAR2_LOGIN',
 
    'TEST_USER_REGULAR2_PASS', 'TEST_USER_REGULAR2_EMAIL', 'TEST_HG_REPO',
 
    'TEST_HG_REPO_CLONE', 'TEST_HG_REPO_PULL', 'TEST_GIT_REPO',
 
@@ -167,20 +167,12 @@ def remove_all_notifications():
 
    # Because query().delete() does not (by default) trigger cascades.
 
    # http://docs.sqlalchemy.org/en/rel_0_7/orm/collections.html#passive-deletes
 
    UserNotification.query().delete()
 

	
 
    Session().commit()
 

	
 
class BaseTestCase(unittest.TestCase):
 
    """Unittest-style base test case. Deprecated in favor of pytest style."""
 

	
 
    def __init__(self, *args, **kwargs):
 
        self.wsgiapp = pylons.test.pylonsapp
 
        init_stack(self.wsgiapp.config)
 
        unittest.TestCase.__init__(self, *args, **kwargs)
 

	
 
class BaseTestController(object):
 
    """Base test controller used by pytest and unittest tests controllers."""
 

	
 
    # Note: pytest base classes cannot have an __init__ method
 

	
 
    def init(self):
 
@@ -230,19 +222,12 @@ class BaseTestController(object):
 
                           (msg, skip,
 
                            ', '.join('`%s`' % m for level, m in response.session['flash']))))
 

	
 
    def checkSessionFlashRegex(self, response, regex, skip=0):
 
        self.checkSessionFlash(response, regex, skip=skip, _matcher=re.search)
 

	
 
class TestController(BaseTestCase, BaseTestController):
 
    """Deprecated unittest-style test controller"""
 

	
 
    def __init__(self, *args, **kwargs):
 
        super(TestController, self).__init__(*args, **kwargs)
 
        self.init()
 

	
 
class TestControllerPytest(BaseTestController):
 
    """Pytest-style test controller"""
 

	
 
    # Note: pytest base classes cannot have an __init__ method
 

	
 
    @pytest.fixture(autouse=True)
0 comments (0 inline, 0 general)