3 from django
.conf
import settings
5 from couchdbkit
import Database
6 from couchdbkit
.loaders
import FileSystemDocsLoader
7 from couchdbkit
.ext
.django
.testrunner
import CouchDbKitTestSuiteRunner
9 from mygpo
.db
.couchdb
.utils
import sync_design_docs
13 # http://djangosnippets.org/snippets/2211/
15 class MygpoTestSuiteRunner(CouchDbKitTestSuiteRunner
):
17 Test runner that is able to skip some tests according to settings.py
20 def __init__(self
, *args
, **kwargs
):
21 self
.EXCLUDED_APPS
= getattr(settings
, 'TEST_EXCLUDE', [])
22 settings
.TESTING
= True
23 super(MygpoTestSuiteRunner
, self
).__init
__(*args
, **kwargs
)
26 def setup_databases(self
, **kwargs
):
27 ret
= super(MygpoTestSuiteRunner
, self
).setup_databases(**kwargs
)
32 def build_suite(self
, *args
, **kwargs
):
33 suite
= super(MygpoTestSuiteRunner
, self
).build_suite(*args
, **kwargs
)
34 if not args
[0] and not getattr(settings
, 'RUN_ALL_TESTS', False):
37 pkg
= case
.__class
__.__module
__.split('.')[0]
38 if pkg
not in self
.EXCLUDED_APPS
:
44 def create_auth_string(username
, password
):
46 credentials
= base64
.encodestring("%s:%s" % (username
, password
)).rstrip()
47 auth_string
= 'Basic %s' % credentials