diff kallithea/tests/fixture.py @ 8728:f3fab7b124f2

imports: try to use global imports unless it is a layering violation To minimize the impact, do imports that violate the layering at runtime instead of at import time.
author Mads Kiilerich <mads@kiilerich.com>
date Sun, 01 Nov 2020 06:29:32 +0100
parents f8b092f9e6a3
children 76394eb36b27
line wrap: on
line diff
--- a/kallithea/tests/fixture.py	Fri Oct 30 14:54:42 2020 +0100
+++ b/kallithea/tests/fixture.py	Sun Nov 01 06:29:32 2020 +0100
@@ -27,6 +27,8 @@
 
 from kallithea.lib.auth import AuthUser
 from kallithea.lib.db_manage import DbManage
+from kallithea.lib.indexers.daemon import WhooshIndexingDaemon
+from kallithea.lib.pidlock import DaemonLock
 from kallithea.lib.vcs.backends.base import EmptyChangeset
 from kallithea.model import db, meta
 from kallithea.model.changeset_status import ChangesetStatusModel
@@ -41,6 +43,7 @@
 from kallithea.tests.base import (GIT_REPO, HG_REPO, IP_ADDR, TEST_USER_ADMIN_EMAIL, TEST_USER_ADMIN_LOGIN, TEST_USER_ADMIN_PASS, TEST_USER_REGULAR2_EMAIL,
                                   TEST_USER_REGULAR2_LOGIN, TEST_USER_REGULAR2_PASS, TEST_USER_REGULAR_EMAIL, TEST_USER_REGULAR_LOGIN, TEST_USER_REGULAR_PASS,
                                   TESTS_TMP_PATH, invalidate_all_caches)
+from kallithea.tests.vcs import setup_package
 
 
 log = logging.getLogger(__name__)
@@ -404,7 +407,6 @@
     tar.close()
 
     # LOAD VCS test stuff
-    from kallithea.tests.vcs import setup_package
     setup_package()
 
 
@@ -413,9 +415,6 @@
     Makes default test index
     """
 
-    from kallithea.lib.indexers.daemon import WhooshIndexingDaemon
-    from kallithea.lib.pidlock import DaemonLock
-
     index_location = os.path.join(config['index_dir'])
     if not os.path.exists(index_location):
         os.makedirs(index_location)