Turbogears2 migration: test suite
Thomas De Schampheleire
patrickdepinguin at gmail.com
Tue Mar 15 21:22:29 UTC 2016
Hi Alessandro,
On Mon, Mar 14, 2016 at 11:39 PM, Alessandro Molina
<alessandro.molina at gmail.com> wrote:
> ok, not sure this is the way it should work, but now py.test
> kallithea/tests/other/test_dummy.py behave like expected.
>
>
> I used create_test_env to properly setup the test environment and test DB:
>
> https://bitbucket.org/_amol_/kallithea-tg/src/21ba202099994a4a55dd7744469b47e1d223b478/kallithea/tests/__init__.py?fileviewer=file-view-default#__init__.py-163
>
> Note that on my pc I had to comment some lines of create_test_env as it was
> failing due to file permissions, not sure this is only my problem:
>
> https://bitbucket.org/_amol_/kallithea-tg/src/21ba202099994a4a55dd7744469b47e1d223b478/kallithea/lib/utils.py?fileviewer=file-view-default#utils.py-717:732
Thanks for looking into this. I can indeed run dummy_test now.
First observation however is that the database setup code is now run
at every test, while previously it was done once for the entire test
suite. I guess this is just a matter of moving the calls to the right
place.
(we know that it would be better to start with a fresh database each
time, but it takes a lot of time; we need to optimize this later).
Based on your commit, I think I now understand better the problem: in
pylons-based Kallithea, create_test_env was run from the
load_environment call, see
https://bitbucket.org/conservancy/kallithea/src/35508e2d755770b8ecfb25f72d218c3b837df9be/kallithea/config/environment.py?at=default&fileviewer=file-view-default#environment.py-105
This call has been removed with the current turbogears migration code.
Therefore, I think that to mimic the original behavior, we should fit
the call to create_test_env at approximately the same place in the
turbogears flow, I assume in setup_configuration in app_cfg.py.
Does this sound right to you?
I also assume that this would solve the first point above.
Thanks,
Thomas
More information about the kallithea-general
mailing list