From 019848706280cbdc4877df630a52dc1f36ad6c27 Mon Sep 17 00:00:00 2001 From: Martin Chacon Piza Date: Tue, 21 Jul 2020 14:21:58 +0200 Subject: [PATCH] Remove unnecessary test to bring compatibility with py38 Change-Id: If58a9a60a6428ad362789f354f8f4a750210b9a8 --- .../tests/test_token_range_query_manager.py | 62 ------------------- 1 file changed, 62 deletions(-) delete mode 100644 monasca_persister/tests/test_token_range_query_manager.py diff --git a/monasca_persister/tests/test_token_range_query_manager.py b/monasca_persister/tests/test_token_range_query_manager.py deleted file mode 100644 index 3bb0b418..00000000 --- a/monasca_persister/tests/test_token_range_query_manager.py +++ /dev/null @@ -1,62 +0,0 @@ -# (C) Copyright 2019 Fujitsu Limited -# -# 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 unittest import mock - -from oslotest import base - -from monasca_persister.repositories.cassandra.token_range_query_manager \ - import TokenRangeQueryManager - - -class FakeException(Exception): - pass - - -class TestTokenRangeQueryManager(base.BaseTestCase): - - def setUp(self): - super(TestTokenRangeQueryManager, self).setUp() - self._set_patchers() - self._set_mocks() - - cql, result_handler = mock.Mock, mock.Mock() - self.token_range_query_mgr = TokenRangeQueryManager(cql, result_handler, process_count=1) - - def _set_patchers(self): - self.patcher_setup = mock.patch.object(TokenRangeQueryManager, - '_setup', - return_value=None) - - def _set_mocks(self): - self.mock_setup = self.patcher_setup.start() - - def tearDown(self): - super(TestTokenRangeQueryManager, self).tearDown() - self.mock_setup.reset_mock() - self.patcher_setup.stop() - - def test_close_pool(self): - with mock.patch.object(self.token_range_query_mgr._pool, 'join', - side_effect=None): - self.assertIsNone(self.token_range_query_mgr.close_pool()) - - def test_query(self): - with mock.patch.object(self.token_range_query_mgr._pool, 'map', - side_effect=FakeException): - sample_element = mock.Mock() - sample_element.value = 1 - token_ring = [sample_element, sample_element] - self.assertRaises(FakeException, self.token_range_query_mgr.query, token_ring)