diff --git a/poetry.lock b/poetry.lock index ae399a8c..368d10bb 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.3.0 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.3.1 and should not be changed by hand. [[package]] name = "aiobotocore" @@ -700,22 +700,6 @@ files = [ {file = "iniconfig-2.1.0.tar.gz", hash = "sha256:3abbd2e30b36733fee78f9c7f7308f2d0050e88f0087fd25c2645f63c773e1c7"}, ] -[[package]] -name = "isort" -version = "6.0.1" -description = "A Python utility / library to sort Python imports." -optional = false -python-versions = ">=3.9.0" -groups = ["dev"] -files = [ - {file = "isort-6.0.1-py3-none-any.whl", hash = "sha256:2dc5d7f65c9678d94c88dfc29161a320eec67328bc97aad576874cb4be1e9615"}, - {file = "isort-6.0.1.tar.gz", hash = "sha256:1cb5df28dfbc742e490c5e41bad6da41b805b0a8be7bc93cd0fb2a8a890ac450"}, -] - -[package.extras] -colors = ["colorama"] -plugins = ["setuptools"] - [[package]] name = "jmespath" version = "1.0.1" @@ -1701,18 +1685,6 @@ files = [ {file = "types_croniter-6.0.0.20250626.tar.gz", hash = "sha256:c32243b16d4dfa7c9989a5eadc6762459d093dded023f3c363fdee6b96578a77"}, ] -[[package]] -name = "types-pymysql" -version = "1.1.0.20250711" -description = "Typing stubs for PyMySQL" -optional = false -python-versions = ">=3.9" -groups = ["dev"] -files = [ - {file = "types_pymysql-1.1.0.20250711-py3-none-any.whl", hash = "sha256:29c8dbaeb38c005ea0b81fd2e1fbe58f1774d58105f41812fbf1dfc4701ae392"}, - {file = "types_pymysql-1.1.0.20250711.tar.gz", hash = "sha256:38690d5e6d290eb56b9a451c79643c86663e1993344b818c69128977867a5ab9"}, -] - [[package]] name = "types-pytz" version = "2025.2.0.20250516" @@ -1752,18 +1724,6 @@ files = [ [package.dependencies] urllib3 = ">=2" -[[package]] -name = "types-setuptools" -version = "80.9.0.20250801" -description = "Typing stubs for setuptools" -optional = false -python-versions = ">=3.9" -groups = ["dev"] -files = [ - {file = "types_setuptools-80.9.0.20250801-py3-none-any.whl", hash = "sha256:ec908f825134af3964932e6b011dce90f54c291015139cd9cdf79741b7d31b3c"}, - {file = "types_setuptools-80.9.0.20250801.tar.gz", hash = "sha256:e1e92682fa07226415396bb4e2d31f116a16ffbe583b05b01f9910fcdea3b7e8"}, -] - [[package]] name = "types-tabulate" version = "0.9.0.20241207" @@ -2033,4 +1993,4 @@ propcache = ">=0.2.1" [metadata] lock-version = "2.1" python-versions = "^3.12" -content-hash = "bb05da32170c59a950ac25d390611bc115ac73a1a8bbe1e73301fc17debb2767" +content-hash = "a90f6ebddbcbdb8a17a64d35d2fcb0a0a50619af808860a1db5152c37e2276b0" diff --git a/pyproject.toml b/pyproject.toml index b8d8ba45..e11c2a79 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,7 +25,6 @@ pyyaml = "^6.0.2" sqlalchemy = "^2.0.36" [tool.poetry.group.dev.dependencies] -isort = "*" mypy = "*" pytest = "*" pytest-asyncio = "*" @@ -33,11 +32,9 @@ pytest-cov = "*" pytest-mock = "*" pytest-rerunfailures = "*" ruff = "*" -types-setuptools = "*" types-requests = "*" types-pyyaml = "*" types-pytz = "*" -types-pymysql = "*" types-croniter = "*" [tool.poetry.group.plugin-aws.dependencies] diff --git a/tests/components/executor/test_event_handler.py b/tests/components/executor/test_event_handler.py index 56e05165..a8555fe6 100644 --- a/tests/components/executor/test_event_handler.py +++ b/tests/components/executor/test_event_handler.py @@ -263,15 +263,15 @@ async def long_sleep() -> None: async def test_run_timeout(caplog, monkeypatch, sample_monitor: Monitor): """'run' should execute all the reactions and the timeout should be independent for each function""" - monkeypatch.setattr(configs, "executor_reaction_timeout", 0.2) + monkeypatch.setattr(configs, "executor_reaction_timeout", 0.1) async def long_sleep(message_payload): - await asyncio.sleep(1) + await asyncio.sleep(0.5) long_sleep_mock = AsyncMock(side_effect=long_sleep) async def short_sleep(message_payload): - await asyncio.sleep(0.1) + await asyncio.sleep(0.01) short_sleep_mock = AsyncMock(side_effect=short_sleep) @@ -295,8 +295,8 @@ async def short_sleep(message_payload): end_time = time.perf_counter() total_time = end_time - start_time - assert total_time > 1 - 0.001 - assert total_time < 1 + 0.03 + assert total_time > 0.4 - 0.001 + assert total_time < 0.4 + 0.03 assert long_sleep_mock.call_count == 4 assert_message_in_log(caplog, "Timed out executing reaction", count=4) diff --git a/tests/components/executor/test_monitor_handler.py b/tests/components/executor/test_monitor_handler.py index a79b0a61..2e0843fd 100644 --- a/tests/components/executor/test_monitor_handler.py +++ b/tests/components/executor/test_monitor_handler.py @@ -1114,7 +1114,7 @@ async def do_nothing(monitor): ... async def test_heartbeat_routine(monkeypatch, sample_monitor: Monitor): """'_heartbeat_routine' should handle execution timeouts while running the monitor routines""" - monkeypatch.setattr(monitor_handler.configs, "executor_monitor_heartbeat_time", 0.5) + monkeypatch.setattr(monitor_handler.configs, "executor_monitor_heartbeat_time", 0.1) await sample_monitor.refresh() assert sample_monitor.last_heartbeat is None @@ -1122,10 +1122,10 @@ async def test_heartbeat_routine(monkeypatch, sample_monitor: Monitor): heartbeat_task = asyncio.create_task(monitor_handler._heartbeat_routine(sample_monitor)) await asyncio.sleep(0) - for _ in range(4): + for _ in range(2): await sample_monitor.refresh() assert sample_monitor.last_heartbeat > now() - timedelta(seconds=0.1) - await asyncio.sleep(0.5) + await asyncio.sleep(0.1) heartbeat_task.cancel() @@ -1205,11 +1205,11 @@ async def test_run_monitor_heartbeat(monkeypatch, sample_monitor: Monitor): """'run' should handle execution timeouts while running the monitor routines""" async def sleep(monitor, tasks): - await asyncio.sleep(2.1) + await asyncio.sleep(0.5) monkeypatch.setattr(monitor_handler, "_run_routines", sleep) - monkeypatch.setattr(monitor_handler.configs, "executor_monitor_heartbeat_time", 0.5) + monkeypatch.setattr(monitor_handler.configs, "executor_monitor_heartbeat_time", 0.1) await sample_monitor.refresh() assert sample_monitor.last_heartbeat is None @@ -1222,7 +1222,7 @@ async def sleep(monitor, tasks): for _ in range(4): await sample_monitor.refresh() assert sample_monitor.last_heartbeat > now() - timedelta(seconds=0.1) - await asyncio.sleep(0.5) + await asyncio.sleep(0.1) await run_task diff --git a/tests/components/executor/test_runner.py b/tests/components/executor/test_runner.py index fdd778e0..4735bbcd 100644 --- a/tests/components/executor/test_runner.py +++ b/tests/components/executor/test_runner.py @@ -23,14 +23,14 @@ async def test_change_visibility_loop(mocker, monkeypatch, clear_queue): monkeypatch.setattr( message_queue.queue._config, # type: ignore[attr-defined] "queue_wait_message_time", - 0.2, + 0.1, ) change_visibility_spy: MagicMock = mocker.spy(message_queue, "change_visibility") message = InternalMessage(json.dumps({"type": "type", "payload": "payload"})) task = asyncio.create_task(runner._change_visibility_loop(message)) - await asyncio.sleep(1.0) + await asyncio.sleep(0.5) task.cancel() await asyncio.sleep(0.1) diff --git a/tests/module_loader/test_loader.py b/tests/module_loader/test_loader.py index 5946efe5..859d7f90 100644 --- a/tests/module_loader/test_loader.py +++ b/tests/module_loader/test_loader.py @@ -202,8 +202,8 @@ def test_load_module_from_file_reload_replace_variables(): module.v.append(10) assert module.v == [10] - # As python checks for the timestamp to change to reload a module, sleep for 1 second - time.sleep(1) + # As python checks for the timestamp to change to reload a module, sleep until the next second + time.sleep(1 - time.time() % 1 + 0.01) module = loader.load_module_from_file(module_path) diff --git a/tests/plugins/aws/queues/sqs/test_sqs_queue.py b/tests/plugins/aws/queues/sqs/test_sqs_queue.py index 9f7236ad..ff7a3066 100644 --- a/tests/plugins/aws/queues/sqs/test_sqs_queue.py +++ b/tests/plugins/aws/queues/sqs/test_sqs_queue.py @@ -266,7 +266,7 @@ async def test_get_message_not_deleted(): "url": "http://motoserver:5000/123456789012/app", "region": "us-east-1", "create_queue": True, - "queue_wait_message_time": 2, + "queue_wait_message_time": 0, "queue_visibility_time": 1, } ) @@ -281,7 +281,7 @@ async def test_get_message_not_deleted(): message = await queue.get_message() assert message is None - await asyncio.sleep(1) + await asyncio.sleep(2) message = await queue.get_message() assert message is not None @@ -298,7 +298,7 @@ async def test_change_visibility(): "url": "http://motoserver:5000/123456789012/app", "region": "us-east-1", "create_queue": True, - "queue_wait_message_time": 2, + "queue_wait_message_time": 0, "queue_visibility_time": 1, } ) @@ -310,12 +310,11 @@ async def test_change_visibility(): assert message is not None assert message.content == {"type": "test", "payload": {"a": 1}} - for _ in range(3): - await queue.change_visibility(message) - new_message = await queue.get_message() - assert new_message is None + await queue.change_visibility(message) + new_message = await queue.get_message() + assert new_message is None - await asyncio.sleep(1) + await asyncio.sleep(2) message = await queue.get_message() assert message is not None @@ -331,8 +330,8 @@ async def test_delete_message(): "url": "http://motoserver:5000/123456789012/app", "region": "us-east-1", "create_queue": True, - "queue_wait_message_time": 2, - "queue_visibility_time": 15, + "queue_wait_message_time": 0, + "queue_visibility_time": 0, } ) await queue.init() @@ -345,7 +344,7 @@ async def test_delete_message(): await queue.delete_message(message) - await asyncio.sleep(2) + await asyncio.sleep(0.5) message = await queue.get_message() assert message is None