Skip to content

Commit

Permalink
Refs fab8bb4, fix the same bug for processing rollback transactions i…
Browse files Browse the repository at this point in the history
…n line.
  • Loading branch information
fantix committed Oct 23, 2015
1 parent f94c6da commit 1c208f4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions aiopg/sa/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ def _rollback_impl(self):
yield from cur.execute('ROLLBACK')
finally:
cur.close()
self._transaction = None

@asyncio.coroutine
def begin_nested(self):
Expand Down
11 changes: 10 additions & 1 deletion tests/test_sa_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,16 @@ def go():
res2 = yield from conn.scalar(tbl.count())
self.assertEqual(2, res2)

yield from tr2.commit()
yield from tr2.rollback()
self.assertIsNone(conn._transaction)

tr3 = yield from conn.begin()
self.assertIs(tr3, conn._transaction)
yield from conn.execute(tbl.insert().values(name='b'))
res3 = yield from conn.scalar(tbl.count())
self.assertEqual(2, res3)

yield from tr3.commit()
self.assertIsNone(conn._transaction)

self.loop.run_until_complete(go())

0 comments on commit 1c208f4

Please sign in to comment.