diff --git a/tests/contrib/asyncio/test_lazyimport.py b/tests/contrib/asyncio/test_lazyimport.py index cd8235c2f9..07c96bc799 100644 --- a/tests/contrib/asyncio/test_lazyimport.py +++ b/tests/contrib/asyncio/test_lazyimport.py @@ -20,6 +20,12 @@ def test_lazy_import(): @pytest.mark.subprocess() def test_asyncio_not_imported_by_auto_instrumentation(): + # Module unloading is not supported for asyncio, a simple workaround + # is to ensure asyncio is not imported by ddtrace.auto or ddtrace-run. + # If asyncio is imported by ddtrace.auto the asyncio event loop with fail + # to register new loops in some platforms (e.g. Ubuntuu). import sys - import ddtrace.auto - assert "asyncio" not in sys.modules \ No newline at end of file + + import ddtrace.auto # noqa: F401 + + assert "asyncio" not in sys.modules