Skip to content

Support for tox #179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 14, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use tox to easily run tests in venv
tox https://pypi.python.org/pypi/tox is a thin wrapper around virtualenv
which let you craft a fresh python environement to execute command in.

It creates the env with virtualenv, install dependencies, run python
setup.py install in it and then execute whatever command you want it to
do and report status.

To do so I simply:

- listed tests dependencies in test-requirements.txt (which are just
  nose and mock)
- provide a tox.ini file which describe how to install the dependencies
  and execute nosetests
- added the module 'coverage' to the list of test dependencies

To run tests simply:

 pip install tox && tox

That will execute the test command 'nosetests' using python2.6 and then
python 2.7.

The additional env 'cover' can be run using: tox -ecover.
  • Loading branch information
hashar committed Jul 25, 2014
commit 2ddd5e5ef89da7f1e3b3a7d081fbc7f5c46ac11c
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ cover/
/doc/_build
nbproject
*.sublime-workspace

/*egg-info
/.tox
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ The object database implementation is optimized for handling large quantities of
- Tested with nose 1.3.0
* Mock by Michael Foord used for tests
- Tested with 1.0.1
* Coverage - used for tests coverage

The list of dependencies are listed in /requirements.txt. The installer takes care of installing them for you though.
The list of dependencies are listed in /requirements.txt and /test-requirements.txt. The installer takes care of installing them for you though.

### INSTALL

Expand All @@ -32,6 +33,16 @@ A distribution package can be obtained for manual installation at:

http://pypi.python.org/pypi/GitPython

### RUNNING TESTS

The easiest way to run test is by using [tox](https://pypi.python.org/pypi/tox) a wrapper around virtualenv. It will take care of setting up environnements with the proper dependencies installed and execute test commands. To install it simply:

pip install tox

Then run:

tox

### DEVELOPMENT STATUS

[![Build Status](https://travis-ci.org/gitpython-developers/GitPython.svg?branch=0.3)](https://travis-ci.org/gitpython-developers/GitPython)
Expand Down
4 changes: 4 additions & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Remember to update README.md
coverage
nose
mock
13 changes: 13 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[tox]
envlist = py26,py27

[testenv]
commands = nosetests
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt

[testenv:cover]
commands = nosetests --with-coverage

[testenv:venv]
commands = {posargs}