mirror of
https://github.com/docker/compose.git
synced 2025-07-23 21:54:40 +02:00
Run tests against Python 2.6, 2.7, 3.3, 3.4 and PyPy2
In particular it includes: - some extension of CONTRIBUTING.md - one fix for Python 2.6 in tests/integration/cli_test.py - one fix for Python 3.3 in tests/integration/service_test.py - removal of unused imports Make stream_output Python 3-compatible Signed-off-by: Frank Sachsenheim <funkyfuture@riseup.net>
This commit is contained in:
parent
809443d6d0
commit
9aa61e596e
@ -66,8 +66,8 @@ WORKDIR /code/
|
|||||||
ADD requirements.txt /code/
|
ADD requirements.txt /code/
|
||||||
RUN pip install -r requirements.txt
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
ADD requirements-dev-py2.txt /code/
|
ADD requirements-dev.txt /code/
|
||||||
RUN pip install -r requirements-dev-py2.txt
|
RUN pip install -r requirements-dev.txt
|
||||||
|
|
||||||
RUN pip install tox==2.1.1
|
RUN pip install tox==2.1.1
|
||||||
|
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from functools import reduce
|
from six import iteritems
|
||||||
|
from six.moves import reduce
|
||||||
import six
|
|
||||||
|
|
||||||
from .const import LABEL_CONTAINER_NUMBER
|
from .const import LABEL_CONTAINER_NUMBER
|
||||||
from .const import LABEL_SERVICE
|
from .const import LABEL_SERVICE
|
||||||
@ -90,7 +89,7 @@ class Container(object):
|
|||||||
private=private, **public[0])
|
private=private, **public[0])
|
||||||
|
|
||||||
return ', '.join(format_port(*item)
|
return ', '.join(format_port(*item)
|
||||||
for item in sorted(six.iteritems(self.ports)))
|
for item in sorted(iteritems(self.ports)))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def labels(self):
|
def labels(self):
|
||||||
|
@ -17,6 +17,8 @@ def stream_output(output, stream):
|
|||||||
diff = 0
|
diff = 0
|
||||||
|
|
||||||
for chunk in output:
|
for chunk in output:
|
||||||
|
if six.PY3 and not isinstance(chunk, str):
|
||||||
|
chunk = chunk.decode('utf-8')
|
||||||
event = json.loads(chunk)
|
event = json.loads(chunk)
|
||||||
all_events.append(event)
|
all_events.append(event)
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@ from __future__ import absolute_import
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from functools import reduce
|
|
||||||
|
|
||||||
from docker.errors import APIError
|
from docker.errors import APIError
|
||||||
|
from six.moves import reduce
|
||||||
|
|
||||||
from .config import ConfigurationError
|
from .config import ConfigurationError
|
||||||
from .config import get_service_name_from_net
|
from .config import get_service_name_from_net
|
||||||
|
2
requirements-dev.txt
Normal file
2
requirements-dev.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
flake8
|
||||||
|
tox
|
@ -24,5 +24,5 @@ for version in $DOCKER_VERSIONS; do
|
|||||||
-e "DOCKER_DAEMON_ARGS" \
|
-e "DOCKER_DAEMON_ARGS" \
|
||||||
--entrypoint="script/dind" \
|
--entrypoint="script/dind" \
|
||||||
"$TAG" \
|
"$TAG" \
|
||||||
script/wrapdocker nosetests --with-coverage --cover-branches --cover-package=compose --cover-erase --cover-html-dir=coverage-html --cover-html "$@"
|
script/wrapdocker tox "$@"
|
||||||
done
|
done
|
||||||
|
2
setup.py
2
setup.py
@ -48,7 +48,7 @@ tests_require = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
if sys.version_info < (2, 6):
|
if sys.version_info < (2, 7):
|
||||||
tests_require.append('unittest2')
|
tests_require.append('unittest2')
|
||||||
if sys.version_info[:1] < (3,):
|
if sys.version_info[:1] < (3,):
|
||||||
tests_require.append('pyinstaller')
|
tests_require.append('pyinstaller')
|
||||||
|
@ -275,7 +275,7 @@ class CLITestCase(DockerClientTestCase):
|
|||||||
self.command.base_dir = 'tests/fixtures/user-composefile'
|
self.command.base_dir = 'tests/fixtures/user-composefile'
|
||||||
name = 'service'
|
name = 'service'
|
||||||
user = 'sshd'
|
user = 'sshd'
|
||||||
args = ['run', '--user={}'.format(user), name]
|
args = ['run', '--user={user}'.format(user=user), name]
|
||||||
self.command.dispatch(args, None)
|
self.command.dispatch(args, None)
|
||||||
service = self.project.get_service(name)
|
service = self.project.get_service(name)
|
||||||
container = service.containers(stopped=True, one_off=True)[0]
|
container = service.containers(stopped=True, one_off=True)[0]
|
||||||
|
@ -358,7 +358,7 @@ class ServiceTest(DockerClientTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
old_container = create_and_start_container(service)
|
old_container = create_and_start_container(service)
|
||||||
self.assertEqual(old_container.get('Volumes').keys(), ['/data'])
|
self.assertEqual(list(old_container.get('Volumes').keys()), ['/data'])
|
||||||
volume_path = old_container.get('Volumes')['/data']
|
volume_path = old_container.get('Volumes')['/data']
|
||||||
|
|
||||||
new_container, = service.execute_convergence_plan(
|
new_container, = service.execute_convergence_plan(
|
||||||
|
@ -8,7 +8,6 @@ from tests import unittest
|
|||||||
|
|
||||||
|
|
||||||
class ProgressStreamTestCase(unittest.TestCase):
|
class ProgressStreamTestCase(unittest.TestCase):
|
||||||
|
|
||||||
def test_stream_output(self):
|
def test_stream_output(self):
|
||||||
output = [
|
output = [
|
||||||
'{"status": "Downloading", "progressDetail": {"current": '
|
'{"status": "Downloading", "progressDetail": {"current": '
|
||||||
|
3
tox.ini
3
tox.ini
@ -8,7 +8,7 @@ passenv =
|
|||||||
deps =
|
deps =
|
||||||
-rrequirements.txt
|
-rrequirements.txt
|
||||||
commands =
|
commands =
|
||||||
nosetests -v {posargs}
|
nosetests -v --with-coverage --cover-branches --cover-package=compose --cover-erase --cover-html-dir=coverage-html --cover-html {posargs}
|
||||||
flake8 compose tests setup.py
|
flake8 compose tests setup.py
|
||||||
|
|
||||||
[testenv:pre-commit]
|
[testenv:pre-commit]
|
||||||
@ -38,6 +38,7 @@ deps =
|
|||||||
[testenv:py34]
|
[testenv:py34]
|
||||||
deps = {[testenv:py33]deps}
|
deps = {[testenv:py33]deps}
|
||||||
|
|
||||||
|
# TODO pypy3
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
# ignore line-length for now
|
# ignore line-length for now
|
||||||
|
Loading…
x
Reference in New Issue
Block a user