[Matplotlib-devel] Reorganising the test files?

Nathaniel Smith njs at pobox.com
Sun Jan 29 05:46:49 EST 2017


On Jan 29, 2017 1:44 AM, "Antony Lee" <antony.lee at berkeley.edu> wrote:

It looks like there are two issues at hand here.

- Should there be one test module per real module?  My opinion is that the
answer is generally yes, but there are cases where this would be awkward,
so we shouldn't make it a hard rule.  For example, `test_pickle.py` tests
the picklability of various objects, from simple ones to entire figures.
Of course, each of the tests could be moved to the test module
corresponding to the module where the object is defined, but I doubt this
would make things clearer.

- Should there be a `matplotlib.tests` package containing all the tests
(possibly replicating the matplotlib hierarchy) or one `.tests` subpackage
per package?  Let's realize that matplotlib has a very flat hierarchy
compared to the other projects Nelle mentioned.  Basically, the change
would entail moving
    - test_axes to axes/tests
    - test_backend_* to backends/tests
    - test_cbook to cbook/tests
    - test_triangulation to tri/tests
    - test_style to style/tests


Another thing to consider here is that some pytest features are biased
towards layouts where all tests live in a single hierarchy. If you define a
custom fixture in a conftest.py file, that fixture is available to tests in
the directory and subdirectories, but not siblings. Maybe matplotlib
doesn't use these features though, or maybe there's some way around this in
pytest (if you figure it out I'd love to know! pytest is very, uh, "feature
rich", and I haven't looked into this in depth, it's just something I ran
into).

-n
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-devel/attachments/20170129/5281b87b/attachment.html>


More information about the Matplotlib-devel mailing list