Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenneth Reitz committed Apr 30, 2012
1 parent 3757960 commit 233df5d
Show file tree
Hide file tree
Showing 15 changed files with 2 additions and 255 deletions.
40 changes: 2 additions & 38 deletions bin/steps/django
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 0 additions & 6 deletions bin/test
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ testDetectNotPython() {
assertEquals "1" "${RETURN}"
}

testDetectDjangoWithMultipleRequirements() {
detect "multiple-requirements"
assertCapturedEquals "Python/Django"
assertCapturedSuccess
}


## utils ########################################

Expand Down
Binary file added test/django-1.4-skeleton/haystack/.DS_Store
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
154 changes: 0 additions & 154 deletions test/multiple-requirements/haystack/haystack/settings.py

This file was deleted.

17 changes: 0 additions & 17 deletions test/multiple-requirements/haystack/haystack/urls.py

This file was deleted.

28 changes: 0 additions & 28 deletions test/multiple-requirements/haystack/haystack/wsgi.py

This file was deleted.

10 changes: 0 additions & 10 deletions test/multiple-requirements/haystack/manage.py

This file was deleted.

1 change: 0 additions & 1 deletion test/multiple-requirements/haystack/requirements.txt

This file was deleted.

1 change: 0 additions & 1 deletion test/multiple-requirements/requirements.txt

This file was deleted.

0 comments on commit 233df5d

Please sign in to comment.