<div dir="ltr">ok, not sure this is the way it should work, but now py.test kallithea/tests/other/test_dummy.py behave like expected.<div><br></div><div><br></div><div>I used create_test_env to properly setup the test environment and test DB:</div><div><br></div><div><a href="https://bitbucket.org/_amol_/kallithea-tg/src/21ba202099994a4a55dd7744469b47e1d223b478/kallithea/tests/__init__.py?fileviewer=file-view-default#__init__.py-163">https://bitbucket.org/_amol_/kallithea-tg/src/21ba202099994a4a55dd7744469b47e1d223b478/kallithea/tests/__init__.py?fileviewer=file-view-default#__init__.py-163</a><br></div><div><br></div><div>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:</div><div><br></div><div><a href="https://bitbucket.org/_amol_/kallithea-tg/src/21ba202099994a4a55dd7744469b47e1d223b478/kallithea/lib/utils.py?fileviewer=file-view-default#utils.py-717:732">https://bitbucket.org/_amol_/kallithea-tg/src/21ba202099994a4a55dd7744469b47e1d223b478/kallithea/lib/utils.py?fileviewer=file-view-default#utils.py-717:732</a><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 14, 2016 at 1:41 PM, Thomas De Schampheleire <span dir="ltr"><<a href="mailto:patrickdepinguin@gmail.com" target="_blank">patrickdepinguin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Alessandro,<br>
<div><div class="h5"><br>
On Sun, Mar 13, 2016 at 10:10 PM, Alessandro Molina<br>
<<a href="mailto:alessandro.molina@gmail.com">alessandro.molina@gmail.com</a>> wrote:<br>
><br>
><br>
> On Wed, Mar 9, 2016 at 8:09 PM, Thomas De Schampheleire<br>
> <<a href="mailto:patrickdepinguin@gmail.com">patrickdepinguin@gmail.com</a>> wrote:<br>
>><br>
>> Then I get an error that seems to indicate that the model is not<br>
>> correctly initialized.<br>
><br>
><br>
> I suppose you are mentioning the "no such table: permissions" error.<br>
> I faced that too.<br>
><br>
> As I don't know much about the kallithea testsuite architecture and py.test<br>
> doesn't help as fixtures can come from anywhere, who should be in charge of<br>
> running the websetup and create the database? It seems to me that the issue<br>
> is just the no database is created. I saw a line mentioning setup-app in<br>
> test/__init__.py but it's commented.<br>
<br>
</div></div>I must say that I'm also not very familiar with the setup part of the<br>
test suite.<br>
What I can say:<br>
<br>
- originally all setup was done in kallithea/tests/__init__.py<br>
- with the introduction of pytest, a new file<br>
kallithea/tests/conftest.py was added that does some setup. This code<br>
is run by pytest directly. This code has worked fine so far, allowing<br>
to run the test suite with 'py.test' rather than 'nosetests'.<br>
<br>
- recently, I have added TestControllerPytest in<br>
kallithea/tests/__init__.py to allow using real pytest features like<br>
fixtures. We are now in a transitional period where some tests are<br>
using the original TestController (unittest-based) and some tests are<br>
using the new TestControllerPytest.<br>
Due to the fact that pytest does not allow test classes to have a<br>
__init__ method, I had to reorganize and partially duplicate some<br>
setup code in kallithea/tests/__init__.py.<br>
<br>
We really care mostly about pytest style classes now. In parallel to<br>
the turbogears migration, I am converting the tests to<br>
TestControllerPytest, so soon this will be the only class remaining. I<br>
hope this can be completed too in the near future, so that by the time<br>
we can merge the Turbogears branch all tests are of a single (pytest)<br>
type.<br>
<span class="HOEnZb"><font color="#888888"><br>
/Thomas<br>
</font></span></blockquote></div><br></div>