Turbogears2 migration: test suite

Thomas De Schampheleire patrickdepinguin at gmail.com
Wed Mar 16 21:26:49 UTC 2016


Hi Alessandro,

On Tue, Mar 15, 2016 at 10:22 PM, Thomas De Schampheleire
<patrickdepinguin at gmail.com> wrote:
> 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.
>

Just a quick status update: I reorganized the setup call a bit (more
like it was before) and now the database is created once in the
beginning of the test suite again. Then the dummy test succeeds too. I
need to clean up the code a bit before I can send/commit the patch.

Meanwhile I tried running some other tests, and bumped into this error:

____  TestAdminController.test_index ______________
kallithea/tests/functional/test_admin.py:52: in test_index
    self.log_user()
kallithea/tests/__init__.py:212: in log_user
    response = self.app.post(url(controller='login', action='index'),
E   TypeError: url() got an unexpected keyword argument 'controller'


url used to come from pylons and is now tg.url.
Has the signature changed?

Thanks,
Thomas


More information about the kallithea-general mailing list