Swap for new ioloop for now

This commit is contained in:
Jenkins 2023-05-14 15:33:53 -07:00 committed by Gareth J. Greenaway
parent 5c8550de75
commit 97a77adc32
2 changed files with 5 additions and 3 deletions

View file

@ -617,14 +617,16 @@ def io_loop():
"""
Create new io loop for each test, and tear it down after.
"""
import asyncio
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
loop = salt.ext.tornado.ioloop.IOLoop.current()
loop.make_current()
try:
yield loop
finally:
loop.clear_current()
# loop.close(all_fds=True)
loop.close(all_fds=True)
# <---- Async Test Fixtures ------------------------------------------------------------------------------------------

View file

@ -132,7 +132,7 @@ class HTTPTestCase(TestCase):
url = "http://{host}:{port}/".format(host=host, port=port)
result = http.query(url, raise_error=False)
assert result == {"body": None}, result
assert result == {"error": "[Errno 111] Connection refused"}, result
def test_query_error_handling(self):
ret = http.query("http://127.0.0.1:0")