Skip to content

Commit b087a83

Browse files
committed
Merge branch 'feature/multi-db-tests' into develop
2 parents 1a7e248 + 927c61a commit b087a83

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

.travis.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,33 @@ python:
77
env:
88
- DJANGO=1.7
99
- DJANGO=1.8
10+
- DATABASE_ENGINE=sqlite
11+
- DATABASE_ENGINE=postgres
12+
- DATABASE_ENGINE=mysql
1013
matrix:
14+
exclude:
15+
- python: 3.2
16+
env: DATABASE_ENGINE=mysql
17+
- python: 3.3
18+
env: DATABASE_ENGINE=mysql
19+
- python: 3.4
20+
env: DATABASE_ENGINE=mysql
1121
fast_finish: true
1222
install:
1323
- pip install -U setuptools
1424
- python bootstrap.py
1525
- ./bin/buildout versions:django=$DJANGO
26+
- sh -c "if [ '$DATABASE_ENGINE' = 'postgres' ];
27+
then
28+
pip install psycopg2;
29+
psql -c 'create database tagging;' -U postgres;
30+
fi"
31+
- sh -c "if [ '$DATABASE_ENGINE' = 'mysql' ];
32+
then
33+
pip install mysql-python;
34+
mysql -e 'create database tagging CHARACTER SET utf8 COLLATE utf8_general_ci;';
35+
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql;
36+
fi"
1637
before_script:
1738
- ./bin/flake8 tagging
1839
script:

tagging/tests/settings.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests settings"""
2+
import os
23

34
SECRET_KEY = 'secret-key'
45

@@ -9,6 +10,26 @@
910
}
1011
}
1112

13+
DATABASE_ENGINE = os.environ.get('DATABASE_ENGINE')
14+
if DATABASE_ENGINE == 'postgres':
15+
DATABASES = {
16+
'default': {
17+
'ENGINE': 'django.db.backends.postgresql_psycopg2',
18+
'NAME': 'tagging',
19+
'USER': 'postgres',
20+
'HOST': 'localhost'
21+
}
22+
}
23+
elif DATABASE_ENGINE == 'mysql':
24+
DATABASES = {
25+
'default': {
26+
'ENGINE': 'django.db.backends.mysql',
27+
'NAME': 'zinnia',
28+
'USER': 'root',
29+
'HOST': 'localhost'
30+
}
31+
}
32+
1233
INSTALLED_APPS = [
1334
'django.contrib.auth',
1435
'django.contrib.sessions',

tagging/tests/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""
22
Tests utils for tagging.
33
"""
4-
54
from django.template.loader import BaseLoader
65

6+
77
class VoidLoader(BaseLoader):
88
"""
99
Template loader which is always returning

0 commit comments

Comments
 (0)