Django tests and app naming

(Originally posted August 9, 2013)

I was working on a little messaging app for a Django site and I had a little error when performing tests. I had named the app “messages” considering that was the function performed. Well Django also has a built in app named “messages as well. This app allows for messages to be sent to users notifying them of site updates and things like. Not the same functionality as what I was building. So when I wanted to run the tests on my messaging app,

$ python test messages

Django picked their built in app to run the tests agains, all of which took way longer than my app’s tests should have.

The fix for this is really easy, just make sure that Django’s messaging app is listed below the custom app since Django’s module stops when it finds a name match. This actually brings up a better point that you should probably just avoid duplicate names in the first place.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s