minor cleanups on test spurious exceptions
This commit is contained in:
parent
9d0b9f0ded
commit
ca0a3dbf9e
3 changed files with 5 additions and 1 deletions
|
@ -64,6 +64,7 @@ class ReconnectTests(IntegrationTestCase):
|
||||||
self.ledger.config['connect_timeout'] = 30
|
self.ledger.config['connect_timeout'] = 30
|
||||||
|
|
||||||
network = BaseNetwork(self.ledger)
|
network = BaseNetwork(self.ledger)
|
||||||
|
self.addCleanup(network.stop)
|
||||||
asyncio.ensure_future(network.start())
|
asyncio.ensure_future(network.start())
|
||||||
await asyncio.wait_for(network.on_connected.first, timeout=1)
|
await asyncio.wait_for(network.on_connected.first, timeout=1)
|
||||||
self.assertTrue(network.is_connected)
|
self.assertTrue(network.is_connected)
|
||||||
|
|
|
@ -31,6 +31,8 @@ class AIOSQLite:
|
||||||
self.executor.submit(conn.close)
|
self.executor.submit(conn.close)
|
||||||
self.executor.shutdown(wait=True)
|
self.executor.shutdown(wait=True)
|
||||||
conn = self.connection
|
conn = self.connection
|
||||||
|
if not conn:
|
||||||
|
return
|
||||||
self.connection = None
|
self.connection = None
|
||||||
return asyncio.get_event_loop_policy().get_event_loop().call_later(0.01, __close, conn)
|
return asyncio.get_event_loop_policy().get_event_loop().call_later(0.01, __close, conn)
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,8 @@ class BaseNetwork:
|
||||||
await client.send_request('server.banner')
|
await client.send_request('server.banner')
|
||||||
return client
|
return client
|
||||||
except (asyncio.TimeoutError, asyncio.CancelledError) as error:
|
except (asyncio.TimeoutError, asyncio.CancelledError) as error:
|
||||||
client.connection_lost(error)
|
if not client.is_closing():
|
||||||
|
client.abort()
|
||||||
raise error
|
raise error
|
||||||
futures = []
|
futures = []
|
||||||
for server in self.config['default_servers']:
|
for server in self.config['default_servers']:
|
||||||
|
|
Loading…
Reference in a new issue