Skip to content

Instantly share code, notes, and snippets.

@ndarville
Created November 30, 2012 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ndarville/4175514 to your computer and use it in GitHub Desktop.
Save ndarville/4175514 to your computer and use it in GitHub Desktop.
Testing the order of your installed Django apps
from django.conf import settings
from django_nose import FastFixtureTestCase as TestCase
def get_apps():
apps = {}
for i, app in enumerate(settings.INSTALLED_APPS):
apps[app] = i
return apps
class AppOrderTest(TestCase):
"""Ensures the apps are in the order as required by their authors."""
def test_forum(self):
"""'forum' goes at the beginning cf.
https://github.com/ndarville/pony-forum/issues/60.
"""
apps = get_apps()
if 'forum' in apps:
self.assertEquals(apps['forum'], 0)
def test_django_nose(self):
"""'django_nose' comes after 'South' cf.
https://github.com/jbalogh/django-nose/blob/master/README.rst#using-with-south.
"""
apps = get_apps()
if 'django_nose' in apps and 'South' in apps:
self.assertTrue(apps['django_nose'] > apps['South'])
def test_django_admin_bootstrapped(self):
"""'django_admin_bootstrapped comes before 'django.contrib.admin' cf.
https://github.com/riccardo-forina/django-admin-bootstrapped/blob/master/README.md.
"""
apps = get_apps()
if 'django_admin_bootstrapped' and 'django.contrib.admin' in apps:
self.assertTrue(apps['django_admin_bootstrapped'] < apps['django.contrib.admin'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment