summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Jaeger <aj@suse.com>2020-04-02 15:08:30 +0200
committerAndreas Jaeger <aj@suse.com>2020-04-02 15:10:56 +0200
commitd90726a1eb1058d88f328b063e5d062198f9ca0c (patch)
treed8d7cd5551b0e67c22d2419a017c13db736e5d3f
parent8433aba4d6b5925fa8fb223d51a816ff541f1f2f (diff)
downloadoslo-utils-d90726a1eb1058d88f328b063e5d062198f9ca0c.tar.gz
Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which supports Python 3. Fix problems found. Remove hacking and friends from lower-constraints, they are not needed for installation. Change-Id: I3f23bf09ef24fe34e128102c34382da98e10f5c1
-rw-r--r--lower-constraints.txt4
-rw-r--r--oslo_utils/imageutils.py2
-rw-r--r--oslo_utils/secretutils.py1
-rw-r--r--oslo_utils/tests/test_imageutils.py2
-rw-r--r--oslo_utils/tests/test_strutils.py1
-rw-r--r--test-requirements.txt2
-rw-r--r--tools/perf_test_mask_password.py2
-rw-r--r--tox.ini3
8 files changed, 9 insertions, 8 deletions
diff --git a/lower-constraints.txt b/lower-constraints.txt
index c27fe46..57f2769 100644
--- a/lower-constraints.txt
+++ b/lower-constraints.txt
@@ -7,11 +7,9 @@ debtcollector==1.2.0
eventlet==0.18.2
extras==1.0.0
fixtures==3.0.0
-flake8==2.5.5
funcsigs==1.0.0
gitdb==0.6.4
GitPython==1.0.1
-hacking==0.12.0
iso8601==0.1.11
keystoneauth1==3.4.0
linecache2==1.0.0
@@ -24,8 +22,6 @@ oslo.config==5.2.0
oslo.i18n==3.15.3
oslotest==3.2.0
pbr==2.0.0
-pep8==1.5.7
-pyflakes==0.8.1
pyparsing==2.1.0
python-mimeparse==1.6.0
python-subunit==1.0.0
diff --git a/oslo_utils/imageutils.py b/oslo_utils/imageutils.py
index 82ea29d..fc7b494 100644
--- a/oslo_utils/imageutils.py
+++ b/oslo_utils/imageutils.py
@@ -45,7 +45,7 @@ class QemuImgInfo(object):
r"\s+(.*?)\)\s*$"), re.I)
TOP_LEVEL_RE = re.compile(r"^([\w\d\s\_\-]+):(.*)$")
SIZE_RE = re.compile(r"([0-9]+[eE][-+][0-9]+|\d*\.?\d+)"
- "\s*(\w+)?(\s*\(\s*(\d+)\s+bytes\s*\))?",
+ r"\s*(\w+)?(\s*\(\s*(\d+)\s+bytes\s*\))?",
re.I)
def __init__(self, cmd_output=None, format='human'):
diff --git a/oslo_utils/secretutils.py b/oslo_utils/secretutils.py
index 963c634..ad350d2 100644
--- a/oslo_utils/secretutils.py
+++ b/oslo_utils/secretutils.py
@@ -39,6 +39,7 @@ def _constant_time_compare(first, second):
result |= ord(x) ^ ord(y)
return result == 0
+
try:
constant_time_compare = hmac.compare_digest
except AttributeError:
diff --git a/oslo_utils/tests/test_imageutils.py b/oslo_utils/tests/test_imageutils.py
index 3a6bfec..6b3a9fa 100644
--- a/oslo_utils/tests/test_imageutils.py
+++ b/oslo_utils/tests/test_imageutils.py
@@ -137,6 +137,7 @@ class ImageUtilsRawTestCase(test_base.BaseTestCase):
image_info = imageutils.QemuImgInfo(example_output)
self._base_validation(image_info)
+
ImageUtilsRawTestCase.generate_scenarios()
@@ -203,6 +204,7 @@ class ImageUtilsQemuTestCase(ImageUtilsRawTestCase):
if self.encrypted is not None:
self.assertEqual(image_info.encrypted, self.encrypted)
+
ImageUtilsQemuTestCase.generate_scenarios()
diff --git a/oslo_utils/tests/test_strutils.py b/oslo_utils/tests/test_strutils.py
index 25e974c..a63ef23 100644
--- a/oslo_utils/tests/test_strutils.py
+++ b/oslo_utils/tests/test_strutils.py
@@ -291,6 +291,7 @@ class StringToBytesTest(test_base.BaseTestCase):
else:
self.assertAlmostEqual(actual, expected)
+
StringToBytesTest.generate_scenarios()
diff --git a/test-requirements.txt b/test-requirements.txt
index ce63b70..ff549ff 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>=1.1.0,<1.2.0 # Apache-2.0
+hacking>=3.0,<3.1.0 # Apache-2.0
eventlet>=0.18.2,!=0.18.3,!=0.20.1,!=0.21.0,!=0.23.0 # MIT
fixtures>=3.0.0 # Apache-2.0/BSD
diff --git a/tools/perf_test_mask_password.py b/tools/perf_test_mask_password.py
index f69a734..e470766 100644
--- a/tools/perf_test_mask_password.py
+++ b/tools/perf_test_mask_password.py
@@ -37,7 +37,7 @@ print('payload has %d bytes' % len(input_str))
for pattern in strutils._SANITIZE_PATTERNS_2['admin_pass']:
print('\ntesting %s' % pattern.pattern)
t = timeit.Timer(
- "re.sub(pattern, r'\g<1>***\g<2>', payload)",
+ r"re.sub(pattern, r'\g<1>***\g<2>', payload)",
"""
import re
payload = '''%s'''
diff --git a/tox.ini b/tox.ini
index abffbe1..7297a5a 100644
--- a/tox.ini
+++ b/tox.ini
@@ -37,7 +37,8 @@ commands = bandit -r oslo_utils -x tests -n5
[flake8]
# E731 skipped as assign a lambda expression
-ignore = E123,E731,H405
+# W504 line break after binary operator
+ignore = E123,E731,H405,W504
show-source = True
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,__init__.py