diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2022-10-30 08:04:23 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2024-02-18 11:32:52 +0100 |
commit | 8257efd22ea2ac9088098c161dc554d82bbdd974 (patch) | |
tree | 8afa6f161926dd128d383adaab4faf5762b090c5 /tests | |
parent | f0793c332dceb937c2571750115561626b5ae552 (diff) | |
download | wee-slack-8257efd22ea2ac9088098c161dc554d82bbdd974.tar.gz |
Fix tests after file split
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_hook_process_hashtable.py | 12 | ||||
-rw-r--r-- | tests/test_http_request.py | 9 | ||||
-rw-r--r-- | tests/test_sleep.py | 2 | ||||
-rw-r--r-- | tests/test_task_runner.py | 28 |
4 files changed, 21 insertions, 30 deletions
diff --git a/tests/test_hook_process_hashtable.py b/tests/test_hook_process_hashtable.py index 27629b5..e8a1f64 100644 --- a/tests/test_hook_process_hashtable.py +++ b/tests/test_hook_process_hashtable.py @@ -3,13 +3,9 @@ from unittest.mock import MagicMock, patch import pytest import weechat -from slack import ( - FutureProcess, - FutureTimer, - hook_process_hashtable, - weechat_task_cb, -) -import slack +import slack.http +from slack.http import hook_process_hashtable +from slack.task import FutureProcess, FutureTimer, weechat_task_cb @patch.object(weechat, "hook_process_hashtable") @@ -51,7 +47,7 @@ def test_hook_process_hashtable_chunked(mock_method: MagicMock): assert excinfo.value.value == (command, 0, "o1o2o3", "e1e2e3") -@patch.object(slack, "available_file_descriptors") +@patch.object(slack.http, "available_file_descriptors") def test_hook_process_hashtable_wait_on_max_file_descriptors( mock_available_file_descriptors: MagicMock, ): diff --git a/tests/test_http_request.py b/tests/test_http_request.py index f4f36ac..3a2e8cc 100644 --- a/tests/test_http_request.py +++ b/tests/test_http_request.py @@ -3,13 +3,8 @@ from unittest.mock import MagicMock, patch import pytest import weechat -from slack import ( - FutureProcess, - FutureTimer, - HttpError, - http_request, - weechat_task_cb, -) +from slack.http import HttpError, http_request +from slack.task import FutureProcess, FutureTimer, weechat_task_cb @patch.object(weechat, "hook_process_hashtable") diff --git a/tests/test_sleep.py b/tests/test_sleep.py index c226c47..4598778 100644 --- a/tests/test_sleep.py +++ b/tests/test_sleep.py @@ -3,7 +3,7 @@ from unittest.mock import MagicMock, patch import pytest import weechat -from slack import FutureTimer, sleep, weechat_task_cb +from slack.task import FutureTimer, sleep, weechat_task_cb @patch.object(weechat, "hook_timer") diff --git a/tests/test_task_runner.py b/tests/test_task_runner.py index a9db046..17a3ec8 100644 --- a/tests/test_task_runner.py +++ b/tests/test_task_runner.py @@ -1,10 +1,10 @@ -import slack -from slack import Future, create_task, weechat_task_cb +from slack.shared import shared +from slack.task import Future, create_task, weechat_task_cb def test_run_single_task(): - slack.active_tasks = {} - slack.active_responses = {} + shared.active_tasks = {} + shared.active_responses = {} future = Future[str]() async def awaitable(): @@ -14,13 +14,13 @@ def test_run_single_task(): task = create_task(awaitable()) weechat_task_cb(future.id, "data") - assert not slack.active_tasks - assert slack.active_responses == {task.id: ("awaitable", ("data",))} + assert not shared.active_tasks + assert shared.active_responses == {task.id: ("awaitable", ("data",))} def test_run_nested_task(): - slack.active_tasks = {} - slack.active_responses = {} + shared.active_tasks = {} + shared.active_responses = {} future = Future[str]() async def awaitable1(): @@ -34,15 +34,15 @@ def test_run_nested_task(): task = create_task(awaitable2()) weechat_task_cb(future.id, "data") - assert not slack.active_tasks - assert slack.active_responses == { + assert not shared.active_tasks + assert shared.active_responses == { task.id: ("awaitable2", ("awaitable1", ("data",))) } def test_run_two_tasks_concurrently(): - slack.active_tasks = {} - slack.active_responses = {} + shared.active_tasks = {} + shared.active_responses = {} future1 = Future[str]() future2 = Future[str]() @@ -55,8 +55,8 @@ def test_run_two_tasks_concurrently(): weechat_task_cb(future1.id, "data1") weechat_task_cb(future2.id, "data2") - assert not slack.active_tasks - assert slack.active_responses == { + assert not shared.active_tasks + assert shared.active_responses == { task1.id: ("awaitable", ("data1",)), task2.id: ("awaitable", ("data2",)), } |