Adding postgres to the build matrix (#604)

This commit is contained in:
Maxime Beauchemin 2016-06-12 11:01:16 -07:00 committed by GitHub
parent c490138afe
commit fa13b77cfa
7 changed files with 25 additions and 19 deletions

View File

@ -14,9 +14,10 @@ env:
matrix:
#- TOX_ENV=py27-mysql
- TOX_ENV=py27-sqlite
#- TOX_ENV=py27-postgres
- TOX_ENV=py27-postgres
- TOX_ENV=py34-sqlite
- TOX_ENV=py34-mysql
- TOX_ENV=py34-postgres
- TOX_ENV=javascript
before_install:
- npm install -g npm@'>=2.7.1'

View File

@ -581,7 +581,7 @@ def load_birth_names():
print("Done loading table!")
print("-" * 80)
print("Creating table reference")
print("Creating table [birth_names] reference")
obj = db.session.query(TBL).filter_by(table_name='birth_names').first()
if not obj:
obj = TBL(table_name='birth_names')
@ -829,7 +829,7 @@ def load_unicode_test_data():
print("Done loading table!")
print("-" * 80)
print("Creating table reference")
print("Creating table [unicode_test] reference")
obj = db.session.query(TBL).filter_by(table_name='unicode_test').first()
if not obj:
obj = TBL(table_name='unicode_test')
@ -908,7 +908,7 @@ def load_random_time_series_data():
print("Done loading table!")
print("-" * 80)
print("Creating table reference")
print("Creating table [random_time_series] reference")
obj = db.session.query(TBL).filter_by(table_name='random_time_series').first()
if not obj:
obj = TBL(table_name='random_time_series')

View File

@ -88,7 +88,7 @@ def upgrade():
sa.Column('changed_on', sa.DateTime(), nullable=False),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('datasource_name', sa.String(length=250), nullable=True),
sa.Column('column_name', sa.String(length=255), sa.ForeignKey("datasources.datasource_name"), nullable=True),
sa.Column('column_name', sa.String(length=255), nullable=True),
sa.Column('is_active', sa.Boolean(), nullable=True),
sa.Column('type', sa.String(length=32), nullable=True),
sa.Column('groupby', sa.Boolean(), nullable=True),

View File

@ -1059,6 +1059,7 @@ class DruidDatasource(Model, AuditMixinNullable, Queryable):
flasher("Refreshing datasource [{}]".format(name), "info")
session.flush()
datasource.cluster = cluster
session.flush()
cols = datasource.latest_metadata()
if not cols:

View File

@ -18,7 +18,7 @@ all_files = 1
upload-dir = docs/_build/html
[nosetests]
verbosity=4
verbosity=3
detailed-errors=1
with-coverage=1
nocapture=1

View File

@ -8,7 +8,6 @@ from datetime import datetime
import doctest
import json
import imp
import logging
import os
import unittest
from mock import Mock, patch
@ -70,14 +69,12 @@ class CaravelTestCase(unittest.TestCase):
assert 'Welcome' in resp.data.decode('utf-8')
def logout(self):
resp = self.client.get('/logout/', follow_redirects=True)
self.client.get('/logout/', follow_redirects=True)
'''
def test_welcome(self):
self.login()
resp = self.client.get('/caravel/welcome')
assert 'Welcome' in resp.data.decode('utf-8')
'''
def setup_public_access_for_dashboard(self, table_name):
public_role = appbuilder.sm.find_role('Public')
@ -101,9 +98,13 @@ class CoreTests(CaravelTestCase):
def __init__(self, *args, **kwargs):
# Load examples first, so that we setup proper permission-view relations
# for all example data sources.
self.load_examples()
super(CoreTests, self).__init__(*args, **kwargs)
self.table_ids = {tbl.table_name: tbl.id for tbl in (
@classmethod
def setUpClass(cls):
cli.load_examples(load_test_data=True)
utils.init(caravel)
cls.table_ids = {tbl.table_name: tbl.id for tbl in (
db.session
.query(models.SqlaTable)
.all()
@ -115,16 +116,14 @@ class CoreTests(CaravelTestCase):
def tearDown(self):
pass
def load_examples(self):
cli.load_examples(load_test_data=True)
def test_save_slice(self):
self.login(username='admin')
slice_id = (
slc = (
db.session.query(models.Slice.id)
.filter_by(slice_name="Energy Sankey")
.scalar())
.first())
slice_id = slc.id
copy_name = "Test Sankey Save"
tbl_id = self.table_ids.get('energy_usage')
@ -152,7 +151,7 @@ class CoreTests(CaravelTestCase):
(slc.slice_name, 'csv_endpoint', slc.viz.csv_endpoint),
]
for name, method, url in urls:
logging.info("[{name}]/[{method}]: {url}".format(**locals()))
print("[{name}]/[{method}]: {url}".format(**locals()))
self.client.get(url)
def test_dashboard(self):
@ -228,7 +227,7 @@ class CoreTests(CaravelTestCase):
# Try access after adding appropriate permissions.
resp = self.client.get('/slicemodelview/list/')
data = resp.data.decode('utf-8')
assert 'birth_names</a>' in data
assert 'birth_names' in data
resp = self.client.get('/dashboardmodelview/list/')
data = resp.data.decode('utf-8')

View File

@ -65,5 +65,10 @@ basepython = python2.7
setenv =
CARAVEL__SQLALCHEMY_DATABASE_URI = postgresql+psycopg2://postgres@localhost/caravel
[testenv:py34-postgres]
basepython = python3.4
setenv =
CARAVEL__SQLALCHEMY_DATABASE_URI = postgresql+psycopg2://postgres@localhost/caravel
[testenv:javascript]
commands = {toxinidir}/caravel/assets/js_build.sh