Skip to content

Commit

Permalink
Merge pull request #8 from AntoineCezar/from_tox_to_docker
Browse files Browse the repository at this point in the history
Use docker for mutiple Python version testing
  • Loading branch information
AntoineCezar committed Jan 26, 2016
2 parents 82f670c + 652a547 commit fc96097
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 30 deletions.
25 changes: 10 additions & 15 deletions CONTRIBUTING.rst
Expand Up @@ -66,29 +66,31 @@ Ready to contribute? Here's how to set up `flockcontext` for local development.

$ mkvirtualenv flockcontext
$ cd flockcontext/
$ python setup.py develop
$ make develop

4. Create a branch for local development::

$ git checkout -b name-of-your-bugfix-or-feature

Now you can make your changes locally.

5. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox::
5. When you're done making changes, check that your changes pass the tests::
$ make test

$ flake8 flockcontext tests
$ python setup.py test
$ tox
6. Check also that they pass the linter::
$ pip install flake8
$ make lint

To get flake8 and tox, just pip install them into your virtualenv.
7. And that they pass other Python versions (requires https://docs.docker.com/)::
$ make test-all

6. Commit your changes and push your branch to GitHub::
8. Commit your changes and push your branch to GitHub::

$ git add .
$ git commit -m "Your detailed description of your changes."
$ git push origin name-of-your-bugfix-or-feature

7. Submit a pull request through the GitHub website.
9. Submit a pull request through the GitHub website.

Pull Request Guidelines
-----------------------
Expand All @@ -102,10 +104,3 @@ Before you submit a pull request, check that it meets these guidelines:
3. The pull request should work for Python 2.6, 2.7, 3.3, and 3.4, and for PyPy. Check
https://travis-ci.org/AntoineCezar/flockcontext/pull_requests
and make sure that the tests pass for all supported Python versions.

Tips
----

To run a subset of tests::

$ python -m unittest tests.test_flock
28 changes: 23 additions & 5 deletions Makefile
Expand Up @@ -9,10 +9,12 @@ help:
@echo "test - run tests quickly with the default Python"
@echo "test-all - run tests on every Python version with tox"
@echo "coverage - check code coverage quickly with the default Python"
@echo "coverage-html - check code coverage quickly with the default Python"
@echo "docs - generate Sphinx HTML documentation, including API docs"
@echo "release - package and upload a release"
@echo "dist - package"
@echo "install - install the package to the active Python's site-packages"
@echo "develop - link the package into the active Python's site-packages"
@echo "install - install the package into the active Python's site-packages"

clean: clean-build clean-pyc clean-test clean-coverage

Expand Down Expand Up @@ -42,15 +44,28 @@ lint:
test:
python setup.py test

test-all:
tox
test-all: test-py27 test-py33 test-py34 test-py35

coverage: clean-coverage .coverage
test-py27:
./docker-test.sh python:2.7

test-py33:
./docker-test.sh python:3.3

test-py34:
./docker-test.sh python:3.4

test-py35:
./docker-test.sh python:3.5

coverage: .coverage
coverage report -m

coverage-html: .coverage
coverage html
open htmlcov/index.html

.coverage:
.coverage: clean-coverage
coverage run --source flockcontext setup.py test

docs:
Expand All @@ -70,5 +85,8 @@ dist: clean
python setup.py bdist_wheel
ls -l dist

develop: clean
python setup.py develop

install: clean
python setup.py install
10 changes: 10 additions & 0 deletions docker-test.sh
@@ -0,0 +1,10 @@
#!/bin/sh

FLAVOUR=$1
FLAVOUR_SLUG=$(echo "$FLAVOUR" | sed 's/\W/-/')

docker run --rm -it \
--name "flockcontext-test-$FLAVOUR_SLUG" \
-v "$PWD:/home/docker/code" \
$FLAVOUR \
/bin/sh -c "cd /home/docker/code && python setup.py install && python setup.py test"
1 change: 0 additions & 1 deletion requirements_test.txt
@@ -1,2 +1 @@
coverage
tox
9 changes: 0 additions & 9 deletions tox.ini

This file was deleted.

0 comments on commit fc96097

Please sign in to comment.