From 5c72d323580603d31e743f9c58ca9a42cbf8fb1b Mon Sep 17 00:00:00 2001 From: Stanislav Bohm <spirali@kreatrix.org> Date: Tue, 14 Apr 2020 13:40:52 +0200 Subject: [PATCH] Check keep flag on gather --- quake/client/base/client.py | 2 ++ tests/test_wrapper.py | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/quake/client/base/client.py b/quake/client/base/client.py index 70a626d..be2d81c 100644 --- a/quake/client/base/client.py +++ b/quake/client/base/client.py @@ -69,5 +69,7 @@ class Client: def gather(self, task, output_id=None): logger.debug("Gathering task id=%s", task.task_id) + if not task.keep: + raise Exception("'keep' flag is not set for a task") loop = asyncio.get_event_loop() return loop.run_until_complete(self.connection.call("gather", task.task_id, output_id)) diff --git a/tests/test_wrapper.py b/tests/test_wrapper.py index cc4cc58..8ddcb32 100644 --- a/tests/test_wrapper.py +++ b/tests/test_wrapper.py @@ -74,9 +74,14 @@ def test_wrapper_wait_and_gather(client): assert quake.gather(f, collapse_single_output=False) == [[12, 13, 14, 15]] assert quake.gather(f) == [12, 13, 14, 15] assert quake.gather(f, 0) == [12, 13, 14, 15] - quake.remove(f) + f = my_const4() + quake.wait(f) + with pytest.raises(Exception, match="flag is not set"): + quake.gather(f) == [12, 13, 14, 15] + + def test_wrapper_args(client): quake.set_global_client(client) -- GitLab