Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 83471aa

Browse files
committed
Merge pull request #948 from msabramo/testing_py3
Testing python 2.6, 2.7, and 3.2
2 parents e0a8e9e + f964e67 commit 83471aa

File tree

4 files changed

+102
-1
lines changed

4 files changed

+102
-1
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Editor temporary/working/backup files #
21
#########################################
2+
# Editor temporary/working/backup files #
33
.#*
44
[#]*#
55
*~
@@ -27,6 +27,8 @@ doc/_build
2727
dist
2828
# Egg metadata
2929
*.egg-info
30+
# tox testing tool
31+
.tox
3032

3133
# OS generated files #
3234
######################

.travis.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
language: python
2+
3+
python:
4+
- 2.6
5+
- 2.7
6+
- 3.1
7+
- 3.2
8+
9+
install:
10+
- pip install --use-mirrors nose numpy
11+
- if [[ $TRAVIS_PYTHON_VERSION == '2.'* ]]; then pip install --use-mirrors PIL; fi
12+
- python setup.py install
13+
14+
script:
15+
- mkdir ../foo
16+
- cd ../foo
17+
- python ../matplotlib/tests.py

doc/devel/coding_guide.rst

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,72 @@ Let's say you've added a new module named
509509
the list of default tests, append its name to ``default_test_modules``
510510
in :file:`lib/matplotlib/__init__.py`.
511511

512+
Using tox
513+
---------
514+
515+
`Tox <http://tox.testrun.org/>`_ is a tool for running tests against multiple
516+
Python environments, including multiple versions of Python (e.g.: 2.6, 2.7,
517+
3.2, etc.) and even different Python implementations altogether (e.g.: CPython,
518+
PyPy, Jython, etc.)
519+
520+
Testing all 4 versions of Python (2.6, 2.7, 3.1, and 3.2) requires having four
521+
versions of Python installed on your system and on the PATH. Depending on your
522+
operating system, you may want to use your package manager (such as apt-get,
523+
yum or MacPorts) to do this, or use `pythonbrew
524+
<https://github.com/utahta/pythonbrew>`_.
525+
526+
tox makes it easy to determine if your working copy introduced any regressions
527+
before submitting a pull request. Here's how to use it:
528+
529+
.. code-block:: bash
530+
531+
$ pip install tox
532+
$ tox
533+
534+
You can also run tox on a subset of environments:
535+
536+
.. code-block:: bash
537+
538+
$ tox -e py26,py27
539+
540+
Tox processes everything serially so it can take a long time to test several
541+
environments. To speed it up, you might try using a new, parallelized version
542+
of tox called ``detox``. Give this a try:
543+
544+
.. code-block:: bash
545+
546+
$ pip install -U -i http://pypi.testrun.org detox
547+
$ detox
548+
549+
Tox is configured using a file called ``tox.ini``. You may need to edit this
550+
file if you want to add new environments to test (e.g.: ``py33``) or if you
551+
want to tweak the dependencies or the way the tests are run. For more info on
552+
the ``tox.ini`` file, see the `Tox Configuration Specification
553+
<http://tox.testrun.org/latest/config.html>`_.
554+
555+
Using Travis CI
556+
---------------
557+
558+
`Travis CI <http://travis-ci.org/>`_ is a hosted CI system "in the cloud".
559+
560+
Travis is configured to receive notifications of new commits to GitHub repos
561+
(via GitHub "service hooks") and to run builds or tests when it sees these new
562+
commits. It looks for a YAML file called ``.travis.yml`` in the root of the
563+
repository to see how to test the project.
564+
565+
Travis CI is already enabled for the `main matplotlib GitHub repository
566+
<https://github.com/matplotlib/matplotlib/>`_ -- for example, see `its Travis
567+
page <http://travis-ci.org/#!/matplotlib/matplotlib>`_.
568+
569+
If you want to enable Travis CI for your personal matplotlib GitHub repo,
570+
simply enable the repo to use Travis CI in either the Travis CI UI or the
571+
GitHub UI (Admin | Service Hooks). For details, see `the Travis CI Getting
572+
Started page <http://about.travis-ci.org/docs/user/getting-started/>`_.
573+
574+
Once this is configured, you can see the Travis CI results at
575+
http://travis-ci.org/#!/your_GitHub_user_name/matplotlib -- here's `an example
576+
<http://travis-ci.org/#!/msabramo/matplotlib>`_.
577+
512578
.. _license-discussion:
513579

514580
Licenses

tox.ini

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Tox (http://tox.testrun.org/) is a tool for running tests
2+
# in multiple virtualenvs. This configuration file will run the
3+
# test suite on all supported python versions. To use it, "pip install tox"
4+
# and then run "tox" from this directory.
5+
6+
[tox]
7+
envlist = py26, py27, py31, py32
8+
9+
[testenv]
10+
changedir = /tmp
11+
commands =
12+
sh -c 'rm -f $HOME/.matplotlib/fontList*'
13+
{envpython} {toxinidir}/tests.py
14+
deps =
15+
nose
16+
numpy

0 commit comments

Comments
 (0)