class documentation

class PytestTester:

View In Hierarchy

Pytest test runner.

A test function is typically added to a package's __init__.py like so:

from numpy._pytesttester import PytestTester
test = PytestTester(__name__).test
del PytestTester

Calling this test function finds and runs all tests associated with the module and all its sub-modules.

Attributes

module_name : str
Full path to the package to test.

Parameters

module_name : module name
The name of the module to test.

Notes

Unlike the previous nose-based implementation, this class is not publicly exposed as it performs some numpy-specific warning suppression.

Method __call__ Run tests for module using pytest.
Method __init__ Undocumented
Instance Variable module​_name Undocumented
def __call__(self, label='fast', verbose=1, extra_argv=None, doctests=False, coverage=False, durations=-1, tests=None):

Run tests for module using pytest.

Parameters

label : {'fast', 'full'}, optional
Identifies the tests to run. When set to 'fast', tests decorated with pytest.mark.slow are skipped, when 'full', the slow marker is ignored.
verbose : int, optional
Verbosity value for test outputs, in the range 1-3. Default is 1.
extra_argv : list, optional
List with any extra arguments to pass to pytests.
doctests : bool, optional

Note

Not supported

coverage : bool, optional
If True, report coverage of NumPy code. Default is False. Requires installation of (pip) pytest-cov.
durations : int, optional
If < 0, do nothing, If 0, report time of all tests, if > 0, report the time of the slowest timer tests. Default is -1.
tests : test or list of tests
Tests to be executed with pytest '--pyargs'

Returns

result : bool
Return True on success, false otherwise.

Notes

Each NumPy module exposes test in its namespace to run all tests for it. For example, to run all tests for numpy.lib:

>>> np.lib.test() #doctest: +SKIP

Examples

>>> result = np.lib.test() #doctest: +SKIP
...
1023 passed, 2 skipped, 6 deselected, 1 xfailed in 10.39 seconds
>>> result
True
def __init__(self, module_name):

Undocumented

module_name =

Undocumented