diff --git a/hacking/checks/python23.py b/hacking/checks/python23.py index d44d2579..b1233187 100644 --- a/hacking/checks/python23.py +++ b/hacking/checks/python23.py @@ -158,8 +158,11 @@ def hacking_python3x_metaclass(logical_line, noqa): if noqa: return split_line = logical_line.split() - if(len(split_line) > 2 and split_line[0] == '__metaclass__' and - split_line[1] == '='): + if ( + len(split_line) > 2 + and split_line[0] == '__metaclass__' + and split_line[1] == '=' + ): yield (logical_line.find('__metaclass__'), "H236: Python 3.x incompatible __metaclass__, " "use six.add_metaclass()") diff --git a/hacking/tests/test_doctest.py b/hacking/tests/test_doctest.py index 70f44acb..fbc8c3be 100644 --- a/hacking/tests/test_doctest.py +++ b/hacking/tests/test_doctest.py @@ -40,7 +40,8 @@ class HackingTestCase(hacking.tests.TestCase): f.write(''.join(self.lines)) cmd = [sys.executable, '-mflake8', '--isolated', - '--select=%s' % self.code, '--ignore=F', + '--select=%s' % self.code, + '--enable-extensions=%s' % self.code, '--ignore=F', '--format=%(code)s\t%(path)s\t%(row)d', f.name] out, _ = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate() @@ -52,6 +53,7 @@ class HackingTestCase(hacking.tests.TestCase): self.addDetail('reason', content.text_content("Failed to trigger rule %s" % self.code)) + self.assertNotEqual('', out) self.assertEqual(self.code, out.split('\t')[0].rstrip(':'), out) diff --git a/requirements.txt b/requirements.txt index 0c5f0f97..6f081d02 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -flake8~=4.0.1 # MIT +flake8~=5.0.1 # MIT