Skip to content

Commit 0c47ebe

Browse files
committed
Should fix pytest-dev#25
1 parent 6a11dd4 commit 0c47ebe

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

peewee_async.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -840,11 +840,16 @@ def connect_async(self, loop=None, timeout=None):
840840
timeout=timeout,
841841
**self.connect_kwargs_async)
842842

843-
yield from conn.connect()
844-
845-
self._task_data = TaskLocals(loop=self.loop)
846-
self._async_conn = conn
847-
self._async_wait.set_result(True)
843+
try:
844+
yield from conn.connect()
845+
except:
846+
self._async_wait.cancel()
847+
self._async_wait = None
848+
raise
849+
else:
850+
self._task_data = TaskLocals(loop=self.loop)
851+
self._async_conn = conn
852+
self._async_wait.set_result(True)
848853

849854
@asyncio.coroutine
850855
def cursor_async(self):

0 commit comments

Comments
 (0)