Turbogears2 migration: test suite

Thomas De Schampheleire patrickdepinguin at gmail.com
Mon Mar 14 12:41:01 UTC 2016


Hi Alessandro,

On Sun, Mar 13, 2016 at 10:10 PM, Alessandro Molina
<alessandro.molina at gmail.com> wrote:
>
>
> On Wed, Mar 9, 2016 at 8:09 PM, Thomas De Schampheleire
> <patrickdepinguin at gmail.com> wrote:
>>
>> Then I get an error that seems to indicate that the model is not
>> correctly initialized.
>
>
> I suppose you are mentioning the "no such table: permissions" error.
> I faced that too.
>
> As I don't know much about the kallithea testsuite architecture and py.test
> doesn't help as fixtures can come from anywhere, who should be in charge of
> running the websetup and create the database? It seems to me that the issue
> is just the no database is created. I saw a line mentioning setup-app in
> test/__init__.py but it's commented.

I must say that I'm also not very familiar with the setup part of the
test suite.
What I can say:

- originally all setup was done in kallithea/tests/__init__.py
- with the introduction of pytest, a new file
kallithea/tests/conftest.py was added that does some setup. This code
is run by pytest directly. This code has worked fine so far, allowing
to run the test suite with 'py.test' rather than 'nosetests'.

- recently, I have added TestControllerPytest in
kallithea/tests/__init__.py to allow using real pytest features like
fixtures. We are now in a transitional period where some tests are
using the original TestController (unittest-based) and some tests are
using the new TestControllerPytest.
Due to the fact that pytest does not allow test classes to have a
__init__ method, I had to reorganize and partially duplicate some
setup code in kallithea/tests/__init__.py.

We really care mostly about pytest style classes now. In parallel to
the turbogears migration, I am converting the tests to
TestControllerPytest, so soon this will be the only class remaining. I
hope this can be completed too in the near future, so that by the time
we can merge the Turbogears branch all tests are of a single (pytest)
type.

/Thomas


More information about the kallithea-general mailing list