MCPcopy Create free account
hub / github.com/numpy/numpy / PytestTester

Class PytestTester

numpy/_pytesttester.py:46–207  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

44
45
46class PytestTester:
47 """
48 Pytest test runner.
49
50 A test function is typically added to a package's __init__.py like so::
51
52 from numpy._pytesttester import PytestTester
53 test = PytestTester(__name__).test
54 del PytestTester
55
56 Calling this test function finds and runs all tests associated with the
57 module and all its sub-modules.
58
59 Attributes
60 ----------
61 module_name : str
62 Full path to the package to test.
63
64 Parameters
65 ----------
66 module_name : module name
67 The name of the module to test.
68
69 Notes
70 -----
71 Unlike the previous ``nose``-based implementation, this class is not
72 publicly exposed as it performs some ``numpy``-specific warning
73 suppression.
74
75 """
76 def __init__(self, module_name):
77 self.module_name = 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'

Callers 13

__init__.pyFile · 0.90
__init__.pyFile · 0.90
__init__.pyFile · 0.90
__init__.pyFile · 0.90
__init__.pyFile · 0.90
__init__.pyFile · 0.90
__init__.pyFile · 0.90
__init__.pyFile · 0.90
__init__.pyFile · 0.90
__init__.pyFile · 0.90
__init__.pyFile · 0.90
__getattr__Function · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected