postgres db tests

This commit is contained in:
Emmanuel Cazenave 2018-04-26 14:08:25 +02:00
parent 75a00a1d65
commit 979c3d95ee
6 changed files with 24 additions and 1 deletions

View File

View File

@ -0,0 +1,5 @@
from django.db import models
class Variable(models.Model):
name = models.CharField(max_length=100, verbose_name='name')

View File

@ -37,6 +37,7 @@ INSTALLED_APPS = (
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'bidon.bidon_app'
)
MIDDLEWARE_CLASSES = (
@ -100,3 +101,10 @@ USE_TZ = True
# https://docs.djangoproject.com/en/1.8/howto/static-files/
STATIC_URL = '/static/'
local_settings_file = os.environ.get(
'BIDON_SETTINGS_FILE', os.path.join(os.path.dirname(__file__), 'local_settings.py'))
if os.path.exists(local_settings_file):
execfile(local_settings_file)

8
tests/settings.py Normal file
View File

@ -0,0 +1,8 @@
import os
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'bidon_' + os.environ.get('JOB_NAME', '')
}
}

View File

@ -1,5 +1,5 @@
def test_true():
def test_true(db):
assert True

View File

@ -8,9 +8,11 @@ envlist = django18,django111
usedevelop = True
setenv =
DJANGO_SETTINGS_MODULE=bidon.settings
BIDON_SETTINGS_FILE=tests/settings.py
deps =
django18: django>=1.8,<1.9
django111: django>=1.11,<1.12
psycopg2
pytest-cov
pytest-django
pytest