🌐 AI搜索 & 代理 主页
Skip to content
This repository was archived by the owner on Apr 15, 2024. It is now read-only.

Commit 02d7b08

Browse files
committed
aio tests: wait for session close
1 parent 598813c commit 02d7b08

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

tests/test_aio.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def main():
4040
assert response is True
4141
index, data = yield from c.kv.get('foo')
4242
assert data['Value'] == six.b('bar')
43-
c.close()
43+
yield from c.close()
4444

4545
loop.run_until_complete(main())
4646

@@ -53,7 +53,7 @@ def main():
5353
yield from c.kv.put('foo', struct.pack('i', 1000))
5454
index, data = yield from c.kv.get('foo')
5555
assert struct.unpack('i', data['Value']) == (1000,)
56-
c.close()
56+
yield from c.close()
5757

5858
asyncio.set_event_loop(loop)
5959
loop.run_until_complete(main())
@@ -65,7 +65,7 @@ def main():
6565
yield from c.kv.put('foo', struct.pack('i', 1000))
6666
index, data = yield from c.kv.get('foo')
6767
assert struct.unpack('i', data['Value']) == (1000,)
68-
c.close()
68+
yield from c.close()
6969

7070
loop.run_until_complete(main())
7171

@@ -81,7 +81,7 @@ def main():
8181
index, data = yield from c.kv.get('foo', index=index)
8282
assert data['Value'] == six.b('bar')
8383
yield from fut
84-
c.close()
84+
yield from c.close()
8585

8686
@asyncio.coroutine
8787
def put():
@@ -102,7 +102,7 @@ def main():
102102
assert response is True
103103
index, data = yield from c.kv.get('foo')
104104
assert data['Flags'] == 50
105-
c.close()
105+
yield from c.close()
106106

107107
loop.run_until_complete(main())
108108

@@ -124,7 +124,7 @@ def main():
124124
assert response is True
125125
index, data = yield from c.kv.get('foo', recurse=True)
126126
assert data is None
127-
c.close()
127+
yield from c.close()
128128

129129
loop.run_until_complete(main())
130130

@@ -139,7 +139,7 @@ def get():
139139
index, data = yield from c.kv.get('foo', index=index)
140140
assert data['Value'] == six.b('bar')
141141
yield from fut
142-
c.close()
142+
yield from c.close()
143143

144144
@asyncio.coroutine
145145
def put():
@@ -161,7 +161,7 @@ def main():
161161
d = {"KV": {"Verb": "get", "Key": "asdf"}}
162162
r = yield from c.txn.put([d])
163163
assert r["Results"][0]["KV"]["Value"] == value
164-
c.close()
164+
yield from c.close()
165165
loop.run_until_complete(main())
166166

167167
def test_agent_services(self, loop, consul_port):
@@ -188,7 +188,7 @@ def main():
188188
assert response is True
189189
services = yield from c.agent.services()
190190
assert services == {}
191-
c.close()
191+
yield from c.close()
192192

193193
loop.run_until_complete(main())
194194

@@ -210,7 +210,7 @@ def nodes():
210210
nodes.remove(current)
211211
assert [x['Node'] for x in nodes] == []
212212
yield from fut
213-
c.close()
213+
yield from c.close()
214214

215215
@asyncio.coroutine
216216
def register():
@@ -239,7 +239,7 @@ def monitor():
239239
index, services = yield from c.session.list(index=index)
240240
assert services == []
241241
yield from fut
242-
c.close()
242+
yield from c.close()
243243

244244
@asyncio.coroutine
245245
def register():
@@ -275,7 +275,7 @@ def main():
275275

276276
destroyed = yield from c.acl.destroy(token)
277277
assert destroyed is True
278-
c.close()
278+
yield from c.close()
279279

280280
loop.run_until_complete(main())
281281

0 commit comments

Comments
 (0)