make python 3 the default for tox.ini

This patch is part of the community goals to enable python 3 first, and
only use python 2 when explict.

To do so, this patch:
- Makes python 3 the default env for non py27 tox targets.
- Addresses any py3 changes in the code.

Change-Id: Iab52979bb720a8df8924108093e5119922622cb9
changes/94/576594/1
Boden R 5 years ago
parent 716527fb20
commit ab3822413e
  1. 7
      tox.ini
  2. 2
      vmware_nsxlib/v3/exceptions.py

@ -26,7 +26,7 @@ setenv = {[testenv]setenv}
commands = false
[testenv:functional]
basepython = python2.7
basepython = python3
setenv = {[testenv]setenv}
{[testenv:common]setenv}
OS_TEST_PATH=./vmware_nsxlib/tests/functional
@ -36,7 +36,7 @@ deps =
-r{toxinidir}/vmware_nsxlib/tests/functional/requirements.txt
[testenv:dsvm-functional]
basepython = python2.7
basepython = python3
setenv = {[testenv]setenv}
OS_SUDO_TESTING=1
OS_FAIL_ON_MISSING_DEPS=1
@ -53,6 +53,7 @@ sitepackages = True
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[testenv:pep8]
basepython = python3
deps =
{[testenv]deps}
commands =
@ -69,6 +70,7 @@ deps = -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/re
commands = bandit -r vmware_nsxlib -n 5 -ll
[testenv:cover]
basepython = python3
commands =
python setup.py test --coverage --coverage-package-name=vmware_nsxlib --testr-args='{posargs}'
coverage report
@ -77,6 +79,7 @@ commands =
commands = {posargs}
[testenv:docs]
basepython = python3
commands = sphinx-build -W -b html doc/source doc/build/html
[flake8]

@ -42,7 +42,7 @@ class NsxLibException(Exception):
if six.PY2:
def __unicode__(self):
return unicode(self.msg)
return unicode(self.msg) if six.PY2 else self.msg # noqa
def __str__(self):
return self.msg

Loading…
Cancel
Save