Skip to content

Commit 880a7e1

Browse files
author
Matt George
committed
first additions for testing
1 parent ef3e5e2 commit 880a7e1

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

.travis.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
language: python
2+
python:
3+
- "2.6"
4+
- "2.7"
5+
- "3.3"
6+
- "pypy"# command to install dependencies
7+
install:
8+
- "python setup.py develop"
9+
# command to run tests
10+
script:
11+
- python runtests.py -x

runtests.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env python
2+
import sys
3+
4+
5+
def runtests(args=None):
6+
import pytest
7+
8+
if not args:
9+
args = []
10+
11+
if not any(a for a in args[1:] if not a.startswith('-')):
12+
args.append('tests')
13+
14+
sys.exit(pytest.main(args))
15+
16+
17+
if __name__ == '__main__':
18+
runtests(sys.argv)

tests/test_column_loading.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from unittest import TestCase
2+
from sqlalchemy.types import NullType, VARCHAR
3+
from redshift_sqlalchemy.dialect import RedshiftDialect
4+
class TestColumnReflection(TestCase):
5+
def test_varchar_as_nulltype(self):
6+
"""
7+
Varchar columns with no length should be considered NullType columns
8+
"""
9+
dialect = RedshiftDialect()
10+
column_info = dialect._get_column_info(
11+
'Null Column',
12+
'character varying', None, False, {}, {}, 'default'
13+
)
14+
assert isinstance(column_info['type'], NullType)
15+
column_info_1 = dialect._get_column_info(
16+
'character column',
17+
'character varying(30)', None, False, {}, {}, 'default'
18+
)
19+
assert isinstance(column_info_1['type'], VARCHAR)

0 commit comments

Comments
 (0)