From 7f629facb4450e442d9fab6ab323de81dbbed48b Mon Sep 17 00:00:00 2001 From: Eric Harney Date: Tue, 18 Oct 2022 10:47:43 -0400 Subject: [PATCH] Hacking: Remove C306, C308 checks These block usage of methods that no longer exist in oslo.utils 6.0.0+. Since they have been removed, we don't need a hacking check for this. Change-Id: If0345c863b1750eaca3097f240fde9b976ac442e --- HACKING.rst | 2 -- cinder/tests/hacking/checks.py | 16 ---------------- cinder/tests/unit/test_hacking.py | 6 ------ requirements.txt | 2 +- tox.ini | 2 -- 5 files changed, 1 insertion(+), 27 deletions(-) diff --git a/HACKING.rst b/HACKING.rst index cf364c8dd30..e67efbead7a 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -13,8 +13,6 @@ Cinder Specific Commandments datetime.now(). - [C303] Ensure that there are no 'print()' statements are used in code that should be using LOG calls. -- [C306] timeutils.strtime() must not be used (deprecated). -- [C308] timeutils.isotime() must not be used (deprecated). - [C309] Unit tests should not perform logging. - [C310] Check for improper use of logging format arguments. - [C311] Check for proper naming and usage in option registration. diff --git a/cinder/tests/hacking/checks.py b/cinder/tests/hacking/checks.py index ca3d848a68a..84bfe5653a0 100644 --- a/cinder/tests/hacking/checks.py +++ b/cinder/tests/hacking/checks.py @@ -325,14 +325,6 @@ def check_no_print_statements(logical_line, filename, noqa): yield(0, msg) -@core.flake8ext -def check_timeutils_strtime(logical_line): - msg = ("C306: Found timeutils.strtime(). " - "Please use datetime.datetime.isoformat() or datetime.strftime()") - if 'timeutils.strtime' in logical_line: - yield(0, msg) - - @core.flake8ext def dict_constructor_with_list_copy(logical_line): msg = ("N336: Must use a dict comprehension instead of a dict constructor " @@ -341,14 +333,6 @@ def dict_constructor_with_list_copy(logical_line): yield (0, msg) -@core.flake8ext -def check_timeutils_isotime(logical_line): - msg = ("C308: Found timeutils.isotime(). " - "Please use datetime.datetime.isoformat()") - if 'timeutils.isotime' in logical_line: - yield(0, msg) - - @core.flake8ext def no_test_log(logical_line, filename, noqa): if ('cinder/tests' not in filename or noqa): diff --git a/cinder/tests/unit/test_hacking.py b/cinder/tests/unit/test_hacking.py index d7bfd92daab..30b1778797d 100644 --- a/cinder/tests/unit/test_hacking.py +++ b/cinder/tests/unit/test_hacking.py @@ -231,12 +231,6 @@ class HackingTestCase(test.TestCase): self.assertEqual(0, len(list(checks.check_datetime_now( "datetime.now() # noqa", True)))) - def test_check_timeutils_strtime(self): - self.assertEqual(1, len(list(checks.check_timeutils_strtime( - "timeutils.strtime")))) - self.assertEqual(0, len(list(checks.check_timeutils_strtime( - "strftime")))) - def test_no_print_statements(self): self.assertEqual(0, len(list(checks.check_no_print_statements( "a line with no print statement", diff --git a/requirements.txt b/requirements.txt index 62f69539c3d..b3cbe372754 100644 --- a/requirements.txt +++ b/requirements.txt @@ -28,7 +28,7 @@ oslo.rootwrap>=6.2.0 # Apache-2.0 oslo.serialization>=4.2.0 # Apache-2.0 oslo.service>=2.8.0 # Apache-2.0 oslo.upgradecheck>=1.1.1 # Apache-2.0 -oslo.utils>=4.12.1 # Apache-2.0 +oslo.utils>=6.0.0 # Apache-2.0 oslo.versionedobjects>=2.4.0 # Apache-2.0 osprofiler>=3.4.0 # Apache-2.0 packaging>=20.4 diff --git a/tox.ini b/tox.ini index 25e262c091a..a80505cc034 100644 --- a/tox.ini +++ b/tox.ini @@ -265,8 +265,6 @@ extension = N323 = checks:check_explicit_underscore_import C301 = checks:check_datetime_now C303 = checks:check_no_print_statements - C306 = checks:check_timeutils_strtime - C308 = checks:check_timeutils_isotime C309 = checks:no_test_log C310 = checks:CheckLoggingFormatArgs C311 = checks:CheckOptRegistrationArgs