Tests on TravisCI with docker compose

This commit is contained in:
ziajka 2017-10-10 17:20:27 +02:00
parent 67c78ba2e3
commit 0c7a92b710
4 changed files with 36 additions and 13 deletions

View File

@ -1,17 +1,15 @@
language: python
python:
- '3.4'
- '3.5'
- '3.6'
sudo: false
cache: pip
sudo: required
services:
- docker
install:
- pip install -U setuptools pip
- python setup.py install
- pip install -rdev-requirements.txt
- sed -e 's/${PYTHON_VERSION}/'${PYTHON_VERSION}/g DockerfileTests.tpl > /tmp/DockerfileTests
- docker-compose build
script:
- mkdir ‡
- py.test -v -s tests --basetemp=‡
- docker-compose run tests
deploy:
provider: pypi
user: noplay
@ -20,3 +18,9 @@ deploy:
on:
tags: true
repo: GNS3/gns3-server
env:
matrix:
- PYTHON_VERSION=3.4
- PYTHON_VERSION=3.5
- PYTHON_VERSION=3.6

15
DockerfileTests.tpl Normal file
View File

@ -0,0 +1,15 @@
FROM python:${PYTHON_VERSION}
RUN pip install -U setuptools pip
ADD requirements.txt /server/requirements.txt
ADD dev-requirements.txt /server/dev-requirements.txt
RUN pip install -r/server/dev-requirements.txt
RUN useradd -ms /bin/bash gns3
USER gns3
ADD . /server
WORKDIR /server

4
docker-compose.yml Normal file
View File

@ -0,0 +1,4 @@
tests:
build: .
dockerfile: /tmp/DockerfileTests
command: py.test -v -s tests

View File

@ -83,7 +83,7 @@ def http_server(request, loop, port_manager, monkeypatch, controller):
for method, route, handler in Route.get_routes():
app.router.add_route(method, route, handler)
host = "localhost"
host = "127.0.0.1"
# We try multiple time. Because on Travis test can fail when because the port is taken by someone else
for i in range(0, 5):