-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Testing python 2.6, 2.7, and 3.2 #948
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
Changes from all commits
faa78e9
94e61b0
ccce78f
f964e67
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
language: python | ||
|
||
python: | ||
- 2.6 | ||
- 2.7 | ||
- 3.1 | ||
- 3.2 | ||
|
||
install: | ||
- pip install --use-mirrors nose numpy | ||
- if [[ $TRAVIS_PYTHON_VERSION == '2.'* ]]; then pip install --use-mirrors PIL; fi | ||
- python setup.py install | ||
|
||
script: | ||
- mkdir ../foo | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be nice if we could have a better folder name. Presumably this is done to have somewhere to store the result images? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIRC, that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So At the very least, this mkdir should have a comment to explain the reasoning, and perhaps rename the folder to |
||
- cd ../foo | ||
- python ../matplotlib/tests.py |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -509,6 +509,72 @@ Let's say you've added a new module named | |
the list of default tests, append its name to ``default_test_modules`` | ||
in :file:`lib/matplotlib/__init__.py`. | ||
|
||
Using tox | ||
--------- | ||
|
||
`Tox <http://tox.testrun.org/>`_ is a tool for running tests against multiple | ||
Python environments, including multiple versions of Python (e.g.: 2.6, 2.7, | ||
3.2, etc.) and even different Python implementations altogether (e.g.: CPython, | ||
PyPy, Jython, etc.) | ||
|
||
Testing all 4 versions of Python (2.6, 2.7, 3.1, and 3.2) requires having four | ||
versions of Python installed on your system and on the PATH. Depending on your | ||
operating system, you may want to use your package manager (such as apt-get, | ||
yum or MacPorts) to do this, or use `pythonbrew | ||
<https://github.com/utahta/pythonbrew>`_. | ||
|
||
tox makes it easy to determine if your working copy introduced any regressions | ||
before submitting a pull request. Here's how to use it: | ||
|
||
.. code-block:: bash | ||
|
||
$ pip install tox | ||
$ tox | ||
|
||
You can also run tox on a subset of environments: | ||
|
||
.. code-block:: bash | ||
|
||
$ tox -e py26,py27 | ||
|
||
Tox processes everything serially so it can take a long time to test several | ||
environments. To speed it up, you might try using a new, parallelized version | ||
of tox called ``detox``. Give this a try: | ||
|
||
.. code-block:: bash | ||
|
||
$ pip install -U -i http://pypi.testrun.org detox | ||
$ detox | ||
|
||
Tox is configured using a file called ``tox.ini``. You may need to edit this | ||
file if you want to add new environments to test (e.g.: ``py33``) or if you | ||
want to tweak the dependencies or the way the tests are run. For more info on | ||
the ``tox.ini`` file, see the `Tox Configuration Specification | ||
<http://tox.testrun.org/latest/config.html>`_. | ||
|
||
Using Travis CI | ||
--------------- | ||
|
||
`Travis CI <http://travis-ci.org/>`_ is a hosted CI system "in the cloud". | ||
|
||
Travis is configured to receive notifications of new commits to GitHub repos | ||
(via GitHub "service hooks") and to run builds or tests when it sees these new | ||
commits. It looks for a YAML file called ``.travis.yml`` in the root of the | ||
repository to see how to test the project. | ||
|
||
Travis CI is already enabled for the `main matplotlib GitHub repository | ||
<https://github.com/matplotlib/matplotlib/>`_ -- for example, see `its Travis | ||
page <http://travis-ci.org/#!/matplotlib/matplotlib>`_. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We still actually need to add the service hook, correct? You're just writing this from the point of view of after this PR is merged and the service hook has been added, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Exactly. |
||
If you want to enable Travis CI for your personal matplotlib GitHub repo, | ||
simply enable the repo to use Travis CI in either the Travis CI UI or the | ||
GitHub UI (Admin | Service Hooks). For details, see `the Travis CI Getting | ||
Started page <http://about.travis-ci.org/docs/user/getting-started/>`_. | ||
|
||
Once this is configured, you can see the Travis CI results at | ||
http://travis-ci.org/#!/your_GitHub_user_name/matplotlib -- here's `an example | ||
<http://travis-ci.org/#!/msabramo/matplotlib>`_. | ||
|
||
.. _license-discussion: | ||
|
||
Licenses | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Tox (http://tox.testrun.org/) is a tool for running tests | ||
# in multiple virtualenvs. This configuration file will run the | ||
# test suite on all supported python versions. To use it, "pip install tox" | ||
# and then run "tox" from this directory. | ||
|
||
[tox] | ||
envlist = py26, py27, py31, py32 | ||
|
||
[testenv] | ||
changedir = /tmp | ||
commands = | ||
sh -c 'rm -f $HOME/.matplotlib/fontList*' | ||
{envpython} {toxinidir}/tests.py | ||
deps = | ||
nose | ||
numpy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two lines are my biggest concern. Presumably this is so that the CI server has the appropriate setup, but what happens is PIL & numpy already exist on the server?
Can you easily test with different versions of numpy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pip install
doesn't reinstall packages without the--upgrade
option.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't have enough exposure to
pip
to have confidence, so thanks for the clarification.Note: For clarification, I read what you said to mean "even if the original install wasn't done by pip, no re-installation will be done".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes -- that's my understanding of how it works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, this is for Travis and Travis starts with a completely clean environment every time it runs. Basically you have a fresh new VirtualBox VM sandbox for each build.