Skip to content

Commit

Permalink
Add tox to requirements.txt and extend it to versions 26,27,33,34,35
Browse files Browse the repository at this point in the history
Now it's a snap to run tests locally on multiple versions of Python.

Also fix install_command. tox used to fail because it tried to
pass `--download-cache` option to pip, which is obsolete and gone.

Update CONTRIBUTING.md to explain how to use tox and pyenv together
to run tests locally on multiple Python versions.
  • Loading branch information
balta2ar committed Jul 17, 2016
1 parent 1e6fbe4 commit 4b4f8c0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
24 changes: 22 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,26 @@ If you need to change the test suite, explain in the commit message why it
needs to be changed (e.g., the page layout or the authentication methods
from coursera changed, or they implemented a new kind of course).

## Using tox and pyenv

Running only py.test is okay for one-time check, but as it runs on your
currently active Python installation, you're only checking the script on one
Python version. A combination of tox + pyenv will allow you to run tests on many
Python versions easily.

First, install tox (listed in requirements-dev.txt) and pyenv (see their manual:
[pyenv installation](https://github.com/yyuu/pyenv#installation). Make sure to
activate pyenv or start a new shell. Then, install Python versions and run tox:

pyenv install 3.5.1
pyenv install 3.4.4
pyenv install 3.3.6
pyenv install 3.2
pyenv install 2.7.5
pyenv install 2.6.9
pyenv local 3.5.1 3.4.4 3.3.6 3.2 2.7.5 2.6.9
tox

# Check for potential bugs

Please, help keep the code tidy by checking for any potential bugs with the
Expand Down Expand Up @@ -203,13 +223,13 @@ There are many other tricks/steps in the git workflow, but these are the
basics that I (@rbrito) think that will suffice for a start. If you want a
few details more, feel free to ask me to include them here.

# Release process
# Release procedure

This section is for project maintainers.

DRAFT

1. Run tests locally
1. Run tests locally. Use tox to run tests on all supported Python versions.
2. Run the script on several courses to check sanity
3. Update CHANGELOG.md, increment version, put what you've added to the
changelog into commit message. This way it gets it way into releases page
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ pytest-xdist
mock>=1.0.1
coverage>=3.7
keyrings.alt
tox
8 changes: 6 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[tox]
envlist = py27,py34,py35
envlist = py26,py27,py33,py34,py35

[testenv]
downloadcache = .tox/_download/

deps =
beautifulsoup4>=4.1.3
coverage>=3.7
html5lib>=1.0b2
html5lib>=1.0b2,<=1.0b8
mock>=1.0.1
pyasn1>=0.1.7
pytest>=2.5
Expand All @@ -17,3 +17,7 @@ deps =
keyrings.alt>=1.1

commands = py.test -v --junitxml={envlogdir}/result.xml coursera/test
# Original command: install_command = pip install {opts} {packages}
# {opts} is remove to prevent passing option "--download-cache" to pip
# which is already gone.
install_command = pip install {packages}

0 comments on commit 4b4f8c0

Please sign in to comment.