Testing a Django library

38 views
Skip to first unread message

th...@copperleaf.com

unread,
Mar 20, 2017, 6:38:41 PM3/20/17
to Django users
I am working on a Django library (which will be packaged) and want to set up testing for it. Looking at a number of existing Django libraries, here seem to be a number of ways to set up testing, and all of them are different.

Are there any best practices? Is there a guide that specifies how it should be done?

T

bobhaugen

unread,
Mar 21, 2017, 3:59:31 PM3/21/17
to Django users
Very interesting topic. We will be facing the same problem soon, and will hope to learn from your experience. Got a code repository yet?
If and when we have some good answers, I'll report back here.

Avraham Serour

unread,
Mar 21, 2017, 4:04:16 PM3/21/17
to django-users
What are the different approaches you found?

I created a simple minimal project inside the tests folder


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/abec25d4-6f05-4749-ac12-9d350d5ce8ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jani Tiainen

unread,
Mar 22, 2017, 2:22:33 AM3/22/17
to django...@googlegroups.com

Hi,

Tox is quite neat test wrapper makes which easy to test code against multiple versions of Python and Django.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

For more options, visit https://groups.google.com/d/optout.

-- 
Jani Tiainen

Josh Crompton

unread,
Mar 24, 2017, 12:35:38 AM3/24/17
to Django users
There's no Django community standard of which I'm aware for doing this.

There *is* a standard way to run tests for Python projects which use setuptools (which yours should do if you want people to be able to `pip install` it) [1].

 I usually do something like this blog post describes [2]. Or, you could use this cookie cutter template [3] if you don't want to set it up manually yourself. It's probably the closest thing you'll find to a "standard".

[1] http://peak.telecommunity.com/DevCenter/setuptools#test
[2] http://joebergantine.com/blog/2015/dec/03/test-reusable-django-application-support-multiple-/
[3] https://github.com/pydanny/cookiecutter-djangopackage
Reply all
Reply to author
Forward
0 new messages