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: If75153300f07e6d1c5bf433af35a0dd4d98e6c7f
This commit is contained in:
Andreas Jaeger 2020-04-02 15:01:37 +02:00
parent fd21b6e096
commit 4445f3296b
7 changed files with 12 additions and 12 deletions

View File

@ -63,6 +63,7 @@ def run_one(runner, cmd):
assert code == 0, "Command failed" assert code == 0, "Command failed"
return __inner return __inner
runners = [ runners = [
("{0}", run_plain), ("{0}", run_plain),
("sudo {0}", run_sudo), ("sudo {0}", run_sudo),
@ -109,5 +110,6 @@ def main():
atexit.register(run_sudo, ["ip", "netns", "delete", "bench_ns"]) atexit.register(run_sudo, ["ip", "netns", "delete", "bench_ns"])
run_bench('ip netns exec bench_ns ip a'.split(), runners[1:]) run_bench('ip netns exec bench_ns ip a'.split(), runners[1:])
if __name__ == "__main__": if __name__ == "__main__":
main() main()

View File

@ -7,11 +7,9 @@ dulwich==0.15.0
eventlet==0.18.2 eventlet==0.18.2
extras==1.0.0 extras==1.0.0
fixtures==3.0.0 fixtures==3.0.0
flake8==2.5.5
gitdb==0.6.4 gitdb==0.6.4
GitPython==1.0.1 GitPython==1.0.1
greenlet==0.4.10 greenlet==0.4.10
hacking==0.12.0
imagesize==0.7.1 imagesize==0.7.1
iso8601==0.1.11 iso8601==0.1.11
Jinja2==2.10 Jinja2==2.10
@ -24,8 +22,6 @@ openstackdocstheme==1.20.0
os-client-config==1.28.0 os-client-config==1.28.0
oslotest==3.2.0 oslotest==3.2.0
pbr==2.0.0 pbr==2.0.0
pep8==1.5.7
pyflakes==0.8.1
Pygments==2.2.0 Pygments==2.2.0
python-mimeparse==1.6.0 python-mimeparse==1.6.0
python-subunit==1.0.0 python-subunit==1.0.0

View File

@ -96,6 +96,7 @@ class JsonListener(object):
def get_accepted(self): def get_accepted(self):
return self._accepted return self._accepted
if hasattr(managers.Server, 'accepter'): if hasattr(managers.Server, 'accepter'):
# In Python 3 accepter() thread has infinite loop. We break it with # In Python 3 accepter() thread has infinite loop. We break it with
# EOFError, so we should silence this error here. # EOFError, so we should silence this error here.
@ -118,10 +119,10 @@ class JsonConnection(object):
self._socket.sendall(s) self._socket.sendall(s)
def recv_bytes(self, maxsize=None): def recv_bytes(self, maxsize=None):
l = struct.unpack('!Q', self.recvall(8))[0] item = struct.unpack('!Q', self.recvall(8))[0]
if maxsize is not None and l > maxsize: if maxsize is not None and item > maxsize:
raise RuntimeError("Too big message received") raise RuntimeError("Too big message received")
s = self.recvall(l) s = self.recvall(item)
return s return s
def send(self, obj): def send(self, obj):

View File

@ -49,6 +49,7 @@ class nonclosing(object):
def close(self): def close(self):
pass pass
log_format = ("%(asctime)s | [%(process)5s]+%(levelname)5s | " log_format = ("%(asctime)s | [%(process)5s]+%(levelname)5s | "
"%(message)s") "%(message)s")
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -398,7 +398,7 @@ class RootwrapTestCase(testtools.TestCase):
def test_ChainingRegExpFilter_match(self): def test_ChainingRegExpFilter_match(self):
filter_list = [filters.ChainingRegExpFilter('nice', 'root', filter_list = [filters.ChainingRegExpFilter('nice', 'root',
'nice', '-?\d+'), 'nice', r'-?\d+'),
filters.CommandFilter('cat', 'root')] filters.CommandFilter('cat', 'root')]
args = ['nice', '5', 'cat', '/a'] args = ['nice', '5', 'cat', '/a']
dirs = ['/bin', '/usr/bin'] dirs = ['/bin', '/usr/bin']
@ -407,7 +407,7 @@ class RootwrapTestCase(testtools.TestCase):
def test_ChainingRegExpFilter_not_match(self): def test_ChainingRegExpFilter_not_match(self):
filter_list = [filters.ChainingRegExpFilter('nice', 'root', filter_list = [filters.ChainingRegExpFilter('nice', 'root',
'nice', '-?\d+'), 'nice', r'-?\d+'),
filters.CommandFilter('cat', 'root')] filters.CommandFilter('cat', 'root')]
args_invalid = (['nice', '5', 'ls', '/a'], args_invalid = (['nice', '5', 'ls', '/a'],
['nice', '--5', 'cat', '/a'], ['nice', '--5', 'cat', '/a'],

View File

@ -2,7 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration # of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later. # 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
fixtures>=3.0.0 # Apache-2.0/BSD fixtures>=3.0.0 # Apache-2.0/BSD
testtools>=2.2.0 # MIT testtools>=2.2.0 # MIT

View File

@ -50,9 +50,9 @@ commands =
[flake8] [flake8]
# E731 skipped as assign a lambda expression # E731 skipped as assign a lambda expression
# W504 line break after binary operator
show-source = True show-source = True
ignore = E731 ignore = E731,W504
exclude = .tox,dist,doc,*.egg,build exclude = .tox,dist,doc,*.egg,build
[testenv:benchmark] [testenv:benchmark]