zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
U
O±dÚã@s4dZddlZddlZdgZdd„ZGdd„dƒZdS)aa
Pytest test running.
 
This module implements the ``test()`` function for NumPy modules. The usual
boiler plate for doing that is to put the following in the module
``__init__.py`` file::
 
    from numpy._pytesttester import PytestTester
    test = PytestTester(__name__)
    del PytestTester
 
 
Warnings filtering and other runtime settings should be dealt with in the
``pytest.ini`` file in the numpy repo root. The behavior of the test depends on
whether or not that file is found as follows:
 
* ``pytest.ini`` is present (develop mode)
    All warnings except those explicitly filtered out are raised as error.
* ``pytest.ini`` is absent (release mode)
    DeprecationWarnings and PendingDeprecationWarnings are ignored, other
    warnings are passed through.
 
In practice, tests run from the numpy repo are run in develop mode. That
includes the standard ``python runtests.py`` invocation.
 
This module is imported by every numpy subpackage, so lies at the top level to
simplify circular import issues. For the same reason, it contains no numpy
imports at module scope, instead importing numpy within function calls.
éNÚ PytestTestercCsTddl}td|jƒ|jdddjj}td|ƒ|jj ¡}td|rJ|ndƒdS)    NrzNumPy version %s)é
éÚC)Úorderz&NumPy relaxed strides checking option:zNumPy CPU features: znothing enabled)    ÚnumpyÚprintÚ __version__ZonesÚflagsÚ f_contiguousÚlibÚutilsZ    _opt_info)ÚnpZrelaxed_stridesÚinfo©rúJd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\numpy/_pytesttester.pyÚ_show_numpy_info$s 
 rc@s"eZdZdZdd„Zd d    d
„ZdS) raÇ
    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.
 
    Attributes
    ----------
    module_name : str
        Full path to the package to test.
 
    Parameters
    ----------
    module_name : module name
        The name of the module to test.
 
    Notes
    -----
    Unlike the previous ``nose``-based implementation, this class is not
    publicly exposed as it performs some ``numpy``-specific warning
    suppression.
 
    cCs
||_dS)N)Ú module_name)ÚselfrrrrÚ__init__LszPytestTester.__init__ÚfastrNFéÿÿÿÿc
CsÄddl}ddl}    tj|j}
tj |
jd¡} dg} | dg7} |         ¡|     
d¡ddl m } W5QRX|    j    ddddl }W5QRX| d    d
d d g7} | d dg7} |r²| dg7} |rÂ| t|ƒ7} |dkrà| dd|dg7} |rò| d| g7} |dkr*ddlm}|r| ddg7} n | ddg7} n|dkr@| d|g7} |dkrX| d|g7} |dkrj|jg}| dgt|ƒ7} tƒz| | ¡}Wn*tk
rº}z
|j}W5d}~XYnX|dkS)a
        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 ignored.
        verbose : int, optional
            Verbosity value for test outputs, in the range 1-3. Default is 1.
        extra_argv : list, 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
        -------
        result : bool
            Return True on success, false otherwise.
 
        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
 
        rNz-lz-qÚalways)ÚcpuinfoT)Úrecordz!-W ignore:Not importing directoryz"-W ignore:numpy.dtype size changedz"-W ignore:numpy.ufunc size changedz-W ignore::UserWarning:cpuinfoz$-W ignore:the matrix subclass is notz(-W ignore:Importing from numpy.matlib isz--doctest-modulesrú-Úvz--cov=r)ÚIS_PYPYz-mznot slow and not slow_pypyznot slowÚfullz--durations=%sz--pyargs)ÚpytestÚwarningsÚsysÚmodulesrÚosÚpathÚabspathÚ__path__Úcatch_warningsÚ simplefilterZnumpy.distutilsrZnumpy.array_apiÚlistZ numpy.testingrrÚmainÚ
SystemExitÚcode)rÚlabelÚverboseZ
extra_argvZdoctestsZcoverageZ    durationsÚtestsrr ÚmoduleÚ module_pathZ pytest_argsrrrr,ÚexcrrrÚ__call__Os^/ 
 
 
üþ
 
 
 
 
zPytestTester.__call__)rrNFFrN)Ú__name__Ú
__module__Ú __qualname__Ú__doc__rr3rrrrr.sÿ)r7r!r#Ú__all__rrrrrrÚ<module>s