diff --git a/pyproject.toml b/pyproject.toml index 1c195e1b77..e524051042 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,7 +52,6 @@ dev = [ "cython>=3.2", "packaging>=25.0", "futurist", - "asynctest", "pyyaml", "numpy", "objgraph", diff --git a/tests/unit/io/test_asyncioreactor.py b/tests/unit/io/test_asyncioreactor.py index c189aa3d74..f3ed942090 100644 --- a/tests/unit/io/test_asyncioreactor.py +++ b/tests/unit/io/test_asyncioreactor.py @@ -1,7 +1,6 @@ AsyncioConnection, ASYNCIO_AVAILABLE = None, False try: from cassandra.io.asyncioreactor import AsyncioConnection - import asynctest ASYNCIO_AVAILABLE = True except (ImportError, SyntaxError, AttributeError): AsyncioConnection = None @@ -10,8 +9,8 @@ from tests import is_monkey_patched, connection_class from tests.unit.io.utils import TimerCallback, TimerTestMixin -from unittest.mock import patch - +from unittest.mock import patch, MagicMock +import selectors import unittest import time @@ -56,7 +55,7 @@ def setUp(self): socket_patcher.start() old_selector = AsyncioConnection._loop._selector - AsyncioConnection._loop._selector = asynctest.TestSelector() + AsyncioConnection._loop._selector = MagicMock(spec=selectors.BaseSelector) def reset_selector(): AsyncioConnection._loop._selector = old_selector diff --git a/tests/unit/io/utils.py b/tests/unit/io/utils.py index 174137225a..f43224058c 100644 --- a/tests/unit/io/utils.py +++ b/tests/unit/io/utils.py @@ -128,8 +128,10 @@ def submit_and_wait_for_completion(unit_test, create_timer, start, end, incremen time.sleep(.1) # ensure they are all called back in a timely fashion + # Use a generous tolerance (500ms) to account for CI environments under heavy load, + # especially Windows during wheel building where timing can be significantly less precise for callback in completed_callbacks: - assert callback.expected_wait == pytest.approx(callback.get_wait_time(), abs=.15) + assert callback.expected_wait == pytest.approx(callback.get_wait_time(), abs=.5) def noop_if_monkey_patched(f):