mirror of https://github.com/docker/docker-py.git
support Python 3.5
Signed-off-by: Thomas Grainger <tom.grainger@procensus.com>
This commit is contained in:
parent
26f2b696ab
commit
e0b9cb2a8c
|
|
@ -1,12 +1,13 @@
|
||||||
sudo: false
|
sudo: false
|
||||||
language: python
|
language: python
|
||||||
python:
|
python:
|
||||||
- "2.7"
|
- "3.5"
|
||||||
env:
|
env:
|
||||||
- TOX_ENV=py26
|
- TOX_ENV=py26
|
||||||
- TOX_ENV=py27
|
- TOX_ENV=py27
|
||||||
- TOX_ENV=py33
|
- TOX_ENV=py33
|
||||||
- TOX_ENV=py34
|
- TOX_ENV=py34
|
||||||
|
- TOX_ENV=py35
|
||||||
- TOX_ENV=flake8
|
- TOX_ENV=flake8
|
||||||
install:
|
install:
|
||||||
- pip install tox
|
- pip install tox
|
||||||
|
|
|
||||||
|
|
@ -546,12 +546,6 @@ def datetime_to_timestamp(dt):
|
||||||
return delta.seconds + delta.days * 24 * 3600
|
return delta.seconds + delta.days * 24 * 3600
|
||||||
|
|
||||||
|
|
||||||
def longint(n):
|
|
||||||
if six.PY3:
|
|
||||||
return int(n)
|
|
||||||
return long(n)
|
|
||||||
|
|
||||||
|
|
||||||
def parse_bytes(s):
|
def parse_bytes(s):
|
||||||
if isinstance(s, six.integer_types + (float,)):
|
if isinstance(s, six.integer_types + (float,)):
|
||||||
return s
|
return s
|
||||||
|
|
@ -574,7 +568,7 @@ def parse_bytes(s):
|
||||||
|
|
||||||
if suffix in units.keys() or suffix.isdigit():
|
if suffix in units.keys() or suffix.isdigit():
|
||||||
try:
|
try:
|
||||||
digits = longint(digits_part)
|
digits = int(digits_part)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise errors.DockerException(
|
raise errors.DockerException(
|
||||||
'Failed converting the string value for memory ({0}) to'
|
'Failed converting the string value for memory ({0}) to'
|
||||||
|
|
@ -582,7 +576,7 @@ def parse_bytes(s):
|
||||||
)
|
)
|
||||||
|
|
||||||
# Reconvert to long for the final result
|
# Reconvert to long for the final result
|
||||||
s = longint(digits * units[suffix])
|
s = int(digits * units[suffix])
|
||||||
else:
|
else:
|
||||||
raise errors.DockerException(
|
raise errors.DockerException(
|
||||||
'The specified value for memory ({0}) should specify the'
|
'The specified value for memory ({0}) should specify the'
|
||||||
|
|
|
||||||
4
setup.py
4
setup.py
|
|
@ -16,6 +16,7 @@ extras_require = {
|
||||||
':python_version < "3.3"': 'ipaddress >= 1.0.16',
|
':python_version < "3.3"': 'ipaddress >= 1.0.16',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
version = None
|
||||||
exec(open('docker/version.py').read())
|
exec(open('docker/version.py').read())
|
||||||
|
|
||||||
with open('./test-requirements.txt') as test_reqs_txt:
|
with open('./test-requirements.txt') as test_reqs_txt:
|
||||||
|
|
@ -42,10 +43,13 @@ setup(
|
||||||
'Intended Audience :: Developers',
|
'Intended Audience :: Developers',
|
||||||
'Operating System :: OS Independent',
|
'Operating System :: OS Independent',
|
||||||
'Programming Language :: Python',
|
'Programming Language :: Python',
|
||||||
|
'Programming Language :: Python :: 2',
|
||||||
'Programming Language :: Python :: 2.6',
|
'Programming Language :: Python :: 2.6',
|
||||||
'Programming Language :: Python :: 2.7',
|
'Programming Language :: Python :: 2.7',
|
||||||
|
'Programming Language :: Python :: 3',
|
||||||
'Programming Language :: Python :: 3.3',
|
'Programming Language :: Python :: 3.3',
|
||||||
'Programming Language :: Python :: 3.4',
|
'Programming Language :: Python :: 3.4',
|
||||||
|
'Programming Language :: Python :: 3.5',
|
||||||
'Topic :: Utilities',
|
'Topic :: Utilities',
|
||||||
'License :: OSI Approved :: Apache Software License',
|
'License :: OSI Approved :: Apache Software License',
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
mock==1.0.1
|
mock==1.0.1
|
||||||
pytest==2.7.2
|
pytest==2.9.1
|
||||||
coverage==3.7.1
|
coverage==3.7.1
|
||||||
pytest-cov==2.1.0
|
pytest-cov==2.1.0
|
||||||
flake8==2.4.1
|
flake8==2.4.1
|
||||||
|
|
|
||||||
|
|
@ -299,56 +299,30 @@ class ConverVolumeBindsTest(base.BaseTestCase):
|
||||||
self.assertEqual(convert_volume_binds(data), ['/mnt/vol1:/data:rw'])
|
self.assertEqual(convert_volume_binds(data), ['/mnt/vol1:/data:rw'])
|
||||||
|
|
||||||
def test_convert_volume_binds_unicode_bytes_input(self):
|
def test_convert_volume_binds_unicode_bytes_input(self):
|
||||||
if six.PY2:
|
expected = [u'/mnt/지연:/unicode/박:rw']
|
||||||
expected = [unicode('/mnt/지연:/unicode/박:rw', 'utf-8')]
|
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
'/mnt/지연': {
|
u'/mnt/지연'.encode('utf-8'): {
|
||||||
'bind': '/unicode/박',
|
'bind': u'/unicode/박'.encode('utf-8'),
|
||||||
'mode': 'rw'
|
'mode': 'rw'
|
||||||
}
|
|
||||||
}
|
}
|
||||||
self.assertEqual(
|
}
|
||||||
convert_volume_binds(data), expected
|
self.assertEqual(
|
||||||
)
|
convert_volume_binds(data), expected
|
||||||
else:
|
)
|
||||||
expected = ['/mnt/지연:/unicode/박:rw']
|
|
||||||
|
|
||||||
data = {
|
|
||||||
bytes('/mnt/지연', 'utf-8'): {
|
|
||||||
'bind': bytes('/unicode/박', 'utf-8'),
|
|
||||||
'mode': 'rw'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self.assertEqual(
|
|
||||||
convert_volume_binds(data), expected
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_convert_volume_binds_unicode_unicode_input(self):
|
def test_convert_volume_binds_unicode_unicode_input(self):
|
||||||
if six.PY2:
|
expected = [u'/mnt/지연:/unicode/박:rw']
|
||||||
expected = [unicode('/mnt/지연:/unicode/박:rw', 'utf-8')]
|
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
unicode('/mnt/지연', 'utf-8'): {
|
u'/mnt/지연': {
|
||||||
'bind': unicode('/unicode/박', 'utf-8'),
|
'bind': u'/unicode/박',
|
||||||
'mode': 'rw'
|
'mode': 'rw'
|
||||||
}
|
|
||||||
}
|
}
|
||||||
self.assertEqual(
|
}
|
||||||
convert_volume_binds(data), expected
|
self.assertEqual(
|
||||||
)
|
convert_volume_binds(data), expected
|
||||||
else:
|
)
|
||||||
expected = ['/mnt/지연:/unicode/박:rw']
|
|
||||||
|
|
||||||
data = {
|
|
||||||
'/mnt/지연': {
|
|
||||||
'bind': '/unicode/박',
|
|
||||||
'mode': 'rw'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self.assertEqual(
|
|
||||||
convert_volume_binds(data), expected
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class ParseEnvFileTest(base.BaseTestCase):
|
class ParseEnvFileTest(base.BaseTestCase):
|
||||||
|
|
@ -612,13 +586,7 @@ class UtilsTest(base.BaseTestCase):
|
||||||
class SplitCommandTest(base.BaseTestCase):
|
class SplitCommandTest(base.BaseTestCase):
|
||||||
|
|
||||||
def test_split_command_with_unicode(self):
|
def test_split_command_with_unicode(self):
|
||||||
if six.PY2:
|
self.assertEqual(split_command(u'echo μμ'), ['echo', 'μμ'])
|
||||||
self.assertEqual(
|
|
||||||
split_command(unicode('echo μμ', 'utf-8')),
|
|
||||||
['echo', 'μμ']
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
self.assertEqual(split_command('echo μμ'), ['echo', 'μμ'])
|
|
||||||
|
|
||||||
@pytest.mark.skipif(six.PY3, reason="shlex doesn't support bytes in py3")
|
@pytest.mark.skipif(six.PY3, reason="shlex doesn't support bytes in py3")
|
||||||
def test_split_command_with_bytes(self):
|
def test_split_command_with_bytes(self):
|
||||||
|
|
|
||||||
4
tox.ini
4
tox.ini
|
|
@ -1,5 +1,5 @@
|
||||||
[tox]
|
[tox]
|
||||||
envlist = py26, py27, py33, py34, flake8
|
envlist = py26, py27, py33, py34, py35, flake8
|
||||||
skipsdist=True
|
skipsdist=True
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
|
|
@ -11,5 +11,5 @@ deps =
|
||||||
-r{toxinidir}/requirements.txt
|
-r{toxinidir}/requirements.txt
|
||||||
|
|
||||||
[testenv:flake8]
|
[testenv:flake8]
|
||||||
commands = flake8 docker tests
|
commands = flake8 docker tests setup.py
|
||||||
deps = flake8
|
deps = flake8
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue