diff --git a/propan/test/kafka.py b/propan/test/kafka.py index e57798ba..df3b3573 100644 --- a/propan/test/kafka.py +++ b/propan/test/kafka.py @@ -1,7 +1,12 @@ +import sys from datetime import datetime from types import MethodType from typing import Any, Dict, Optional -from unittest.mock import AsyncMock + +if sys.version_info < (3, 8): + from asyncmock import AsyncMock +else: + from unittest.mock import AsyncMock from aiokafka.structs import ConsumerRecord diff --git a/propan/test/nats.py b/propan/test/nats.py index 80b39986..057d08b9 100644 --- a/propan/test/nats.py +++ b/propan/test/nats.py @@ -1,6 +1,11 @@ +import sys from types import MethodType from typing import Any, Dict, Optional, Union -from unittest.mock import AsyncMock + +if sys.version_info < (3, 8): + from asyncmock import AsyncMock +else: + from unittest.mock import AsyncMock from uuid import uuid4 from nats.aio.msg import Msg diff --git a/propan/test/rabbit.py b/propan/test/rabbit.py index 3178f2d3..782b49f9 100644 --- a/propan/test/rabbit.py +++ b/propan/test/rabbit.py @@ -1,8 +1,13 @@ import re +import sys from contextlib import asynccontextmanager from types import MethodType from typing import Any, Optional, Union -from unittest.mock import AsyncMock + +if sys.version_info < (3, 8): + from asyncmock import AsyncMock +else: + from unittest.mock import AsyncMock from uuid import uuid4 import aiormq diff --git a/propan/test/redis.py b/propan/test/redis.py index 485dd5e2..e51e7bcc 100644 --- a/propan/test/redis.py +++ b/propan/test/redis.py @@ -1,7 +1,12 @@ import re +import sys from types import MethodType from typing import Any, Dict, Optional, Union -from unittest.mock import AsyncMock + +if sys.version_info < (3, 8): + from asyncmock import AsyncMock +else: + from unittest.mock import AsyncMock from typing_extensions import TypeAlias diff --git a/propan/test/sqs.py b/propan/test/sqs.py index 606da966..0f071386 100644 --- a/propan/test/sqs.py +++ b/propan/test/sqs.py @@ -1,8 +1,13 @@ import json +import sys from hashlib import md5 from types import MethodType from typing import Any, Dict, Optional -from unittest.mock import AsyncMock + +if sys.version_info < (3, 8): + from asyncmock import AsyncMock +else: + from unittest.mock import AsyncMock from uuid import uuid4 from propan import SQSBroker