Skip to content

Commit

Permalink
Fix tests for Django 2.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
lefterisnik committed Dec 27, 2017
1 parent bca6581 commit e6b8b29
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ env:
# install dependencies
install:
- pip install -r requirements-debug.txt
- pip install Django==$DJANGO_VERSION
- |
if [[ $DJANGO_VERSION =~ ^2.*$ && $TRAVIS_PYTHON_VERSION == "2.7" ]]; then
echo "Installing Django 2 in python 2 will fail. Keep the installed one"
else
pip install Django==$DJANGO_VERSION
fi
# print pip packages
before_script:
Expand Down
13 changes: 12 additions & 1 deletion tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,24 @@
'tests.test_app'
]

# For version of Django smaller than 1.10
MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

# For versions of Django bigger or equal than 1.10
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
Expand Down

0 comments on commit e6b8b29

Please sign in to comment.