Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting rid of empty models.py in django testsuite

I have two pure service apps, that act as servant to my core models. Hence, they do not have any own models.

While the testsuite for the first service runs fine, the second throws the following error:

django.core.exceptions.ImproperlyConfigured: 
App with label location is missing a models.py module. 

If I add an empty models.py, the suite runs fine.

I can't spot a difference in terms of architecture / structure between the apps. But I want to get rid of the empty, unneeded models.py.

How would I do that?

like image 873
shredding Avatar asked Mar 04 '13 13:03

shredding


1 Answers

Update: What you ask is now possible. With Django 1.7 you no longer need a models.py file. -release notes

Previously: Django testing requires every app to have a models.py file. It's okay to leave it empty (or with a helpful comment!). Ticket discussion on the matter of apps without models. Direct from the code (added in 1.4/still in 1.5):

the test runner won't currently load a test module with no models.py file

like image 62
JCotton Avatar answered Oct 17 '22 08:10

JCotton