Making sure we're ready for python3
Adds py37 to the env list and switches pep8 python to python3, including necessary changes to make pylint and pep8 checks happy in python3: * Unpins pylint, as 1.4.5 explodes (exception) when trying to check our code. * Unpins flake8-import-order from an old version. * Stops making use of the builtin cmp function, and replaces it with the recommended (a > b) - (a < b). * Disables one py3 specific warning, since it's still necessary for python2 (useless-object-inheritance) * Removes a non existing argument in netprobe parser (version). * Inserts an additional blank line between __future__ imports and stdlib imports. Change-Id: If4a45108fe93080f9967e2ac26d681b8dd5c7fc2
This commit is contained in:
parent
352a5ab8f2
commit
20645e4f9a
|
@ -82,7 +82,8 @@ disable=
|
|||
too-many-nested-blocks,
|
||||
too-many-public-methods,
|
||||
too-many-return-statements,
|
||||
too-many-statements
|
||||
too-many-statements,
|
||||
useless-object-inheritance
|
||||
|
||||
[BASIC]
|
||||
# Variable names can be 1 to 31 characters long, with lowercase and underscores
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
# under the License.
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
from datetime import datetime, timedelta
|
||||
import hashlib
|
||||
|
@ -110,7 +111,8 @@ class LogEntry(object):
|
|||
self.data += EXTRALINES_PADDING + line
|
||||
|
||||
def __cmp__(self, other):
|
||||
return cmp(self.dt, other.dt) * 2 + cmp(self.alias, other.alias)
|
||||
return (self._cmp(self.dt, other.dt) * 2 +
|
||||
self._cmp(self.alias, other.alias))
|
||||
|
||||
def __lt__(self, other):
|
||||
return self.dt < other.dt or (self.dt == other.dt and
|
||||
|
@ -119,6 +121,10 @@ class LogEntry(object):
|
|||
def __str__(self):
|
||||
return '%s [%s] %s' % (self.dt_str, self.alias, self.data.rstrip('\n'))
|
||||
|
||||
@staticmethod
|
||||
def _cmp(a, b):
|
||||
return (a > b) - (a < b)
|
||||
|
||||
|
||||
class LogParser(object):
|
||||
def __init__(self, filename, cfg):
|
||||
|
|
|
@ -135,7 +135,7 @@ the tcpdumps goes in a single openstack-like log.
|
|||
|
||||
general_epilog = ""
|
||||
|
||||
parser = MyParser(description=general_description, version=__version__,
|
||||
parser = MyParser(description=general_description,
|
||||
epilog=general_epilog, argument_default='',
|
||||
formatter_class=argparse.RawTextHelpFormatter)
|
||||
parser.add_argument('--netns-re', '-n', dest='netns_regex',
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
flake8
|
||||
flake8-import-order==0.12 # LGPLv3
|
||||
flake8-import-order # LGPLv3
|
||||
mock>=2.0.0 # BSD
|
||||
python-subunit>=0.0.18 # Apache-2.0/BSD
|
||||
testtools>=1.4.0 # MIT
|
||||
oslotest>=1.10.0 # Apache-2.0
|
||||
os-testr>=1.0.0 # Apache-2.0
|
||||
pylint==1.4.5 # GPLv2
|
||||
pylint # GPLv2
|
||||
|
|
4
tox.ini
4
tox.ini
|
@ -1,5 +1,5 @@
|
|||
[tox]
|
||||
envlist = py35,py36,py27,pep8
|
||||
envlist = py35,py36,py37,py27,pep8
|
||||
minversion = 2.3.2
|
||||
skipsdist = True
|
||||
|
||||
|
@ -24,7 +24,7 @@ setenv = OS_TEST_TIMEOUT={env:OS_TEST_TIMEOUT:180}
|
|||
commands = false
|
||||
|
||||
[testenv:pep8]
|
||||
basepython = python2.7
|
||||
basepython = python3
|
||||
deps =
|
||||
{[testenv]deps}
|
||||
commands=
|
||||
|
|
Loading…
Reference in New Issue