What versions of python are you aiming at? Is Arches still trying to maintain compatibility with 2.6? And is python 3 compatibility wanted? Might influence your choice of testing framework.
If you're trying to maintain compatibility with 2.6, look into the unittest2 library. I believe it brings python 2.6's unittest module up to the level of python 2.7's library. I've never used py.test but it looks rather nice. We normally use the standard unittest library, nose as a testrunner and coverage for the coverage report. I believe nose can also run py.test tests. And py.test seems to be able to run nose test suites. So, it all seems to be rather connected. When constructing your testsuite, it's a good idea to try and write as many unit tests as possible without needing a database. These can run a whole lot faster than unit tests requiring a database. Normally your testdatabase will be constructed and torn down for every single unit test. As soon as your database is anything non-trivial, this slows your testsuite down to a crawl. We currently solved this in one of our applications by only setting up and tearing down the database once per testsuite. This is using the Pyramid framework (not Django). What we did, was to setup the database at the beginning of the module, start a database transaction, run the unit test, rollback the transaction, start a new transaction, run the second test, rollback the transaction, etc... At the end of the module, the entire database is torn down. The next module does the same thing. The inspiration for this came from this blog post: http://sontek.net/blog/detail/writing-tests-for-pyramid-and-sqlalchemy. It's about Pyramid (and uses py.test), but I think the principal should be applicable to other frameworks as well. Django might have something for this as well. Cheers, Koen Koen Van Daele Applicatiebeheerder M +32 (0)499 94 93 68 | T +32 (0)2 553 16 82 Van: archesproject@googlegroups.com [mailto:archesproject@googlegroups.com] Namens Tharindu Rusira Verzonden: dinsdag 18 maart 2014 8:46 Aan: Alexei Peters CC: archesproject@googlegroups.com Onderwerp: Re: [Arches] Test suite in Arches On Tue, Mar 18, 2014 at 12:25 PM, Alexei Peters <apet...@fargeo.com<mailto:apet...@fargeo.com>> wrote: Hi Tharindu, It looks like PyUnit is in fact the unittest module in python (from their docs, 'Unless you're stuck in the year 2000, PyUnit is in your Python standard library as module unittest.') Yes, they are both the same. I also just saw this: https://pypi.python.org/pypi/pytest-django/ One thing caught my eye when they describe the advantages of pytest which was "Database re-use: no need to re-create the test database for every test run." That may be something we might have to look out for. Interesting. I have not worked with py.test yet. The documentation is pretty convincing but I think we better have a look at these[1][2] comparisons as well. (Also note that these discussions are quite old and probably obsolete). Also, I found[3][4][5] to be very comprehensive articles on Python testing frameworks. So this might be a good starting point to decide where we will be going with our testing work-flow. [1] http://stackoverflow.com/questions/191673/preferred-python-unit-testing-framework [2] http://bytes.com/topic/python/answers/43330-unittest-vs-py-test [3] http://pythontesting.net/framework/pytest/pytest-introduction/ [4] http://halfcooked.com/presentations/pyconau2013/why_I_use_pytest.html [5] http://pydanny.com/pytest-no-boilerplate-testing.html Thanks, -Tharindu. Anyway, we have options. Cheers, Alexei Director of Web Development - Farallon Geographics, Inc. - 971.227.3173 On Mon, Mar 17, 2014 at 11:38 PM, Tharindu Rusira <tharindurus...@gmail.com<mailto:tharindurus...@gmail.com>> wrote: On Tue, Mar 18, 2014 at 11:59 AM, Alexei Peters <apet...@fargeo.com<mailto:apet...@fargeo.com>> wrote: Hi Tharindu, Django uses the builtin unittest module. It would be nice to use that if possible. Of course it's possible, Alexei. I think that would be a better approach to use this native unittest module. Thanks, -Tharindu https://docs.djangoproject.com/en/dev/topics/testing/ Cheers, Alexei Director of Web Development - Farallon Geographics, Inc. - 971.227.3173<tel:971.227.3173> On Mon, Mar 17, 2014 at 10:05 PM, Tharindu Rusira <tharindurus...@gmail.com<mailto:tharindurus...@gmail.com>> wrote: Thanks Alexei, In my gsoc project I'm planning to write unit tests using PyUnit[1]. So I wanted to know whether PyUnit framework is fine or we have a project specific test mechanism. [1] http://pyunit.sourceforge.net Regards, On Mar 18, 2014 10:05 AM, "Alexei Peters" <apet...@fargeo.com<mailto:apet...@fargeo.com>> wrote: Hi Tharindu, At the moment we don't have any automated test routines. That's why we have project "Integrate a build/ci server and automated unit tests into the Arches dev environment". It would be lovely to have that! Cheers, Alexei Director of Web Development - Farallon Geographics, Inc. - 971.227.3173<tel:971.227.3173> On Mon, Mar 17, 2014 at 8:39 PM, Tharindu Rusira <tharindurus...@gmail.com<mailto:tharindurus...@gmail.com>> wrote: Hi everyone, I would like to know the current level of code coverage in Arches. I browsed through Arches source code in bitbucket[1] but I could not find any test cases. [1] https://bitbucket.org/arches/arches Thanks, -- M.P. Tharindu Rusira Kumara Department of Computer Science and Engineering, University of Moratuwa, Sri Lanka. +94757033733<tel:%2B94757033733> www.tharindu-rusira.blogspot.com<http://www.tharindu-rusira.blogspot.com> -- -- To post, send email to archesproject@googlegroups.com<mailto:archesproject@googlegroups.com>. To unsubscribe, send email to archesproject+unsubscr...@googlegroups.com<mailto:archesproject%2bunsubscr...@googlegroups.com>. For more information, visit https://groups.google.com/d/forum/archesproject?hl=en --- You received this message because you are subscribed to the Google Groups "Arches Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to archesproject+unsubscr...@googlegroups.com<mailto:archesproject+unsubscr...@googlegroups.com>. For more options, visit https://groups.google.com/d/optout. -- M.P. Tharindu Rusira Kumara Department of Computer Science and Engineering, University of Moratuwa, Sri Lanka. +94757033733<tel:%2B94757033733> www.tharindu-rusira.blogspot.com<http://www.tharindu-rusira.blogspot.com> -- M.P. Tharindu Rusira Kumara Department of Computer Science and Engineering, University of Moratuwa, Sri Lanka. +94757033733 www.tharindu-rusira.blogspot.com<http://www.tharindu-rusira.blogspot.com> -- -- To post, send email to archesproject@googlegroups.com<mailto:archesproject@googlegroups.com>. To unsubscribe, send email to archesproject+unsubscr...@googlegroups.com<mailto:archesproject+unsubscr...@googlegroups.com>. For more information, visit https://groups.google.com/d/forum/archesproject?hl=en --- You received this message because you are subscribed to the Google Groups "Arches Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to archesproject+unsubscr...@googlegroups.com<mailto:archesproject+unsubscr...@googlegroups.com>. For more options, visit https://groups.google.com/d/optout. -- -- To post, send email to archesproject@googlegroups.com. To unsubscribe, send email to archesproject+unsubscr...@googlegroups.com. For more information, visit https://groups.google.com/d/forum/archesproject?hl=en --- You received this message because you are subscribed to the Google Groups "Arches Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to archesproject+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.