Enable CI builds with postgresql and mysql

This commit is contained in:
Baptiste Jonglez 2020-05-24 14:15:34 +02:00
parent 9db9a7b725
commit a8702dae96
4 changed files with 18 additions and 1 deletions

View file

@ -5,8 +5,18 @@ python:
- "3.7"
- "3.8"
- "3.9"
env:
- TESTING_SQLALCHEMY_DATABASE_URI='sqlite:///budget.db'
- TESTING_SQLALCHEMY_DATABASE_URI='postgresql+psycopg2://postgres:@localhost/travis_ci_test'
- TESTING_SQLALCHEMY_DATABASE_URI='mysql+pymysql://travis:@localhost/travis_ci_test'
before_script:
- psql -c 'create database travis_ci_test;' -U postgres
- mysql -e 'CREATE DATABASE travis_ci_test;'
script: tox
before_install:
- python -m pip install --upgrade pip virtualenv
install:
- pip install tox-travis
services:
- mysql
- postgresql

View file

@ -1,3 +1,5 @@
import os
from flask_testing import TestCase
from werkzeug.security import generate_password_hash
@ -58,7 +60,9 @@ class BaseTestCase(TestCase):
class IhatemoneyTestCase(BaseTestCase):
SQLALCHEMY_DATABASE_URI = "sqlite://"
SQLALCHEMY_DATABASE_URI = os.environ.get(
"TESTING_SQLALCHEMY_DATABASE_URI", "sqlite://"
)
TESTING = True
WTF_CSRF_ENABLED = False # Simplifies the tests.

View file

@ -51,6 +51,8 @@ dev =
pytest>=5.4.1
tox>=3.14.6
zest.releaser>=6.20.1
psycopg2-binary>=2.8.5
PyMySQL>=0.9,<0.10
doc =
Sphinx==4.0.2

View file

@ -3,6 +3,7 @@ envlist = py39,py38,py37,py36,lint_docs
skip_missing_interpreters = True
[testenv]
passenv = TESTING_SQLALCHEMY_DATABASE_URI
commands =
python --version