diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-01-26 18:02:46 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-01-26 18:43:19 -0500 |
| commit | a826ff366bf979bcbb4f075d3c33540232b91873 (patch) | |
| tree | 30529e6769a2994d096a5d45ac72e7851fb6a138 /test/engine | |
| parent | 226bd8d7077c3557e5fc3b7ad512c4ad59b471d1 (diff) | |
| download | sqlalchemy-a826ff366bf979bcbb4f075d3c33540232b91873.tar.gz | |
- additional test adjustments for pypy / psycopg2cffi. This
consists mainly of adjusting fixtures to ensure connections are closed
explicitly. psycopg2cffi also handles unicode bind parameter
names differently than psycopg2, and seems to possibly have a little less
control over floating point values at least in one test which is
marked as a "fail", though will see if it runs differently on linux
than osx..
- changelog for psycopg2cffi, fixes #3052
Diffstat (limited to 'test/engine')
| -rw-r--r-- | test/engine/test_execute.py | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/test/engine/test_execute.py b/test/engine/test_execute.py index b5b414af2..730ef4446 100644 --- a/test/engine/test_execute.py +++ b/test/engine/test_execute.py @@ -639,21 +639,21 @@ class ConvenienceExecuteTest(fixtures.TablesTest): def test_transaction_connection_ctx_commit(self): fn = self._trans_fn(True) - conn = testing.db.connect() - ctx = conn.begin() - testing.run_as_contextmanager(ctx, fn, 5, value=8) - self._assert_fn(5, value=8) + with testing.db.connect() as conn: + ctx = conn.begin() + testing.run_as_contextmanager(ctx, fn, 5, value=8) + self._assert_fn(5, value=8) def test_transaction_connection_ctx_rollback(self): fn = self._trans_rollback_fn(True) - conn = testing.db.connect() - ctx = conn.begin() - assert_raises_message( - Exception, - "breakage", - testing.run_as_contextmanager, ctx, fn, 5, value=8 - ) - self._assert_no_data() + with testing.db.connect() as conn: + ctx = conn.begin() + assert_raises_message( + Exception, + "breakage", + testing.run_as_contextmanager, ctx, fn, 5, value=8 + ) + self._assert_no_data() def test_connection_as_ctx(self): fn = self._trans_fn() @@ -666,10 +666,12 @@ class ConvenienceExecuteTest(fixtures.TablesTest): def test_connect_as_ctx_noautocommit(self): fn = self._trans_fn() self._assert_no_data() - ctx = testing.db.connect().execution_options(autocommit=False) - testing.run_as_contextmanager(ctx, fn, 5, value=8) - # autocommit is off - self._assert_no_data() + + with testing.db.connect() as conn: + ctx = conn.execution_options(autocommit=False) + testing.run_as_contextmanager(ctx, fn, 5, value=8) + # autocommit is off + self._assert_no_data() def test_transaction_engine_fn_commit(self): fn = self._trans_fn() @@ -687,17 +689,17 @@ class ConvenienceExecuteTest(fixtures.TablesTest): def test_transaction_connection_fn_commit(self): fn = self._trans_fn() - conn = testing.db.connect() - conn.transaction(fn, 5, value=8) - self._assert_fn(5, value=8) + with testing.db.connect() as conn: + conn.transaction(fn, 5, value=8) + self._assert_fn(5, value=8) def test_transaction_connection_fn_rollback(self): fn = self._trans_rollback_fn() - conn = testing.db.connect() - assert_raises( - Exception, - conn.transaction, fn, 5, value=8 - ) + with testing.db.connect() as conn: + assert_raises( + Exception, + conn.transaction, fn, 5, value=8 + ) self._assert_no_data() |
