diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-10-15 15:05:51 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-10-15 15:05:51 -0400 |
commit | 5397d953650c3b7728e8285c55c32c5eeb687de9 (patch) | |
tree | 78ba88f9d3826fa22489061d14852045022c2326 /test/dialect/test_postgresql.py | |
parent | 80c68c0e22e2b45b3eaffcb7485d6a9f5eb02ba4 (diff) | |
download | sqlalchemy-5397d953650c3b7728e8285c55c32c5eeb687de9.tar.gz |
- Added client_encoding parameter to create_engine()
when the postgresql+psycopg2 dialect is used;
calls the psycopg2 set_client_encoding() method
with the value upon connect. [ticket:1839]
Diffstat (limited to 'test/dialect/test_postgresql.py')
-rw-r--r-- | test/dialect/test_postgresql.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py index b37344b27..487139102 100644 --- a/test/dialect/test_postgresql.py +++ b/test/dialect/test_postgresql.py @@ -1622,6 +1622,25 @@ class MiscTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiledSQL): assert 'will create implicit sequence' in msgs assert 'will create implicit index' in msgs + @testing.only_on('postgresql+psycopg2', 'psycopg2-specific feature') + @engines.close_open_connections + def test_client_encoding(self): + c = testing.db.connect() + current_encoding = c.connection.connection.encoding + c.close() + + # attempt to use an encoding that's not + # already set + if current_encoding == 'UTF8': + test_encoding = 'LATIN1' + else: + test_encoding = 'UTF8' + + e = engines.testing_engine( + options={'client_encoding':test_encoding} + ) + c = e.connect() + eq_(c.connection.connection.encoding, test_encoding) @testing.fails_on('+zxjdbc', "Can't infer the SQL type to use for an instance " |