Turbogears2 migration: test suite
Alessandro Molina
alessandro.molina at gmail.com
Mon Mar 14 22:39:40 UTC 2016
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
On Mon, Mar 14, 2016 at 1:41 PM, Thomas De Schampheleire <
patrickdepinguin at gmail.com> wrote:
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sfconservancy.org/pipermail/kallithea-general/attachments/20160314/db0d28f3/attachment-0001.html>
More information about the kallithea-general
mailing list