From ab3822413e760c3004f9aaef61a414e6b3267ddb Mon Sep 17 00:00:00 2001 From: Boden R Date: Tue, 19 Jun 2018 11:38:01 -0600 Subject: [PATCH] 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 --- tox.ini | 7 +++++-- vmware_nsxlib/v3/exceptions.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index b928f7ae..c7851002 100644 --- a/tox.ini +++ b/tox.ini @@ -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] diff --git a/vmware_nsxlib/v3/exceptions.py b/vmware_nsxlib/v3/exceptions.py index 31d7bf42..97c164bc 100644 --- a/vmware_nsxlib/v3/exceptions.py +++ b/vmware_nsxlib/v3/exceptions.py @@ -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