From 6687b35b465d8d853fa1980a1f3b76d2b7e064fc Mon Sep 17 00:00:00 2001 From: Manpreet Kaur Date: Tue, 26 Jan 2021 13:53:00 +0530 Subject: [PATCH] Move heat-translator to new hacking 4.0.0 Hacking 4.0.0 has introduce new optimal assert checks. Please refer [1] for more details. Additionally Hacking has enabled some new checks by default, and the next update to the new release will introduce failures in heat-translator pep8 jobs. The main impact is from I122d250cab90964c346e9d53046a97c25054bc00. This patch adopts new optimal assert check. [H211]: Change assertTrue(isinstance(A, B)) to assertIsInstance(A, B). On bumping up the hacking version, below mention pep8 jobs failed. This patch address the issues now, when the new hacking release starts being used it will not cause a disruption. pep8 run-test: commands[0] | flake8 ./translator/tests/test_utils.py:51:13: H211: Use assert{Is,IsNot}instance self.assertTrue( [1] https://docs.openstack.org/releasenotes/hacking/unreleased.html#relnotes-4-0-0 Change-Id: Iae79b8c5c6873d6bf5f6ef1b427dc8c60bade03f --- test-requirements.txt | 2 +- translator/tests/test_utils.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index ba647a72..c1aad15c 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,7 +1,7 @@ # 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>=4.0.0,<4.1.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD oslotest>=3.2.0 # Apache-2.0 diff --git a/translator/tests/test_utils.py b/translator/tests/test_utils.py index 555555b7..71b187b5 100644 --- a/translator/tests/test_utils.py +++ b/translator/tests/test_utils.py @@ -48,8 +48,7 @@ class CommonUtilsTest(TestCase): try: self.MemoryUnit.validate_unit(unit) except Exception as err: - self.assertTrue( - isinstance(err, ValueError)) + self.assertIsInstance(err, ValueError) self.assertEqual(exp_msg, err.__str__()) def test_unit_size_conversion_to_GNU_standard(self):