[SciPy-Dev] [GSoC 2017] Nose to Pytest Migration - conclusions from previous thread

Robert Kern robert.kern at gmail.com
Sun Mar 12 10:56:07 EDT 2017


On Sun, Mar 12, 2017 at 12:19 AM, Karan Desai <karandesai281196 at gmail.com>
wrote:

> While testing utils can be kept independent of pytest, we should fully
embrace pytest for own own unit tests. or even better, we can thinly wrap
pytest and make array assertion possible by plain assert keyword statements
in some way. ( I haven't thought about it yet ).

I don't think it's possible, no. pytest and nose don't change the operation
of the `assert` statement at all; they just introspect the code and the
namespace when the assertion fails to provide a helpful message. `assert x
== y` just doesn't work when the arguments are arrays because the result is
not coerceable to a proper `bool`.

> Making the test suites just work with pytest is a matter of one PR, or a
weekend's work and I agree with developers of scikit-image. But it takes
more time to complete redesign tests in flavor of pytest, after all we have
to think about future contributors joining in. People experienced with
pytest should fine the test suite design familiar, for contributions. I
think that scikit-image has achieved the former, but still might need some
PRs for the latter ( I'm glad to help in future ).
>
> Here are some notable changes which are required for pytest transition:
>
> Plain assert keyword statements.

Just a note: numpy's test suite, at least, must not use `assert`
statements. numpy's test suite must be runnable under `python -O`. numpy
does some docstring manipulation that could fail in principle under those
conditions (i.e. it did fail at one point until we fixed it, so now we have
to ensure that it doesn't regress). scipy might have the same issue (e.g.
`scipy.special` ufuncs and `scipy.stats` distribution objects), but I
forget if we've made that a policy there too.

So if you mean, by this requirement, that we convert all of our
`assert_equal(x, y)` calls to `assert x == y`, no, we won't be doing that,
even in the cases where it would be possible.

--
Robert Kern
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20170312/490369d6/attachment.html>


More information about the SciPy-Dev mailing list