Browse files

Make it possible to run tests.

It still doesn't work if tests use models from the tracdb app.
  • Loading branch information...
1 parent 8a532a4 commit 69e653fe83f2183b21568fe07691356b89929c65 @aaugustin aaugustin committed Feb 7, 2013
Showing with 10 additions and 6 deletions.
  1. +0 −1 TODO
  2. +3 −0 django_www/settings.py
  3. +3 −0 tracdb/db_router.py
  4. +4 −5 tracdb/migrations/0001_initial.py
View
1 TODO
@@ -2,5 +2,4 @@
* finish cleanup of django_website and rename it to something
not starting with django_
* sitemaps look outdated ??? /documentation/0_90/ really?
-* running tests fails because of the second database
* some apps don't have tests
View
3 django_www/settings.py
@@ -183,6 +183,9 @@
# comment_utils settings
AKISMET_API_KEY = "c892e4962244"
+# south settings
+SOUTH_TESTS_MIGRATE = False
+
# setting for documentation root path
DJANGO_DOCUMENT_ROOT_PATH = "/home/html/djangoproject.com/docs/"
DJANGO_TESTS_PATH = "/home/html/djangoproject.com/tests/"
View
3 tracdb/db_router.py
@@ -17,5 +17,8 @@ def db_for_read(self, model, **hints):
def db_for_write(self, model, **hints):
return 'trac' if app_label(model) == THIS_APP else None
+ def allow_syncdb(self, db, model):
+ return False if db == 'trac' else None
+
def app_label(model):
return model._meta.app_label
View
9 tracdb/migrations/0001_initial.py
@@ -17,13 +17,12 @@ def forwards(self, orm):
SELECT "name" || '.' || "version" AS "django_id", *
FROM wiki;''')
- # I have no idea why this is needed, but without it the migration
- # doesn't get committed. This is probably a bug in South?
- # Filed as http://south.aeracode.org/ticket/924.
+ # Work around a limitation of South's support for multiple databases.
+ # See http://south.aeracode.org/ticket/924.
db.execute('COMMIT')
def backwards(self, orm):
db = dbs['trac']
- db.execute('DROP VIEW attachment_django_view;')
- db.execute('DROP VIEW wiki_django_view;')
+ db.execute('DROP VIEW "attachment_django_view";')
+ db.execute('DROP VIEW "wiki_django_view";')
db.execute('COMMMIT')

0 comments on commit 69e653f

Please sign in to comment.