class documentation

class PytestTester: (source)

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.

Notes

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

Parameters
module_nameThe name of the module to test.
Method __call__ Run tests for module using pytest.
Method __init__ Undocumented
Instance Variable module_name Full path to the package to test.
def __call__(self, label='fast', verbose=1, extra_argv=None, doctests=False, coverage=False, durations=-1, tests=None): (source)

Run tests for module using pytest.

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
Parameters
label:{'fast', 'full'}, optionalIdentifies 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, optionalVerbosity value for test outputs, in the range 1-3. Default is 1.
extra_argv:list, optionalList with any extra arguments to pass to pytests.
doctests:bool, optional

Note

Not supported

coverage:bool, optionalIf True, report coverage of NumPy code. Default is False. Requires installation of (pip) pytest-cov.
durations:int, optionalIf < 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 testsTests to be executed with pytest '--pyargs'
Returns
boolresult - Return True on success, false otherwise.
def __init__(self, module_name): (source)

Undocumented

module_name: module name = (source)

Full path to the package to test.