You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/source/contributing.rst
+108-24
Original file line number
Diff line number
Diff line change
@@ -51,14 +51,9 @@ Bug reports must:
51
51
...
52
52
```
53
53
54
-
#. Include the full version string of *pandas* and its dependencies. In versions
55
-
of *pandas* after 0.12 you can use a built in function::
56
-
57
-
>>> from pandas.util.print_versions import show_versions
58
-
>>> show_versions()
59
-
60
-
and in *pandas* 0.13.1 onwards::
54
+
#. Include the full version string of *pandas* and its dependencies. You can use the built in function::
61
55
56
+
>>> import pandas as pd
62
57
>>> pd.show_versions()
63
58
64
59
#. Explain why the current behavior is wrong/not desired and what you expect instead.
@@ -209,7 +204,7 @@ At this point you can easily do an *in-place* install, as detailed in the next s
209
204
Creating a Windows development environment
210
205
------------------------------------------
211
206
212
-
To build on Windows, you need to have compilers installed to build the extensions. You will need to install the appropriate Visual Studio compilers, VS 2008 for Python 2.7, VS 2010 for 3.4, and VS 2015 for Python 3.5.
207
+
To build on Windows, you need to have compilers installed to build the extensions. You will need to install the appropriate Visual Studio compilers, VS 2008 for Python 2.7, VS 2010 for 3.4, and VS 2015 for Python 3.5 and 3.6.
213
208
214
209
For Python 2.7, you can install the ``mingw`` compiler which will work equivalently to VS 2008::
215
210
@@ -219,7 +214,7 @@ or use the `Microsoft Visual Studio VC++ compiler for Python <https://www.micros
219
214
220
215
For Python 3.4, you can download and install the `Windows 7.1 SDK <https://www.microsoft.com/en-us/download/details.aspx?id=8279>`__. Read the references below as there may be various gotchas during the installation.
221
216
222
-
For Python 3.5, you can download and install the `Visual Studio 2015 Community Edition <https://www.visualstudio.com/en-us/downloads/visual-studio-2015-downloads-vs.aspx>`__.
217
+
For Python 3.5 and 3.6, you can download and install the `Visual Studio 2015 Community Edition <https://www.visualstudio.com/en-us/downloads/visual-studio-2015-downloads-vs.aspx>`__.
223
218
224
219
Here are some references and blogs:
225
220
@@ -544,26 +539,26 @@ signatures and add deprecation warnings where needed.
544
539
Testing Thru Continuous Integration
545
540
-----------------------------------
546
541
547
-
The pandas testing suite will run automatically on Travis-CI, Appveyor, and Circle CI
548
-
continuous integration services, once your pull request is submitted.
542
+
The *pandas* testing suite will run automatically on `Travis-CI <https://travis-ci.org/>`__,
543
+
`Appveyor <https://www.appveyor.com/>`__, and `Circle CI <https://circleci.com/>`__ continuous integration
544
+
services, once your pull request is submitted.
549
545
However, if you wish to run the test suite on a branch prior to submitting the pull request,
550
-
then Travis-CI, Appveyor and/or CircleCI need to be hooked up to your GitHub repository.
551
-
Instructions for doing so are `here <http://about.travis-ci.org/docs/user/getting-started/>`__ for
552
-
Travis-CI, `here <https://www.appveyor.com/docs/>`__ for Appveyor, and
553
-
`here <https://circleci.com/>`__ for CircleCI.
546
+
then the continuous integration services need to be hooked to your GitHub repository. Instructions are here
547
+
for `Travis-CI <http://about.travis-ci.org/docs/user/getting-started/>`__,
548
+
`Appveyor <https://www.appveyor.com/docs/>`__ , and `CircleCI <https://circleci.com/>`__.
554
549
555
-
A pull-request will be considered for merging when you have an all 'green' build. See
556
-
this example.
550
+
A pull-request will be considered for merging when you have an all 'green' build. If any tests are failing,
551
+
then you will get a red 'X', where you can click thru to see the individual failed tests.
552
+
This is an example of a green build.
557
553
558
554
.. image:: _static/ci.png
559
555
560
-
561
556
.. note::
562
557
563
-
Pushing to *your* branch will cancel any non-currently-running tests for that
564
-
same pull-request for Appveyor. For Travis CI, you can enable the auto-cancel feature
565
-
`here <https://docs.travis-ci.com/user/customizing-the-build/#Building-only-the-latest-commit>`__ and
566
-
for CircleCI `here <https://circleci.com/changelog-legacy/#option-to-auto-cancel-redundant-builds>`__.
558
+
Each time you push to *your* fork, a *new* run of the tests will trigger on the CI. Appveyor will auto-cancel
559
+
any non-currently-running tests for that same pull-request. You can enable the auto-cancel feature for
560
+
`Travis-CI here <https://docs.travis-ci.com/user/customizing-the-build/#Building-only-the-latest-commit>`__ and
561
+
for `CircleCI here <https://circleci.com/changelog-legacy/#option-to-auto-cancel-redundant-builds>`__.
567
562
568
563
.. _contributing.tdd:
569
564
@@ -620,8 +615,96 @@ the expected correct result::
620
615
621
616
assert_frame_equal(pivoted, expected)
622
617
618
+
How to use ``parametrize``
619
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
620
+
621
+
`pytest <http://doc.pytest.org/en/latest/>`__ has a nice feature `parametrize <https://docs.pytest.org/en/latest/parametrize.html>`__ to allow
622
+
testing of many cases in a concise way that enables an easy-to-read syntax.
623
+
624
+
.. note::
625
+
626
+
.. code-block:: python
627
+
628
+
*pandas* existing test structure is*mostly* classed based, meaning that you will typically find tests wrapped in a class, inheriting from``tm.TestCase``.
629
+
630
+
classTestReallyCoolFeature(tm.TestCase):
631
+
....
632
+
633
+
Going forward we are moving to a more *functional* style, please see below.
634
+
635
+
636
+
Here is an example of a self-contained set of tests that illustrate multiple features that we like to use.
637
+
638
+
- functional style: tests are like ``test_*`` and *only* take arguments that are either fixtures or parameters
639
+
- using ``parametrize``: allow testing of multiple cases
640
+
- ``fixture``, code for object construction, on a per-test basis
641
+
- using bare ``assert`` for scalars and truth-testing
642
+
- ``tm.assert_series_equal`` (and its counter part ``tm.assert_frame_equal``), for pandas object comparisons.
643
+
- the typical pattern of constructing an ``expected`` and comparing versus the ``result``
644
+
645
+
We would name this file ``test_cool_feature.py`` and put in an appropriate place in the ``pandas/tests/`` sturcture.
=========================== test session starts ===========================
680
+
platform darwin -- Python 3.5.2, pytest-3.0.5, py-1.4.31, pluggy-0.4.0
681
+
collected 8 items
682
+
683
+
tester.py::test_dtypes[int8] PASSED
684
+
tester.py::test_dtypes[int16] PASSED
685
+
tester.py::test_dtypes[int32] PASSED
686
+
tester.py::test_dtypes[int64] PASSED
687
+
tester.py::test_series[int8] PASSED
688
+
tester.py::test_series[int16] PASSED
689
+
tester.py::test_series[int32] PASSED
690
+
tester.py::test_series[int64] PASSED
691
+
692
+
Tests that we have ``parametrized`` are now accessible via the test name, for example we could run these with ``-k int8`` to sub-select *only* those tests which match ``int8``.
0 commit comments