summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-08-02 10:23:04 -0700
committerPatrick Totzke <patricktotzke@gmail.com>2018-08-02 20:33:47 +0100
commit4ca7f9ffce68d737642071f5dffaa78a738d8520 (patch)
tree20e60b4358be9857497e6ce873fa9baa3ab9d01b /tests
parentceaad927ca0e4509abea0c02d7af02b6406b55dd (diff)
commands/globals: Convert CallCommand.apply to a coroutine
This allows it to easily wrap calls that are themselves coroutines, while it's still able to wrap synchronous calls. This fixes the async test and allows hooks that are coroutines to work.
Diffstat (limited to 'tests')
-rw-r--r--tests/commands/global_test.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/commands/global_test.py b/tests/commands/global_test.py
index 1122b3f7..48ddd34d 100644
--- a/tests/commands/global_test.py
+++ b/tests/commands/global_test.py
@@ -246,14 +246,15 @@ class TestExternalCommand(unittest.TestCase):
class TestCallCommand(unittest.TestCase):
- def test_synchronous_call(self):
+ @utilities.async_test
+ async def test_synchronous_call(self):
ui = mock.Mock()
cmd = g_commands.CallCommand('ui()')
- cmd.apply(ui)
+ await cmd.apply(ui)
ui.assert_called_once()
- @unittest.expectedFailure
- def test_async_call(self):
+ @utilities.async_test
+ async def test_async_call(self):
async def func(obj):
obj()
@@ -264,5 +265,5 @@ class TestCallCommand(unittest.TestCase):
with mock.patch('alot.commands.globals.settings.hooks', hooks):
cmd = g_commands.CallCommand('hooks.func(ui)')
- cmd.apply(ui)
+ await cmd.apply(ui)
ui.assert_called_once()