class documentation
class PytestTester: (source)
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 | The name of the module to test. |
Method | __call__ |
Run tests for module using pytest. |
Method | __init__ |
Undocumented |
Instance Variable | module |
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'}, 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. |
extralist , 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 | |
bool | result - Return True on success, false otherwise. |