fix tests

This commit is contained in:
Kenneth Reitz
2012-04-30 13:53:05 -04:00
parent 375796063b
commit 233df5d59d
15 changed files with 2 additions and 255 deletions
+2 -38
View File
@@ -21,50 +21,14 @@ fi
echo "-----> Injecting Django settings..."
SETTINGS_FILE=$(find . -maxdepth 3 -type f -name 'settings.py' | head -1)
SETTINGS_FILE=$(find . -maxdepth 2 -type f -name 'settings.py' | head -1)
PROJECT=$(dirname $SETTINGS_FILE)
echo "Injecting code into $SETTINGS_FILE to read from DATABASE_URL" | indent
cat >>$SETTINGS_FILE <<EOF
import os
import sys
import urlparse
# Register database schemes in URLs.
urlparse.uses_netloc.append('postgres')
urlparse.uses_netloc.append('mysql')
try:
# Check to make sure DATABASES is set in settings.py file.
# If not default to {}
if 'DATABASES' not in locals():
DATABASES = {}
if 'DATABASE_URL' in os.environ:
url = urlparse.urlparse(os.environ['DATABASE_URL'])
# Ensure default database exists.
DATABASES['default'] = DATABASES.get('default', {})
# Update with environment configuration.
DATABASES['default'].update({
'NAME': url.path[1:],
'USER': url.username,
'PASSWORD': url.password,
'HOST': url.hostname,
'PORT': url.port,
})
if url.scheme == 'postgres':
DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2'
if url.scheme == 'mysql':
DATABASES['default']['ENGINE'] = 'django.db.backends.mysql'
except Exception:
print 'Unexpected error:', sys.exc_info()
import dj_database_url
EOF
-6
View File
@@ -56,12 +56,6 @@ testDetectNotPython() {
assertEquals "1" "${RETURN}"
}
testDetectDjangoWithMultipleRequirements() {
detect "multiple-requirements"
assertCapturedEquals "Python/Django"
assertCapturedSuccess
}
## utils ########################################