Skip to content

Commit

Permalink
Enable testing with MySQL and Postgres on Travis-CI
Browse files Browse the repository at this point in the history
Fix Nitrate#169

Signed-off-by: Mr. Senko <atodorov@mrsenko.com>
  • Loading branch information
atodorov committed Mar 23, 2017
1 parent 2528429 commit afe94a0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
14 changes: 13 additions & 1 deletion .travis.yml
@@ -1,8 +1,20 @@
language: python
python:
- "2.7"
env:
- TEST_DB=SQLite
- TEST_DB=MySQL
- TEST_DB=Postgres
services:
- mysql
- postgresql
addons:
- postgresql: '9.5'
before_install:
- pip install coveralls
- mysql -e 'SELECT VERSION();'
- mysql -e 'CREATE DATABASE nitrate_travis CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;'
- psql -c "CREATE DATABASE nitrate_travis ENCODING 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8';" -U postgres
- pip install coveralls psycopg2
install: "pip install -r requirements/devel.txt"
script: make check
after_success:
Expand Down
19 changes: 18 additions & 1 deletion tcms/settings/test.py
@@ -1,16 +1,33 @@
import os
from tcms.settings.devel import *

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '',
'NAME': ':memory:',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}

if 'TRAVIS' in os.environ:
if os.environ.get('TEST_DB').lower() in ['mysql', 'mariadb']:
DATABASES['default'].update({
'ENGINE': 'django.db.backends.mysql',
'NAME': 'nitrate_travis',
'USER': 'travis',
'HOST': '127.0.0.1',
})
elif os.environ.get('TEST_DB').lower() == 'postgres':
DATABASES['default'].update({
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'nitrate_travis',
'USER': 'postgres',
'HOST': 'localhost',
})

LISTENING_MODEL_SIGNAL = False

LOGGING = {
Expand Down

0 comments on commit afe94a0

Please sign in to comment.