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 m
| 43 | |
| 44 | |
| 45 | class PytestTester: |
| 46 | """ |
| 47 | Pytest test runner. |
| 48 | |
| 49 | A test function is typically added to a package's __init__.py like so:: |
| 50 | |
| 51 | from numpy._pytesttester import PytestTester |
| 52 | test = PytestTester(__name__).test |
| 53 | del PytestTester |
| 54 | |
| 55 | Calling this test function finds and runs all tests associated with the |
| 56 | module and all its sub-modules. |
| 57 | |
| 58 | Attributes |
| 59 | ---------- |
| 60 | module_name : str |
| 61 | Full path to the package to test. |
| 62 | |
| 63 | Parameters |
| 64 | ---------- |
| 65 | module_name : module name |
| 66 | The name of the module to test. |
| 67 | |
| 68 | Notes |
| 69 | ----- |
| 70 | Unlike the previous ``nose``-based implementation, this class is not |
| 71 | publicly exposed as it performs some ``numpy``-specific warning |
| 72 | suppression. |
| 73 | |
| 74 | """ |
| 75 | def __init__(self, module_name): |
| 76 | self.module_name = module_name |
| 77 | self.__module__ = module_name |
| 78 | |
| 79 | def __call__(self, label='fast', verbose=1, extra_argv=None, |
| 80 | doctests=False, coverage=False, durations=-1, tests=None): |
| 81 | """ |
| 82 | Run tests for module using pytest. |
| 83 | |
| 84 | Parameters |
| 85 | ---------- |
| 86 | label : {'fast', 'full'}, optional |
| 87 | Identifies the tests to run. When set to 'fast', tests decorated |
| 88 | with `pytest.mark.slow` are skipped, when 'full', the slow marker |
| 89 | is ignored. |
| 90 | verbose : int, optional |
| 91 | Verbosity value for test outputs, in the range 1-3. Default is 1. |
| 92 | extra_argv : list, optional |
| 93 | List with any extra arguments to pass to pytests. |
| 94 | doctests : bool, optional |
| 95 | .. note:: Not supported |
| 96 | coverage : bool, optional |
| 97 | If True, report coverage of NumPy code. Default is False. |
| 98 | Requires installation of (pip) pytest-cov. |
| 99 | durations : int, optional |
| 100 | If < 0, do nothing, If 0, report time of all tests, if > 0, |
| 101 | report the time of the slowest `timer` tests. Default is -1. |
| 102 | tests : test or list of tests |
no outgoing calls
no test coverage detected
searching dependent graphs…