diff options
author | Amjith Ramanujam <amjith.r@gmail.com> | 2015-02-06 22:58:59 -0800 |
---|---|---|
committer | Amjith Ramanujam <amjith.r@gmail.com> | 2015-02-06 22:58:59 -0800 |
commit | c5c3047b9017c1683b3b7a25c9b7ae8f4f6455a0 (patch) | |
tree | b1d6479ea983ad0b6f93c129c3b49e7417748a88 /tests | |
parent | 1ec028401892dfb237e4d3c96b6696d12e6efb7c (diff) |
Convert to use cffi. But unicode isn't working.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_pgexecute.py | 8 | ||||
-rw-r--r-- | tests/utils.py | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/tests/test_pgexecute.py b/tests/test_pgexecute.py index e9c97e36..56bb8ba9 100644 --- a/tests/test_pgexecute.py +++ b/tests/test_pgexecute.py @@ -1,7 +1,7 @@ # coding=UTF-8 import pytest -import psycopg2 +import psycopg2cffi from textwrap import dedent from utils import run, dbtest @@ -54,13 +54,13 @@ def test_database_list(executor): @dbtest def test_invalid_syntax(executor): - with pytest.raises(psycopg2.ProgrammingError) as excinfo: + with pytest.raises(psycopg2cffi.ProgrammingError) as excinfo: run(executor, 'invalid syntax!') assert 'syntax error at or near "invalid"' in str(excinfo.value) @dbtest def test_invalid_column_name(executor): - with pytest.raises(psycopg2.ProgrammingError) as excinfo: + with pytest.raises(psycopg2cffi.ProgrammingError) as excinfo: run(executor, 'select invalid command') assert 'column "invalid" does not exist' in str(excinfo.value) @@ -89,7 +89,7 @@ def test_multiple_queries_same_line(executor): @dbtest def test_multiple_queries_same_line_syntaxerror(executor): - with pytest.raises(psycopg2.ProgrammingError) as excinfo: + with pytest.raises(psycopg2cffi.ProgrammingError) as excinfo: run(executor, "select 'foo'; invalid syntax") assert 'syntax error at or near "invalid"' in str(excinfo.value) diff --git a/tests/utils.py b/tests/utils.py index 9b7376f1..158fa1e3 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -1,5 +1,5 @@ import pytest -import psycopg2 +import psycopg2cffi from pgcli.main import format_output # TODO: should this be somehow be divined from environment? @@ -7,7 +7,7 @@ POSTGRES_USER, POSTGRES_HOST = 'postgres', 'localhost' def db_connection(dbname=None): - conn = psycopg2.connect(user=POSTGRES_USER, host=POSTGRES_HOST, dbname=dbname) + conn = psycopg2cffi.connect(user=POSTGRES_USER, host=POSTGRES_HOST, dbname=dbname) conn.autocommit = True return conn |