set default python to python3

Set the default python to python3 except for the py27 environment. We
have to set that explicitly to override the new default.

As part of updating the pep8 job to run python 3 we need to remove the
use of the python 2 builtin unicode(). We can use six.text_type() to
produce the same result until we drop python 2 support.

Change-Id: I43c03aeb73bb8a246115400bcbd9a0a68708abd9
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-04-13 16:00:58 -04:00
parent 85693aaea9
commit 6d8da4cdb9
2 changed files with 5 additions and 2 deletions

View File

@ -36,7 +36,7 @@ class NoDeepCopyObject(object):
return str(self.value) return str(self.value)
else: else:
def __unicode__(self): def __unicode__(self):
return unicode(self.value) return six.text_type(self.value)
def __deepcopy__(self, memo): def __deepcopy__(self, memo):
raise TypeError('Deep Copy not supported') raise TypeError('Deep Copy not supported')

View File

@ -3,6 +3,7 @@ minversion = 2.0
envlist = py35,py27,pep8 envlist = py35,py27,pep8
[testenv] [testenv]
basepython = python3
install_command = pip install {opts} {packages} install_command = pip install {opts} {packages}
deps = deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}
@ -10,6 +11,9 @@ deps =
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
commands = python setup.py testr --slowest --testr-args='{posargs}' commands = python setup.py testr --slowest --testr-args='{posargs}'
[testenv:py27]
basepython = python2.7
[testenv:pep8] [testenv:pep8]
deps = deps =
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
@ -54,7 +58,6 @@ commands = pip-missing-reqs -d --ignore-module=oslo_i18n* --ignore-file=oslo_i18
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[testenv:lower-constraints] [testenv:lower-constraints]
basepython = python3
deps = deps =
-c{toxinidir}/lower-constraints.txt -c{toxinidir}/lower-constraints.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt