Turbogears2 migration: test suite

Thomas De Schampheleire patrickdepinguin at gmail.com
Wed Mar 9 19:09:56 UTC 2016


Hi Alessandro,

On Wed, Feb 24, 2016 at 2:38 PM, Alessandro Molina
<alessandro.molina at gmail.com> wrote:
>
>
> On Fri, Feb 19, 2016 at 10:20 PM, Thomas De Schampheleire
> <patrickdepinguin at gmail.com> wrote:
>>
>> Currently the test initialization code has
>> some pylons specifics which I don't understand (and thus fail to
>> convert to a Turbogears equivalent).
>>
>> Essentially, the setup code in TestController is:
>>
>>         self.wsgiapp = pylons.test.pylonsapp
>>         init_stack(self.wsgiapp.config)
>>         self.app = TestApp(self.wsgiapp)
>>
>> with init_stack being:
>>
>> def init_stack(config=None):
>
>
> I didn't have time to look at it so far, sorry, but by a quick view of what
> init_stack is doing it looks like it's mostly setting up the Pylons global
> objects even when not inside a request. That should be fairly equivalent to
> performing a request to '/_test_vars' in TurboGears or using
> http://turbogears.readthedocs.org/en/latest/reference/classes.html#tg.util.webtest.test_context
>
> See
> http://turbogears.readthedocs.org/en/latest/turbogears/testing.html#testing-outside-controllers
> it might provide a few useful details.
>

So I've been spending quite some time in trying to get the test suite
working but failed miserably.
I looked at the references you sent, looked at the test suite of an
example tg2 project, and tried to apply the same principles to our
test suite, but I keep getting an error in the application setup.

I created a dummy test that does not use the application itself, to
verify the init code of the test suite, and try to run it with:

$ py.test kallithea/tests/other/test_dummy.py

Then I get an error that seems to indicate that the model is not
correctly initialized.
I tried adding traces to see what's going on, and tried many things,
but could not get it to work.
The fact that we're in a transition from nosetest to pytest does not
really help either. In any case, the first focus is to getting the
TestControllerPytest to work; I hope that soon all tests will be
switched to it.

In a separate mail I am sending the code I was last working with,
along with the full error I'm seeing.
If and when you have some time, could you have a look? Any help in
progressing here is more than welcome!

Thanks,
Thomas


More information about the kallithea-general mailing list