Make the module work with python3

This makes the module work with Python 3 and adds a tox target to
perform python 3.5 tests.
This commit is contained in:
Alex Kavanagh 2016-05-23 17:35:43 +00:00
parent b6b70e4191
commit b08f224d38
5 changed files with 16 additions and 5 deletions

View File

@ -4,13 +4,14 @@ PYTHON := /usr/bin/env python
clean:
@rm -rf .testrepository .unit-state.db .tox .eggs charm.openstack.egg-info
@find . -iname '*.pyc' -delete
@find . -iname '__pycache__' -delete
lint:
@tox -e pep8
test:
@echo Starting unit tests...
@tox -e py27
@tox -e py27,py34,py35
publish:
python setup.py publish

View File

@ -1,7 +1,6 @@
flake8>=2.2.4,<=2.4.1
os-testr>=0.4.1
paramiko<2.0
charm-tools>=2.0.0
charms.reactive
mock>=1.2
coverage>=3.6

11
tox.ini
View File

@ -1,6 +1,7 @@
[tox]
envlist = pep8,py27
envlist = pep8,py27,py34,py35
skipsdist = True
skip_missing_interpreters = True
[testenv]
setenv = VIRTUAL_ENV={envdir}
@ -13,6 +14,14 @@ commands = ostestr {posargs}
basepython = python2.7
deps = -r{toxinidir}/test-requirements.txt
[testenv:py34]
basepython = python3.4
deps = -r{toxinidir}/test-requirements.txt
[testenv:py35]
basepython = python3.5
deps = -r{toxinidir}/test-requirements.txt
[testenv:pep8]
basepython = python2.7
deps = -r{toxinidir}/test-requirements.txt

View File

@ -4,12 +4,13 @@
# mock out some charmhelpers libraries as they have apt install side effects
# sys.modules['charmhelpers.contrib.openstack.utils'] = mock.MagicMock()
# sys.modules['charmhelpers.contrib.network.ip'] = mock.MagicMock()
from __future__ import absolute_import
import collections
import mock
import utils
import unit_tests.utils as utils
import charms_openstack.charm as chm

View File

@ -5,8 +5,9 @@
# mock out some charmhelpers libraries as they have apt install side effects
# sys.modules['charmhelpers.contrib.openstack.utils'] = mock.MagicMock()
# sys.modules['charmhelpers.contrib.network.ip'] = mock.MagicMock()
from __future__ import absolute_import
import utils
import unit_tests.utils as utils
import charms_openstack.ip as ip