Friday, September 2, 2011

Re: Testing reusable apps

On Fri, Sep 2, 2011 at 9:16 AM, Tomek Paczkowski <tomek@hauru.eu> wrote:
> Hi, I cannot find any good source on how test reusable apps. I poked around
> and found out that people (django-registration, south) tests on blank
> project.
> This seems kind of wrong having to make some outside directory to be able to
> run tests.
> Isn't there any better way?

I think so: I like to use the testing mechanism in
setuptools/distribute and run tests via `python setup.py test`.

Eric Holscher wrote about the approach:
http://ericholscher.com/blog/2009/jun/29/enable-setuppy-test-your-django-apps/.

A good example in some code I've written is
https://github.com/revsys/django-fack. The important parts are in
setup.py, which does::

...
test_suite = "fack._testrunner.runtests",
tests_require = ["mock"],
...

So then fack/_testrunner.py is the test harness itself.

You also might want to check out the tox.ini there too. Tox
(http://tox.rtfd.org/) automates testing against multiple Python
versions (and other types of variable dependencies) and can smooth out
some of the steps in getting quality repeatable testing working.

Jacob

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment