changeset 5919:acfd700770cc

pytest migration: merge TestControllerPytest with BaseTestController There is no need anymore for a separate BaseTestController class. Simplify the code by removing it.
author Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
date Sat, 14 May 2016 21:54:03 +0200
parents 66c40720e7b2
children fed129fb8533
files kallithea/tests/__init__.py
diffstat 1 files changed, 7 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/tests/__init__.py	Sat May 14 21:47:53 2016 +0200
+++ b/kallithea/tests/__init__.py	Sat May 14 21:54:03 2016 +0200
@@ -170,15 +170,19 @@
 
     Session().commit()
 
-class BaseTestController(object):
-    """Base test controller used by pytest and unittest tests controllers."""
+class TestControllerPytest(object):
+    """Pytest-style test controller"""
 
     # Note: pytest base classes cannot have an __init__ method
 
-    def init(self):
+    @pytest.fixture(autouse=True)
+    def app_fixture(self):
+        self.wsgiapp = pylons.test.pylonsapp
+        init_stack(self.wsgiapp.config)
         self.app = TestApp(self.wsgiapp)
         self.maxDiff = None
         self.index_location = config['app_conf']['index_dir']
+        return self.app
 
     def log_user(self, username=TEST_USER_ADMIN_LOGIN,
                  password=TEST_USER_ADMIN_PASS):
@@ -225,14 +229,3 @@
     def checkSessionFlashRegex(self, response, regex, skip=0):
         self.checkSessionFlash(response, regex, skip=skip, _matcher=re.search)
 
-class TestControllerPytest(BaseTestController):
-    """Pytest-style test controller"""
-
-    # Note: pytest base classes cannot have an __init__ method
-
-    @pytest.fixture(autouse=True)
-    def app_fixture(self):
-        self.wsgiapp = pylons.test.pylonsapp
-        init_stack(self.wsgiapp.config)
-        self.init()
-        return self.app