Testing reusable apps

199 views
Skip to first unread message

Tomek Paczkowski

unread,
Sep 2, 2011, 10:16:32 AM9/2/11
to django...@googlegroups.com
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?

Jacob Kaplan-Moss

unread,
Sep 2, 2011, 11:19:50 AM9/2/11
to django...@googlegroups.com

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

Reply all
Reply to author
Forward
0 new messages