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

Skip to content

Commit ccce78f

Browse files
committed
Add sections to devel/coding_guide.rst on using Tox and Travis CI
1 parent 94e61b0 commit ccce78f

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

doc/devel/coding_guide.rst

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,66 @@ 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+
It's a good idea to run ``tox`` in your working directory before submitting a
521+
pull request with your changes. To do so:
522+
523+
.. code-block:: bash
524+
525+
$ pip install tox
526+
$ tox
527+
528+
You can also run tox on a subset of environments:
529+
530+
.. code-block:: bash
531+
532+
$ tox -e py26,py27
533+
534+
Tox processes everything serially so it can take a long time to test several
535+
environments. To speed it up, you might try using a new, parallelized version
536+
of tox called ``detox``. Give this a try:
537+
538+
.. code-block:: bash
539+
540+
$ pip install -U -i http://pypi.testrun.org detox
541+
$ detox
542+
543+
Tox is configured using a file called ``tox.ini``. You may need to edit this
544+
file if you want to add new environments to test (e.g.: ``py33``) or if you
545+
want to tweak the dependencies or the way the tests are run. For more info on
546+
the ``tox.ini`` file, see the `Tox Configuration Specification
547+
<http://tox.testrun.org/latest/config.html>`_.
548+
549+
Using Travis CI
550+
---------------
551+
552+
`Travis CI <http://travis-ci.org/>`_ is a hosted CI system "in the cloud".
553+
554+
Travis is configured to receive notifications of new commits to GitHub repos
555+
(via GitHub "service hooks") and to run builds or tests when it sees these new
556+
commits. It looks for a YAML file called ``.travis.yml`` in the root of the
557+
repository to see how to test the project.
558+
559+
Travis CI is already enabled for the `main matplotlib GitHub repository
560+
<https://github.com/matplotlib/matplotlib/>`_ -- for example, see `its Travis
561+
page <http://travis-ci.org/#!/matplotlib/matplotlib>`_.
562+
563+
If you want to enable Travis CI for your personal matplotlib GitHub repo,
564+
simply enable the repo to use Travis CI in either the Travis CI UI or the
565+
GitHub UI (Admin | Service Hooks). For details, see `the Travis CI Getting
566+
Started page <http://about.travis-ci.org/docs/user/getting-started/>`_.
567+
568+
Once this is configured, you can see the Travis CI results at
569+
http://travis-ci.org/#!/your_GitHub_user_name/matplotlib -- here's `an example
570+
<http://travis-ci.org/#!/msabramo/matplotlib>`_.
571+
512572
.. _license-discussion:
513573

514574
Licenses

0 commit comments

Comments
 (0)