From faa78e917cf93da55dfc9e36bf4d976a929359aa Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Sat, 9 Jun 2012 03:22:14 -0700 Subject: [PATCH 1/4] Add support for tox (http://tox.testrun.org/) --- .gitignore | 4 +++- tox.ini | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index 43c7c5ef6bda..a9c493de9cb7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ -# Editor temporary/working/backup files # ######################################### +# Editor temporary/working/backup files # .#* [#]*# *~ @@ -27,6 +27,8 @@ doc/_build dist # Egg metadata *.egg-info +# tox testing tool +.tox # OS generated files # ###################### diff --git a/tox.ini b/tox.ini new file mode 100644 index 000000000000..f6bca134b12d --- /dev/null +++ b/tox.ini @@ -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 From 94e61b069f4681fab00e1c740b9561b78eb53369 Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Sat, 9 Jun 2012 03:25:40 -0700 Subject: [PATCH 2/4] Add .travis.yml for Travis CI (http://travis-ci.org/) --- .travis.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000000..08b835a3a850 --- /dev/null +++ b/.travis.yml @@ -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 + - cd ../foo + - python ../matplotlib/tests.py From ccce78fc9f4a2db2e49ccd8062195a938861da72 Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Wed, 13 Jun 2012 08:32:46 -0700 Subject: [PATCH 3/4] Add sections to devel/coding_guide.rst on using Tox and Travis CI --- doc/devel/coding_guide.rst | 60 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/doc/devel/coding_guide.rst b/doc/devel/coding_guide.rst index 87c15a68f492..17e42a29b8bb 100644 --- a/doc/devel/coding_guide.rst +++ b/doc/devel/coding_guide.rst @@ -509,6 +509,66 @@ 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 `_ 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.) + +It's a good idea to run ``tox`` in your working directory before submitting a +pull request with your changes. To do so: + +.. 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 +`_. + +Using Travis CI +--------------- + +`Travis CI `_ 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 +`_ -- for example, see `its Travis +page `_. + +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 `_. + +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 +`_. + .. _license-discussion: Licenses From f964e67b6cdae964a8f01105484be5335e10e605 Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Thu, 21 Jun 2012 00:32:59 -0700 Subject: [PATCH 4/4] Tweaks to devel/coding_guide.rst suggested by @mdboom --- doc/devel/coding_guide.rst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/devel/coding_guide.rst b/doc/devel/coding_guide.rst index 17e42a29b8bb..eaed93f84ddb 100644 --- a/doc/devel/coding_guide.rst +++ b/doc/devel/coding_guide.rst @@ -517,8 +517,14 @@ 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.) -It's a good idea to run ``tox`` in your working directory before submitting a -pull request with your changes. To do so: +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 +`_. + +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