minor cleanups on test spurious exceptions

This commit is contained in:
Victor Shyba 2019-06-03 16:10:41 -03:00 committed by Lex Berezhny
parent 9d0b9f0ded
commit ca0a3dbf9e
3 changed files with 5 additions and 1 deletions

View file

@ -64,6 +64,7 @@ class ReconnectTests(IntegrationTestCase):
self.ledger.config['connect_timeout'] = 30
network = BaseNetwork(self.ledger)
self.addCleanup(network.stop)
asyncio.ensure_future(network.start())
await asyncio.wait_for(network.on_connected.first, timeout=1)
self.assertTrue(network.is_connected)

View file

@ -31,6 +31,8 @@ class AIOSQLite:
self.executor.submit(conn.close)
self.executor.shutdown(wait=True)
conn = self.connection
if not conn:
return
self.connection = None
return asyncio.get_event_loop_policy().get_event_loop().call_later(0.01, __close, conn)

View file

@ -82,7 +82,8 @@ class BaseNetwork:
await client.send_request('server.banner')
return client
except (asyncio.TimeoutError, asyncio.CancelledError) as error:
client.connection_lost(error)
if not client.is_closing():
client.abort()
raise error
futures = []
for server in self.config['default_servers']: