Update controllerconfig testenv to use python3 by default
Change pylint, flake and cover testenvs from python2.7 to python3. Change installed version of pylint and isort for tests to be the same as the ones used in sysinv. Previously no version was pinned when using python3. Add pylint to deps. Part of this was work was neccessary to fix flake8 and pylint errors: - Add inline pylint suppressions. - The Request object add_data method doesn't exist anymore. Use direct access to data field instead. - Remove whitespace between print function and '('. Story: 2008454 Task: 42675 Task: 42617 Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com> Change-Id: Icfae48dbbcd8efa4abb1a557a91bf1c58c5cb5bc
This commit is contained in:
parent
1fda925b50
commit
ac389b4b2b
|
@ -22,19 +22,19 @@ class ConfigError(Exception):
|
|||
|
||||
class ValidateFail(ConfigError):
|
||||
"""Validation of data failed."""
|
||||
pass
|
||||
pass # pylint: disable=unnecessary-pass
|
||||
|
||||
|
||||
class UpgradeFail(ConfigError):
|
||||
"""Upgrade error."""
|
||||
pass
|
||||
pass # pylint: disable=unnecessary-pass
|
||||
|
||||
|
||||
class KeystoneFail(ConfigError):
|
||||
"""Keystone error."""
|
||||
pass
|
||||
pass # pylint: disable=unnecessary-pass
|
||||
|
||||
|
||||
class TidyStorageFail(ConfigError):
|
||||
"""Tidy storage error."""
|
||||
pass
|
||||
pass # pylint: disable=unnecessary-pass
|
||||
|
|
|
@ -35,7 +35,7 @@ def rest_api_request(token, method, api_cmd, api_cmd_headers=None,
|
|||
|
||||
if api_cmd_payload is not None:
|
||||
request_info.add_header("Content-type", "application/json")
|
||||
request_info.add_data(api_cmd_payload)
|
||||
request_info.data = api_cmd_payload
|
||||
|
||||
request = urlrequest.urlopen(request_info)
|
||||
response = request.read()
|
||||
|
@ -94,7 +94,7 @@ def get_token(auth_url, auth_project, auth_user, auth_password,
|
|||
"domain": {"name": project_domain}
|
||||
}}}})
|
||||
|
||||
request_info.add_data(payload)
|
||||
request_info.data = payload
|
||||
|
||||
request = urlrequest.urlopen(request_info)
|
||||
# Identity API v3 returns token id in X-Subject-Token
|
||||
|
|
|
@ -62,7 +62,7 @@ def check_sm_service(service, state):
|
|||
try:
|
||||
output = subprocess.check_output(["sm-query", "service", service],
|
||||
universal_newlines=True)
|
||||
return state in output
|
||||
return state in output # pylint: disable=unsupported-membership-test
|
||||
except subprocess.CalledProcessError:
|
||||
return False
|
||||
|
||||
|
@ -324,7 +324,7 @@ def is_ssh_parent():
|
|||
try:
|
||||
cmd_output = subprocess.check_output(command, shell=True,
|
||||
universal_newlines=True)
|
||||
if "ssh" in cmd_output:
|
||||
if "ssh" in cmd_output: # pylint: disable=unsupported-membership-test
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
|
||||
pylint <=1.9.3;python_version<'3.0'
|
||||
pytest
|
||||
mockproc>= 0.3.1 # BSD
|
||||
coverage>=3.6
|
||||
|
@ -8,3 +7,6 @@ os-testr>=0.8.0 # Apache-2.0
|
|||
stestr>=1.0.0 # Apache-2.0
|
||||
testresources>=0.2.4 # Apache-2.0/BSD
|
||||
testrepository>=0.0.18 # Apache-2.0/BSD
|
||||
isort<5;python_version>="3.0"
|
||||
pylint<2.1.0;python_version<"3.0" # GPLv2
|
||||
pylint<2.4.0;python_version>="3.0" # GPLv2
|
||||
|
|
|
@ -45,12 +45,14 @@ commands =
|
|||
stestr slowest
|
||||
|
||||
[testenv:pylint]
|
||||
basepython = python2.7
|
||||
basepython = python3
|
||||
deps = {[testenv]deps}
|
||||
pylint
|
||||
|
||||
commands = pylint {posargs} controllerconfig --rcfile=./pylint.rc --extension-pkg-whitelist=netifaces
|
||||
|
||||
[testenv:flake8]
|
||||
basepython = python2.7
|
||||
basepython = python3
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
commands = flake8 {posargs}
|
||||
|
||||
|
@ -67,7 +69,7 @@ ignore = H101,H102,H104,H306,H401,H404,H405
|
|||
exclude = build
|
||||
|
||||
[testenv:cover]
|
||||
basepython = python2.7
|
||||
basepython = python3
|
||||
deps = {[testenv]deps}
|
||||
|
||||
commands =
|
||||
|
|
|
@ -34,7 +34,7 @@ def main():
|
|||
elif arg == 3:
|
||||
action = sys.argv[arg]
|
||||
else:
|
||||
print ("Invalid option %s." % sys.argv[arg])
|
||||
print("Invalid option %s." % sys.argv[arg])
|
||||
return 1
|
||||
arg += 1
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ def main():
|
|||
elif arg == 3:
|
||||
action = sys.argv[arg]
|
||||
else:
|
||||
print ("Invalid option %s." % sys.argv[arg])
|
||||
print("Invalid option %s." % sys.argv[arg])
|
||||
return 1
|
||||
arg += 1
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ def main():
|
|||
elif arg == 3:
|
||||
action = sys.argv[arg]
|
||||
else:
|
||||
print ("Invalid option %s." % sys.argv[arg])
|
||||
print("Invalid option %s." % sys.argv[arg])
|
||||
return 1
|
||||
arg += 1
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ def main():
|
|||
elif arg == 3:
|
||||
action = sys.argv[arg]
|
||||
else:
|
||||
print ("Invalid option %s." % sys.argv[arg])
|
||||
print("Invalid option %s." % sys.argv[arg])
|
||||
return 1
|
||||
arg += 1
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ def main():
|
|||
elif arg == 3:
|
||||
action = sys.argv[arg]
|
||||
else:
|
||||
print ("Invalid option %s." % sys.argv[arg])
|
||||
print("Invalid option %s." % sys.argv[arg])
|
||||
return 1
|
||||
arg += 1
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ def main():
|
|||
elif arg == 3:
|
||||
action = sys.argv[arg]
|
||||
else:
|
||||
print ("Invalid option %s." % sys.argv[arg])
|
||||
print("Invalid option %s." % sys.argv[arg])
|
||||
return 1
|
||||
arg += 1
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ def main():
|
|||
elif arg == 3:
|
||||
action = sys.argv[arg]
|
||||
else:
|
||||
print ("Invalid option %s." % sys.argv[arg])
|
||||
print("Invalid option %s." % sys.argv[arg])
|
||||
return 1
|
||||
arg += 1
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ def main():
|
|||
elif arg == 3:
|
||||
action = sys.argv[arg]
|
||||
else:
|
||||
print ("Invalid option %s." % sys.argv[arg])
|
||||
print("Invalid option %s." % sys.argv[arg])
|
||||
return 1
|
||||
arg += 1
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ def main():
|
|||
elif arg == 3:
|
||||
action = sys.argv[arg]
|
||||
else:
|
||||
print ("Invalid option %s." % sys.argv[arg])
|
||||
print("Invalid option %s." % sys.argv[arg])
|
||||
return 1
|
||||
arg += 1
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ def main():
|
|||
elif arg == 3:
|
||||
action = sys.argv[arg]
|
||||
else:
|
||||
print ("Invalid option %s." % sys.argv[arg])
|
||||
print("Invalid option %s." % sys.argv[arg])
|
||||
return 1
|
||||
arg += 1
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ def main():
|
|||
elif arg == 3:
|
||||
action = sys.argv[arg]
|
||||
else:
|
||||
print ("Invalid option %s." % sys.argv[arg])
|
||||
print("Invalid option %s." % sys.argv[arg])
|
||||
return 1
|
||||
arg += 1
|
||||
|
||||
|
|
Loading…
Reference in New Issue