diff --git a/doc/requirements.txt b/doc/requirements.txt index d7b5677e7..b8bdb5bdb 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,6 +1,3 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. oslo.config>=5.2.0 # Apache-2.0 openstackdocstheme>=2.2.1 # Apache-2.0 sphinx>=2.0.0,!=2.1.0 # BSD diff --git a/requirements.txt b/requirements.txt index 1a7e7c975..d1fff57e9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,3 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. - pbr>=3.1.1 # Apache-2.0 alembic>=0.9.8 # MIT cachetools>=2.0.1 # MIT License diff --git a/test-requirements.txt b/test-requirements.txt index ef2c93017..ddec8c0fc 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,8 +1,4 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. - -hacking>=3.0.1,<3.1.0 # Apache-2.0 +hacking>=7.0.0,<7.1.0 # Apache-2.0 coverage>=4.5.1 # Apache-2.0 python-subunit>=1.2.0 # Apache-2.0/BSD oslotest>=3.3.0 # Apache-2.0 @@ -12,4 +8,4 @@ testtools>=2.3.0 # MIT stestr>=2.0.0 # Apache-2.0 reno>=3.1.0 # Apache-2.0 zake>=0.1.6 # Apache-2.0 -WebTest>= 3.0.0 # Apache-2.0 \ No newline at end of file +WebTest>= 3.0.0 # Apache-2.0 diff --git a/vitrage/api/controllers/v1/template.py b/vitrage/api/controllers/v1/template.py index 0d7be7b34..658eb7e7f 100644 --- a/vitrage/api/controllers/v1/template.py +++ b/vitrage/api/controllers/v1/template.py @@ -91,7 +91,7 @@ class TemplateController(RootRestController): @pecan.expose('json') def delete(self, **kwargs): # for backward computability - values = kwargs['uuid'] if 'uuid'in kwargs else kwargs['id'] + values = kwargs['uuid'] if 'uuid' in kwargs else kwargs['id'] LOG.info("delete template. values: %s", values) uuids = self._to_uuids(values) LOG.info("delete template. uuids: %s", uuids) diff --git a/vitrage/api_handler/apis/template.py b/vitrage/api_handler/apis/template.py index 7c6ebc943..3becaca2c 100644 --- a/vitrage/api_handler/apis/template.py +++ b/vitrage/api_handler/apis/template.py @@ -90,7 +90,7 @@ class TemplateApis(object): """ db = self.db - if type(uuids) != list: + if not isinstance(uuids, list): uuids = [uuids] LOG.info("Deleting templates %s ", uuids) templates = [t for _id in uuids for t in db.templates.query(uuid=_id) diff --git a/vitrage/hacking/checks.py b/vitrage/hacking/checks.py index 9fca9972f..f8a5e8bd9 100644 --- a/vitrage/hacking/checks.py +++ b/vitrage/hacking/checks.py @@ -77,7 +77,7 @@ def check_no_contextlib_nested(logical_line): "nested for more information.") if ("with contextlib.nested(" in logical_line or "with nested(" in logical_line): - yield(0, msg) + yield (0, msg) @core.flake8ext @@ -91,8 +91,8 @@ def dict_constructor_with_list_copy(logical_line): @core.flake8ext def check_python3_xrange(logical_line): if re.search(r"\bxrange\s*\(", logical_line): - yield(0, "V323: Do not use xrange. Use range, or six.moves.range for " - "large loops.") + yield (0, "V323: Do not use xrange. Use range, or six.moves.range for " + "large loops.") @core.flake8ext @@ -100,7 +100,7 @@ def check_python3_no_iteritems(logical_line): msg = ("V324: Use six.iteritems() or dict.items() instead of " "dict.iteritems().") if re.search(r".*\.iteritems\(\)", logical_line): - yield(0, msg) + yield (0, msg) @core.flake8ext @@ -108,7 +108,7 @@ def check_python3_no_iterkeys(logical_line): msg = ("V325: Use six.iterkeys() or dict.keys() instead of " "dict.iterkeys().") if re.search(r".*\.iterkeys\(\)", logical_line): - yield(0, msg) + yield (0, msg) @core.flake8ext @@ -116,7 +116,7 @@ def check_python3_no_itervalues(logical_line): msg = ("V326: Use six.itervalues() or dict.values instead of " "dict.itervalues().") if re.search(r".*\.itervalues\(\)", logical_line): - yield(0, msg) + yield (0, msg) @core.flake8ext @@ -133,7 +133,7 @@ def no_log_warn(logical_line): V328 """ if logical_line.startswith('LOG.warn('): - yield(0, 'V328: Use LOG.warning() rather than LOG.warn()') + yield (0, 'V328: Use LOG.warning() rather than LOG.warn()') @core.flake8ext diff --git a/vitrage/storage/history_facade.py b/vitrage/storage/history_facade.py index a00031b2e..ed30b1fa7 100644 --- a/vitrage/storage/history_facade.py +++ b/vitrage/storage/history_facade.py @@ -293,12 +293,12 @@ class HistoryFacadeConnection(object): and_( or_( models.Alarm.project_id == project_id, - models.Alarm.project_id == None), + models.Alarm.project_id == None), # noqa: E711 or_( models.Alarm.vitrage_resource_project_id == project_id, - models.Alarm.vitrage_resource_project_id == None) - ))) # noqa + models.Alarm.vitrage_resource_project_id == None) # noqa: E501,E711 + ))) else: query = query.filter( or_(models.Alarm.project_id == project_id, @@ -315,7 +315,7 @@ class HistoryFacadeConnection(object): for i in range(len(filter_by)): key = filter_by[i] val = filter_vals[i] - val = val if val and type(val) == list else [val] + val = val if val and isinstance(val, list) else [val] cond = or_(*[getattr(models.Alarm, key).like( '%' + val[j] + '%') for j in range(len(val))]) query = query.filter(cond) diff --git a/vitrage/tests/functional/entity_graph/consistency/test_consistency.py b/vitrage/tests/functional/entity_graph/consistency/test_consistency.py index d5354ce27..f2763a72e 100644 --- a/vitrage/tests/functional/entity_graph/consistency/test_consistency.py +++ b/vitrage/tests/functional/entity_graph/consistency/test_consistency.py @@ -177,11 +177,11 @@ class TestConsistencyFunctional(TestFunctionalBase, TestConfiguration): _filter_vertices_to_be_marked_as_deleted(vertices) self.assertThat(vertices_to_mark_deleted, matchers.HasLength(3)) - self.assertTrue(static_vertex in vertices_to_mark_deleted) - self.assertTrue(placeholder_vertex in vertices_to_mark_deleted) - self.assertTrue(volume_vertex in vertices_to_mark_deleted) - self.assertFalse(prometheus_vertex in vertices_to_mark_deleted) - self.assertFalse(cluster_vertex in vertices_to_mark_deleted) + self.assertIn(static_vertex, vertices_to_mark_deleted) + self.assertIn(placeholder_vertex, vertices_to_mark_deleted) + self.assertIn(volume_vertex, vertices_to_mark_deleted) + self.assertNotIn(prometheus_vertex, vertices_to_mark_deleted) + self.assertNotIn(cluster_vertex, vertices_to_mark_deleted) def _assert_vertices_status(self, category, vitrage_type, num_vertices, num_marked_deleted): diff --git a/vitrage/tests/unit/evaluator/test_scenario_repository.py b/vitrage/tests/unit/evaluator/test_scenario_repository.py index fe51c92cf..6ad73ce19 100644 --- a/vitrage/tests/unit/evaluator/test_scenario_repository.py +++ b/vitrage/tests/unit/evaluator/test_scenario_repository.py @@ -77,11 +77,11 @@ class ScenarioRepositoryTest(base.BaseTest, TestConfiguration): # C: (A, B, C)} # Verify entity itself is also included. It is not required, but # worth noting when handling equivalence - self.assertTrue(entity_props in equivalence) + self.assertIn(entity_props, equivalence) for equivalent_props in equivalence: # Verify equivalent scenarios are present in repository - self.assertTrue(equivalent_props in - self.scenario_repository.entity_scenarios) + self.assertIn(equivalent_props, + self.scenario_repository.entity_scenarios) def test_get_scenario_by_edge(self): pass diff --git a/vitrage/tests/unit/graph/test_graph_algo.py b/vitrage/tests/unit/graph/test_graph_algo.py index 8c5b7e1a3..4fca66bbc 100644 --- a/vitrage/tests/unit/graph/test_graph_algo.py +++ b/vitrage/tests/unit/graph/test_graph_algo.py @@ -316,7 +316,7 @@ class GraphAlgorithmTest(GraphTestBase): for v in [t_v_host_alarm, t_v_host, t_v_vm, t_v_vm_alarm, t_v_switch, t_v_switch, t_v_node]: - del(v[VProps.VITRAGE_ID]) + del v[VProps.VITRAGE_ID] template_graph.add_vertex(t_v_alarm_fail) mappings = ga.sub_graph_matching(template_graph, @@ -630,7 +630,7 @@ class GraphAlgorithmTest(GraphTestBase): e_alarm_not_on_host[EProps.VITRAGE_IS_DELETED] = True for v in [t_v_alarm_fail, t_v_host, t_v_vm, t_v_vm_alarm]: - del(v[VProps.VITRAGE_ID]) + del v[VProps.VITRAGE_ID] # add host vertex to subgraph template_graph.add_vertex(t_v_host) @@ -848,7 +848,7 @@ class GraphAlgorithmTest(GraphTestBase): e_alarm_not_on_vm[EProps.VITRAGE_IS_DELETED] = True for v in [t_v_vm, t_v_vm_alarm]: - del(v[VProps.VITRAGE_ID]) + del v[VProps.VITRAGE_ID] # add instance vertex to subgraph template_graph.add_vertex(t_v_vm) @@ -1091,7 +1091,7 @@ class GraphAlgorithmTest(GraphTestBase): t_v_network.vertex_id, t_v_stack.vertex_id, ELabel.CONNECT) for v in [t_v_vm, t_v_alarm, t_v_network, t_v_stack]: - del(v[VProps.VITRAGE_ID]) + del v[VProps.VITRAGE_ID] # add network vertex to subgraph template_graph.add_vertex(t_v_network)