[Numpy-discussion] pytest, fixture and parametrize (original) (raw)

Chris Barker - NOAA Federal chris.barker at noaa.gov
Thu Aug 9 17:27:03 EDT 2018


On Aug 8, 2018, at 5:40 PM, Matti Picus <matti.picus at gmail.com> wrote: We have these guidelines http://www.numpy.org/devdocs/reference/testing.html,

Thanks Matti — that’s clearly the place to document best practices.

It was updated for pytest in the 1.15 release, but could use some more editing and refinement.

Giving it s quick read right now, it clearly has not embraced pytest (yet?)

Before we try to update the doc, we should have some guidelines as to the goals.

At the broad level — do we want to make use of the pytest testing Framework, or just use pytest as a test runner?

I would say that it’s a no brainer, except that he numpy testing framework already has a lot of the key features of pytest that we need.

Options:

  1. Use pytest only for test running

  2. Use pytest features that numpy.testing does not have a good replacement for.

  3. prefer pytest features for new tests.

In all cases, I think we should limit ourselves to the less magical pytest features.

BTW, I see this:

“Setup and teardown functions to functions and methods are known as “fixtures”, and their use is not encouraged.”

First, is that a typo? I don’t understand what it means. Though I think I know what a fixture is.

Second — why are fixtures discouraged?

Third, if fixtures are discouraged, rather than banned, we should say when it is OK to use one.

-CHB

Matti


NumPy-Discussion mailing list NumPy-Discussion at python.org https://mail.python.org/mailman/listinfo/numpy-discussion



More information about the NumPy-Discussion mailing list