Skip to content

Commit

Permalink
Merge pull request labd#99 from AccentDesign/local_docker_testing
Browse files Browse the repository at this point in the history
using tox in docker locally
  • Loading branch information
stuartaccent committed Jun 21, 2018
2 parents 75a258b + 9071555 commit 1762f36
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 22 deletions.
21 changes: 21 additions & 0 deletions Dockerfile-tox
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM accent/pyenv:latest

# Copy the application code to the container:
RUN mkdir /code/
WORKDIR /code/
ADD . /code/

# Docker environment variables:
ENV TOX_PY27=2.7.15 \
TOX_PY34=3.4.8 \
TOX_PY35=3.5.5 \
TOX_PY36=3.6.5

# set pyenv local versions
RUN pyenv local $TOX_PY27 $TOX_PY34 $TOX_PY35 $TOX_PY36

# Install dependencies
RUN pip install --upgrade tox codecov

# Start tox:
CMD ["tox", "-v"]
33 changes: 11 additions & 22 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,41 +93,30 @@ Go to http://127.0.0.1:8000
Testing
-------

Install dependencies
You can test using the tox.ini file in on your own system if you are used to pyenv and tox
or you can use the dockerfile that has everything installed ready. Just follow the below commands.

You will need pyenv installed see https://github.com/pyenv/pyenv

Also tox needs to be installed

.. code:: bash
$ pip install tox
Install python versions in pyenv
Build the tox test docker image:

.. code:: bash
$ pyenv install 3.4.4
$ pyenv install 3.5.3
$ pyenv install 3.6.2
docker-compose -f docker-compose-tox.yml build
Set local project versions
Bash into the container:

.. code:: bash
$ pyenv local 3.4.4 3.5.3 3.6.2
docker-compose -f docker-compose-tox.yml run tox bash
Run the tests
From here you can just execute tox commands:

.. code:: bash
$ tox
or run for a single environment

.. code:: bash
# Execute all environments
$ tox
$ tox -e py36-dj200-wt200
# Or a single environment
$ tox -e py36-dj200-wt200
.. |CircleCI| image:: https://circleci.com/gh/AccentDesign/wagtailstreamforms/tree/3-dev.svg?style=svg
:target: https://circleci.com/gh/AccentDesign/wagtailstreamforms/tree/3-dev
Expand Down
10 changes: 10 additions & 0 deletions docker-compose-tox.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '2'

services:
tox:
build:
context: .
dockerfile: Dockerfile-tox
tty: true
volumes:
- .:/code

0 comments on commit 1762f36

Please sign in to comment.