From 5cd3edcaacb9de18604b71cc28ec640f8979e866 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Fri, 24 May 2024 10:23:01 -0500 Subject: [PATCH] Remove duplicate test fixture files These are not test files: - st2actions/tests/unit/test_async_runner.py - st2actions/tests/unit/test_polling_async_runner.py It looks like they were copied to st2tests/st2tests/mocks/runners/ at some point. Nothing imports from or uses the copies in st2actions, so just delete them. --- st2actions/tests/unit/test_async_runner.py | 54 ------------------- .../tests/unit/test_polling_async_runner.py | 54 ------------------- 2 files changed, 108 deletions(-) delete mode 100644 st2actions/tests/unit/test_async_runner.py delete mode 100644 st2actions/tests/unit/test_polling_async_runner.py diff --git a/st2actions/tests/unit/test_async_runner.py b/st2actions/tests/unit/test_async_runner.py deleted file mode 100644 index 31258fae4e..0000000000 --- a/st2actions/tests/unit/test_async_runner.py +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright 2020 The StackStorm Authors. -# Copyright 2019 Extreme Networks, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from __future__ import absolute_import - -try: - import simplejson as json -except: - import json - -from st2common.runners.base import AsyncActionRunner -from st2common.constants.action import LIVEACTION_STATUS_RUNNING - -RAISE_PROPERTY = "raise" - - -def get_runner(): - return AsyncTestRunner() - - -class AsyncTestRunner(AsyncActionRunner): - def __init__(self): - super(AsyncTestRunner, self).__init__(runner_id="1") - self.pre_run_called = False - self.run_called = False - self.post_run_called = False - - def pre_run(self): - self.pre_run_called = True - - def run(self, action_params): - self.run_called = True - result = {} - if self.runner_parameters.get(RAISE_PROPERTY, False): - raise Exception("Raise required.") - else: - result = {"ran": True, "action_params": action_params} - - return (LIVEACTION_STATUS_RUNNING, json.dumps(result), {"id": "foo"}) - - def post_run(self, status, result): - self.post_run_called = True diff --git a/st2actions/tests/unit/test_polling_async_runner.py b/st2actions/tests/unit/test_polling_async_runner.py deleted file mode 100644 index c48bb9aa67..0000000000 --- a/st2actions/tests/unit/test_polling_async_runner.py +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright 2020 The StackStorm Authors. -# Copyright 2019 Extreme Networks, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from __future__ import absolute_import - -try: - import simplejson as json -except: - import json - -from st2common.runners.base import PollingAsyncActionRunner -from st2common.constants.action import LIVEACTION_STATUS_RUNNING - -RAISE_PROPERTY = "raise" - - -def get_runner(): - return PollingAsyncTestRunner() - - -class PollingAsyncTestRunner(PollingAsyncActionRunner): - def __init__(self): - super(PollingAsyncTestRunner, self).__init__(runner_id="1") - self.pre_run_called = False - self.run_called = False - self.post_run_called = False - - def pre_run(self): - self.pre_run_called = True - - def run(self, action_params): - self.run_called = True - result = {} - if self.runner_parameters.get(RAISE_PROPERTY, False): - raise Exception("Raise required.") - else: - result = {"ran": True, "action_params": action_params} - - return (LIVEACTION_STATUS_RUNNING, json.dumps(result), {"id": "foo"}) - - def post_run(self, status, result): - self.post_run_called = True