From ec959ea8bc9d576d76c092e75e6bc1f2422758cf Mon Sep 17 00:00:00 2001
From: jacky06 <zhang.min@99cloud.net>
Date: Wed, 6 Mar 2019 22:16:11 +0800
Subject: [PATCH] Update hacking version

Use latest release 1.1.0 and compatible changes w.r.t pep8

It's worth noting that the pep8 package has been renamed to
pycodestyle. New hacking packages no longer install the old pep8
package automatically.

Change-Id: Ibbad8b42188ade597d9a3032389e930c2f5fe2d0
---
 lower-constraints.txt             |  4 ++--
 os_win/tests/unit/test_hacking.py | 14 +++++++-------
 os_win/utils/baseutils.py         |  6 +++---
 test-requirements.txt             |  2 +-
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/lower-constraints.txt b/lower-constraints.txt
index 6c41cb0a..65af77a5 100644
--- a/lower-constraints.txt
+++ b/lower-constraints.txt
@@ -10,9 +10,9 @@ eventlet==0.18.2
 extras==1.0.0
 fasteners==0.7.0
 fixtures==3.0.0
-flake8==2.5.5
+flake8==2.6.0
 greenlet==0.4.10
-hacking==0.12.0
+hacking==1.1.0
 imagesize==0.7.1
 iso8601==0.1.11
 Jinja2==2.10
diff --git a/os_win/tests/unit/test_hacking.py b/os_win/tests/unit/test_hacking.py
index 5b153519..443f51bc 100644
--- a/os_win/tests/unit/test_hacking.py
+++ b/os_win/tests/unit/test_hacking.py
@@ -18,7 +18,7 @@ import os
 import textwrap
 
 import mock
-import pep8
+import pycodestyle
 
 from os_win._hacking import checks
 from os_win.tests.unit import test_base
@@ -58,20 +58,20 @@ class HackingTestCase(test_base.OsWinBaseTestCase):
     """
 
     def _run_check(self, code, checker, filename=None):
-        # We are patching pep8 so that only the check under test is actually
-        # installed.
+        # We are patching pycodestyle (pep8) so that only the check under test
+        # is actually installed.
         mock_checks = {'physical_line': {}, 'logical_line': {}, 'tree': {}}
-        with mock.patch('pep8._checks', mock_checks):
-            pep8.register_check(checker)
+        with mock.patch('pycodestyle._checks', mock_checks):
+            pycodestyle.register_check(checker)
 
             lines = textwrap.dedent(code).strip().splitlines(True)
 
-            checker = pep8.Checker(filename=filename, lines=lines)
+            checker = pycodestyle.Checker(filename=filename, lines=lines)
             # NOTE(sdague): the standard reporter has printing to stdout
             # as a normal part of check_all, which bleeds through to the
             # test output stream in an unhelpful way. This blocks that
             # printing.
-            with mock.patch('pep8.StandardReport.get_file_results'):
+            with mock.patch('pycodestyle.StandardReport.get_file_results'):
                 checker.check_all()
             checker.report._deferred_print.sort()
             return checker.report._deferred_print
diff --git a/os_win/utils/baseutils.py b/os_win/utils/baseutils.py
index 5aa304dc..d9f2b146 100644
--- a/os_win/utils/baseutils.py
+++ b/os_win/utils/baseutils.py
@@ -23,12 +23,12 @@ import sys
 import threading
 import time
 
-if sys.platform == 'win32':
-    import wmi
-
 from oslo_log import log as logging
 from oslo_utils import reflection
 
+if sys.platform == 'win32':
+    import wmi
+
 LOG = logging.getLogger(__name__)
 
 
diff --git a/test-requirements.txt b/test-requirements.txt
index 48a42323..f399d41f 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -2,7 +2,7 @@
 # of appearance. Changing the order has an impact on the overall integration
 # process, which may cause wedges in the gate later.
 
-hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
+hacking>=1.1.0,<1.2.0 # Apache-2.0
 
 coverage!=4.4,>=4.0 # Apache-2.0
 ddt>=1.0.1 # MIT