diff --git a/pytest.ini b/pytest.ini index 07ac113a3..23108d61e 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,4 +1,5 @@ [pytest] +asyncio_mode=auto testdox_format = plaintext addopts = --testdox --timeout 20 --ignore e2e --ignore tests/e2e norecursedirs=__pycache__, *.egg-info diff --git a/requirements_test.txt b/requirements_test.txt index ea6d086a5..f489cfb2e 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,5 +1,5 @@ -pytest < 8.0.0 -pytest-asyncio <= 0.16 +pytest < 9.0.0 +pytest-asyncio pytest-mock pytest-testdox>=1.1.1 pytest-cov diff --git a/tests/e2e/iothub_e2e/aio/test_c2d.py b/tests/e2e/iothub_e2e/aio/test_c2d.py index 980ccc583..07905e135 100644 --- a/tests/e2e/iothub_e2e/aio/test_c2d.py +++ b/tests/e2e/iothub_e2e/aio/test_c2d.py @@ -10,7 +10,6 @@ logger = logging.getLogger(__name__) logger.setLevel(level=logging.INFO) -pytestmark = pytest.mark.asyncio # TODO: add tests for various application properties # TODO: is there a way to call send_c2d so it arrives as an object rather than a JSON string? diff --git a/tests/e2e/iothub_e2e/aio/test_connect_disconnect.py b/tests/e2e/iothub_e2e/aio/test_connect_disconnect.py index 89d3d267b..01df331de 100644 --- a/tests/e2e/iothub_e2e/aio/test_connect_disconnect.py +++ b/tests/e2e/iothub_e2e/aio/test_connect_disconnect.py @@ -9,8 +9,6 @@ logger = logging.getLogger(__name__) logger.setLevel(level=logging.INFO) -pytestmark = pytest.mark.asyncio - @pytest.mark.describe("Client object") class TestConnectDisconnect(object): diff --git a/tests/e2e/iothub_e2e/aio/test_connect_disconnect_stress.py b/tests/e2e/iothub_e2e/aio/test_connect_disconnect_stress.py index c4d1f5caf..0e4e1d2fd 100644 --- a/tests/e2e/iothub_e2e/aio/test_connect_disconnect_stress.py +++ b/tests/e2e/iothub_e2e/aio/test_connect_disconnect_stress.py @@ -10,8 +10,6 @@ logger = logging.getLogger(__name__) logger.setLevel(level=logging.INFO) -pytestmark = pytest.mark.asyncio - @pytest.mark.stress @pytest.mark.describe("Client object connect/disconnect stress") diff --git a/tests/e2e/iothub_e2e/aio/test_infrastructure.py b/tests/e2e/iothub_e2e/aio/test_infrastructure.py index 5ace0aebf..1587d5c71 100644 --- a/tests/e2e/iothub_e2e/aio/test_infrastructure.py +++ b/tests/e2e/iothub_e2e/aio/test_infrastructure.py @@ -4,8 +4,6 @@ import pytest import uuid -pytestmark = pytest.mark.asyncio - @pytest.mark.describe("ServiceHelper object") class TestServiceHelper(object): diff --git a/tests/e2e/iothub_e2e/aio/test_methods.py b/tests/e2e/iothub_e2e/aio/test_methods.py index 50e7f487c..4ca196dab 100644 --- a/tests/e2e/iothub_e2e/aio/test_methods.py +++ b/tests/e2e/iothub_e2e/aio/test_methods.py @@ -11,8 +11,6 @@ logger = logging.getLogger(__name__) logger.setLevel(level=logging.INFO) -pytestmark = pytest.mark.asyncio - @pytest.fixture def method_name(): diff --git a/tests/e2e/iothub_e2e/aio/test_sas_renewal.py b/tests/e2e/iothub_e2e/aio/test_sas_renewal.py index e7942b150..faabe343a 100644 --- a/tests/e2e/iothub_e2e/aio/test_sas_renewal.py +++ b/tests/e2e/iothub_e2e/aio/test_sas_renewal.py @@ -11,8 +11,6 @@ logger = logging.getLogger(__name__) logger.setLevel(level=logging.INFO) -pytestmark = pytest.mark.asyncio - @pytest.mark.skipif( test_config.config.auth not in test_config.AUTH_WITH_RENEWING_TOKEN, diff --git a/tests/e2e/iothub_e2e/aio/test_send_message.py b/tests/e2e/iothub_e2e/aio/test_send_message.py index 40bb2daa2..bc609e9c9 100644 --- a/tests/e2e/iothub_e2e/aio/test_send_message.py +++ b/tests/e2e/iothub_e2e/aio/test_send_message.py @@ -11,8 +11,6 @@ logger = logging.getLogger(__name__) logger.setLevel(level=logging.INFO) -pytestmark = pytest.mark.asyncio - @pytest.mark.describe("Client send_message method") class TestSendMessage(object): diff --git a/tests/e2e/iothub_e2e/aio/test_send_message_stress.py b/tests/e2e/iothub_e2e/aio/test_send_message_stress.py index 81d7aacb9..64beb7025 100644 --- a/tests/e2e/iothub_e2e/aio/test_send_message_stress.py +++ b/tests/e2e/iothub_e2e/aio/test_send_message_stress.py @@ -15,7 +15,6 @@ logger = logging.getLogger(__name__) logger.setLevel(level=logging.INFO) -pytestmark = pytest.mark.asyncio # Settings that apply to all tests in this module TELEMETRY_PAYLOAD_SIZE = 16 * 1024 diff --git a/tests/e2e/iothub_e2e/aio/test_twin.py b/tests/e2e/iothub_e2e/aio/test_twin.py index 92b798910..a16e9b136 100644 --- a/tests/e2e/iothub_e2e/aio/test_twin.py +++ b/tests/e2e/iothub_e2e/aio/test_twin.py @@ -11,8 +11,6 @@ logger = logging.getLogger(__name__) logger.setLevel(level=logging.INFO) -pytestmark = pytest.mark.asyncio - # TODO: tests with drop_incoming and reject_incoming diff --git a/tests/e2e/iothub_e2e/aio/test_twin_stress.py b/tests/e2e/iothub_e2e/aio/test_twin_stress.py index b873becf2..db0858203 100644 --- a/tests/e2e/iothub_e2e/aio/test_twin_stress.py +++ b/tests/e2e/iothub_e2e/aio/test_twin_stress.py @@ -12,8 +12,6 @@ logger = logging.getLogger(__name__) logger.setLevel(level=logging.INFO) -pytestmark = pytest.mark.asyncio - @pytest.fixture def toxic(): diff --git a/tests/e2e/provisioning_e2e/tests/test_async_certificate_enrollments.py b/tests/e2e/provisioning_e2e/tests/test_async_certificate_enrollments.py index 1b8ea4ab3..0219af14e 100644 --- a/tests/e2e/provisioning_e2e/tests/test_async_certificate_enrollments.py +++ b/tests/e2e/provisioning_e2e/tests/test_async_certificate_enrollments.py @@ -29,7 +29,6 @@ ) -pytestmark = pytest.mark.asyncio logging.basicConfig(level=logging.DEBUG) diff --git a/tests/e2e/provisioning_e2e/tests/test_async_symmetric_enrollments.py b/tests/e2e/provisioning_e2e/tests/test_async_symmetric_enrollments.py index 3657db15b..914a158d5 100644 --- a/tests/e2e/provisioning_e2e/tests/test_async_symmetric_enrollments.py +++ b/tests/e2e/provisioning_e2e/tests/test_async_symmetric_enrollments.py @@ -13,7 +13,7 @@ import os import uuid -pytestmark = pytest.mark.asyncio + logging.basicConfig(level=logging.DEBUG) diff --git a/tests/unit/common/test_async_adapter.py b/tests/unit/common/test_async_adapter.py index 800b85d42..d90a895e4 100644 --- a/tests/unit/common/test_async_adapter.py +++ b/tests/unit/common/test_async_adapter.py @@ -11,7 +11,6 @@ import azure.iot.device.common.async_adapter as async_adapter logging.basicConfig(level=logging.DEBUG) -pytestmark = pytest.mark.asyncio @pytest.fixture diff --git a/tests/unit/iothub/aio/test_async_clients.py b/tests/unit/iothub/aio/test_async_clients.py index b22d1774e..3796f494a 100644 --- a/tests/unit/iothub/aio/test_async_clients.py +++ b/tests/unit/iothub/aio/test_async_clients.py @@ -44,7 +44,6 @@ SharedIoTHubModuleClientCreateFromEdgeEnvironmentWithDebugEnvTests, ) -pytestmark = pytest.mark.asyncio logging.basicConfig(level=logging.DEBUG) diff --git a/tests/unit/iothub/aio/test_async_handler_manager.py b/tests/unit/iothub/aio/test_async_handler_manager.py index b3dc5c056..781b902ab 100644 --- a/tests/unit/iothub/aio/test_async_handler_manager.py +++ b/tests/unit/iothub/aio/test_async_handler_manager.py @@ -16,7 +16,6 @@ from azure.iot.device.iothub.inbox_manager import InboxManager from azure.iot.device.iothub.aio.async_inbox import AsyncClientInbox -pytestmark = pytest.mark.asyncio logging.basicConfig(level=logging.DEBUG) # NOTE ON TEST IMPLEMENTATION: diff --git a/tests/unit/provisioning/aio/test_async_provisioning_device_client.py b/tests/unit/provisioning/aio/test_async_provisioning_device_client.py index 2b1106a52..75ebc5107 100644 --- a/tests/unit/provisioning/aio/test_async_provisioning_device_client.py +++ b/tests/unit/provisioning/aio/test_async_provisioning_device_client.py @@ -20,7 +20,6 @@ logging.basicConfig(level=logging.DEBUG) -pytestmark = pytest.mark.asyncio async def create_completed_future(result=None):