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 igno
(self, label='fast', verbose=1, extra_argv=None,
doctests=False, coverage=False, durations=-1, tests=None)
| 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 |
| 103 | Tests to be executed with pytest '--pyargs' |
| 104 | |
| 105 | Returns |
| 106 | ------- |
| 107 | result : bool |
| 108 | Return True on success, false otherwise. |
| 109 | |
| 110 | Notes |
| 111 | ----- |
| 112 | Each NumPy module exposes `test` in its namespace to run all tests for |
| 113 | it. For example, to run all tests for numpy.lib: |
| 114 | |
| 115 | >>> np.lib.test() #doctest: +SKIP |
| 116 | |
| 117 | Examples |
| 118 | -------- |
| 119 | >>> result = np.lib.test() #doctest: +SKIP |
| 120 | ... |
| 121 | 1023 passed, 2 skipped, 6 deselected, 1 xfailed in 10.39 seconds |
| 122 | >>> result |
| 123 | True |
| 124 | |
| 125 | """ |
| 126 | import pytest |
| 127 | |
| 128 | module = sys.modules[self.module_name] |
| 129 | module_path = os.path.abspath(module.__path__[0]) |
| 130 | |
| 131 | # setup the pytest arguments |
| 132 | pytest_args = ["-l"] |
| 133 | |
| 134 | # offset verbosity. The "-q" cancels a "-v". |
| 135 | pytest_args += ["-q"] |
| 136 |
nothing calls this directly
no test coverage detected