Run tests on multiple Python versions and databases (#424)

* Test against more python versions

* Add testing on MySQL

* Add testing on PostgreSQL
This commit is contained in:
Raphael Michel
2017-03-02 11:59:09 +01:00
committed by GitHub
parent b6f42ecd6d
commit af4a2c7184
6 changed files with 62 additions and 19 deletions
+10
View File
@@ -4,6 +4,16 @@ set -x
echo "Executing job $1"
if [ "$PRETIX_CONFIG_FILE" == "tests/travis_mysql.cfg" ]; then
mysql -u root -e 'CREATE DATABASE pretix DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;'
pip3 install -Ur src/requirements/mysql.txt
fi
if [ "$PRETIX_CONFIG_FILE" == "tests/travis_postgres.cfg" ]; then
psql -c 'create database travis_ci_test;' -U postgres
pip3 install -Ur src/requirements/postgres.txt
fi
if [ "$1" == "style" ]; then
XDG_CACHE_HOME=/cache pip3 install -Ur src/requirements.txt -r src/requirements/dev.txt -r src/requirements/py34.txt
cd src
+33 -10
View File
@@ -1,15 +1,38 @@
language: python
sudo: false
python:
- "3.4"
install:
- pip install -U pip wheel setuptools==28.6.1
- pip install -U pip wheel setuptools==28.6.1
script:
- bash .travis.sh $JOB
- bash .travis.sh $JOB
cache:
directories:
- $HOME/.cache/pip
env:
- JOB=style
- JOB=doctests
- JOB=tests-cov
directories:
- $HOME/.cache/pip
services:
- mysql
- postgresql
matrix:
include:
- python: 3.4
env: JOB=tests PRETIX_CONFIG_FILE=tests/sqlite.cfg
- python: 3.5
env: JOB=tests PRETIX_CONFIG_FILE=tests/sqlite.cfg
- python: 3.6
env: JOB=tests PRETIX_CONFIG_FILE=tests/sqlite.cfg
- python: 3.4
env: JOB=tests PRETIX_CONFIG_FILE=tests/travis_mysql.cfg
- python: 3.5
env: JOB=tests PRETIX_CONFIG_FILE=tests/travis_mysql.cfg
- python: 3.6
env: JOB=tests PRETIX_CONFIG_FILE=tests/travis_mysql.cfg
- python: 3.4
env: JOB=tests PRETIX_CONFIG_FILE=tests/travis_postgres.cfg
- python: 3.5
env: JOB=tests PRETIX_CONFIG_FILE=tests/travis_postgres.cfg
- python: 3.6
env: JOB=tests PRETIX_CONFIG_FILE=tests/travis_postgres.cfg
- python: 3.4
env: JOB=style
- python: 3.4
env: JOB=tests-cov
addons:
postgresql: "9.4"
+5 -2
View File
@@ -10,8 +10,11 @@ from pkg_resources import iter_entry_points
from . import __version__
config = configparser.RawConfigParser()
config.read(['/etc/pretix/pretix.cfg', os.path.expanduser('~/.pretix.cfg'), 'pretix.cfg'],
encoding='utf-8')
if 'PRETIX_CONFIG_FILE' in os.environ:
config.read([os.environ.get('PRETIX_CONFIG_FILE')], encoding='utf-8')
else:
config.read(['/etc/pretix/pretix.cfg', os.path.expanduser('~/.pretix.cfg'), 'pretix.cfg'],
encoding='utf-8')
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
DATA_DIR = config.get('pretix', 'datadir', fallback=os.environ.get('DATA_DIR', 'data'))
+1 -7
View File
@@ -4,6 +4,7 @@ import tempfile
tmpdir = tempfile.TemporaryDirectory()
os.environ.setdefault('DATA_DIR', tmpdir.name)
os.environ.setdefault('PRETIX_CONFIG_FILE', 'test/sqlite.cfg')
from pretix.settings import * # NOQA
@@ -33,10 +34,3 @@ CACHES = {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
}
}
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:'
}
}
+7
View File
@@ -0,0 +1,7 @@
[database]
backend=mysql
name=pretix
user=root
password=
host=127.0.0.1
port=3306
+6
View File
@@ -0,0 +1,6 @@
[database]
backend=postgresql_psycopg2
name=pretix
user=postgres
password=
host=localhost