<p dir="ltr"></p>
<p dir="ltr">On Sep 25, 2016 12:17 AM, "Mads Kiilerich" <<a href="mailto:mads@kiilerich.com">mads@kiilerich.com</a>> wrote:<br>
><br>
> On 09/23/2016 09:42 PM, Thomas De Schampheleire wrote:<br>
>><br>
>> After rebasing the tg2 branch onto recent Kallithea default, more<br>
>> particularly onto something containing this commit:<br>
>><br>
>> o  6613 8d98924c58b1 default  2016-09-18 Thomas De Schampheleire<br>
>> tests: add as little code as possible in __init__.py<br>
>><br>
>> I can no longer successfully start the test suite.<br>
>> I get an import error: "cannot import name meta", which refers to some<br>
>> import of kallithea.model.meta.<br>
><br>
><br>
> The error goes like:<br>
><br>
> E     File "/home/madski/kallithea-tg2/kallithea/tests/conftest.py", line 12, in <module><br>
> E       from kallithea.model.user import UserModel<br>
> E     File "/home/madski/kallithea-tg2/kallithea/model/__init__.py", line 48, in <module><br>
> E       from kallithea.model import meta<br>
> E     File "/home/madski/kallithea-tg2/kallithea/model/meta.py", line 21, in <module><br>
> E       from kallithea.lib import caching_query<br>
> E     File "/home/madski/kallithea-tg2/kallithea/lib/__init__.py", line 27, in <module><br>
> E       from . import helpers<br>
> E     File "/home/madski/kallithea-tg2/kallithea/lib/helpers.py", line 56, in <module><br>
> E       from kallithea.lib.utils import repo_name_slug, get_custom_lexer<br>
> E     File "/home/madski/kallithea-tg2/kallithea/lib/utils.py", line 50, in <module><br>
> E       from kallithea.model import meta<br>
><br>
> So again, we have a recursive dependency. Random changes can influence whether that works or not.<br>
><br>
> Removing more imports from __init__ would be a good start ... though not necessarily sufficient to remove recursive imports.<br>
><br>
> A stupid workaround (and some fixes to merge conflicts):<br>
><br>
> diff --git a/kallithea/tests/conftest.py b/kallithea/tests/conftest.py<br>
> --- a/kallithea/tests/conftest.py<br>
> +++ b/kallithea/tests/conftest.py<br>
> @@ -11,2 +11,3 @@ from tg.util.webtest import test_context<br>
>  import pytest<br>
> +import kallithea.lib.helpers # HACK to workaround recursive imports ...<br>
>  from kallithea.model.user import UserModel<br>
> diff --git a/kallithea/config/app_cfg.py b/kallithea/config/app_cfg.py<br>
> --- a/kallithea/config/app_cfg.py<br>
> +++ b/kallithea/config/app_cfg.py<br>
> @@ -128,3 +128,3 @@ def setup_configuration(app):<br>
>          from kallithea.lib.utils import create_test_env, create_test_index<br>
> -        from kallithea.tests import TESTS_TMP_PATH<br>
> +        from kallithea.tests.base import TESTS_TMP_PATH<br>
>          #set KALLITHEA_NO_TMP_PATH=1 to disable re-creating the database and<br>
> @@ -137,4 +137,2 @@ def setup_configuration(app):<br>
><br>
> -    DbManage.check_waitress()<br>
> -<br>
>      set_available_permissions(config)<br>
></p>
<p dir="ltr">Also : thanks a lot for looking into it !<br><br></p>