From c94b8a6f92cb23e7feba9a78c15829f3749d2cda Mon Sep 17 00:00:00 2001 From: Xiang Yan Date: Thu, 23 Sep 2021 16:33:50 -0700 Subject: [PATCH] fix test_aiohttp_loop (#20811) * fix test_aiohttp_loop * fix collections import issue --- sdk/core/azure-core/tests/test_basic_transport.py | 2 +- sdk/core/azure-core/tests/test_rest_http_request.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sdk/core/azure-core/tests/test_basic_transport.py b/sdk/core/azure-core/tests/test_basic_transport.py index 4b4fd280dc0c..27634b3bae58 100644 --- a/sdk/core/azure-core/tests/test_basic_transport.py +++ b/sdk/core/azure-core/tests/test_basic_transport.py @@ -1171,6 +1171,6 @@ def test_conflict_timeout(caplog, port, http_request): def test_aiohttp_loop(): import asyncio from azure.core.pipeline.transport import AioHttpTransport - loop = asyncio._get_running_loop() + loop = asyncio.get_event_loop() with pytest.raises(ValueError): transport = AioHttpTransport(loop=loop) diff --git a/sdk/core/azure-core/tests/test_rest_http_request.py b/sdk/core/azure-core/tests/test_rest_http_request.py index a773b99b61ba..0f16061badbd 100644 --- a/sdk/core/azure-core/tests/test_rest_http_request.py +++ b/sdk/core/azure-core/tests/test_rest_http_request.py @@ -10,7 +10,10 @@ import io import pytest import sys -import collections +try: + import collections.abc as collections +except ImportError: + import collections # type: ignore from azure.core.configuration import Configuration from azure.core.rest import HttpRequest