Skip to content
This repository
tree: 3eacb7106d
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 35 lines (28 sloc) 1.553 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
from couchdbkit.ext.django.testrunner import CouchDbKitTestSuiteRunner
from django.test.simple import DjangoTestSuiteRunner
from django.conf import settings
from couchdbkit.ext.django import loading as loading
from couchdbkit.resource import ResourceNotFound
import settingshelper

class HqTestSuiteRunner(CouchDbKitTestSuiteRunner):
    """
A test suite runner for Hq. On top of the couchdb testrunner, also
apply all our monkeypatches to the settings.
To use this, change the settings.py file to read:
TEST_RUNNER = 'Hq.testrunner.HqTestSuiteRunner'
"""
    
    dbs = []
    
    def setup_databases(self, **kwargs):
        returnval = super(HqTestSuiteRunner, self).setup_databases(**kwargs)
        self.newdbname = self.get_test_db_name(settings.COUCH_DATABASE_NAME)
        print "overridding the couch settings!"
        new_db_settings = settingshelper.get_dynamic_db_settings(settings.COUCH_SERVER_ROOT,
                                                                 settings.COUCH_USERNAME,
                                                                 settings.COUCH_PASSWORD,
                                                                 self.newdbname,
                                                                 settings.INSTALLED_APPS)
        settings.COUCH_DATABASE_NAME = self.newdbname
        for (setting, value) in new_db_settings.items():
            setattr(settings, setting, value)
            print "set %s settting to %s" % (setting, value)
        
        return returnval
Something went wrong with that request. Please try again.