File: //lib/python3/dist-packages/numpy/testing/_private/__pycache__/nosetester.cpython-310.pyc
o
6��a�K � @ sh d Z ddlZddlZddlZddlZddlmZmZ g d�Z dd� Z
ddd �ZG d
d� d�Zdd
� Z
dS )ze
Nose test running.
This module implements ``test()`` and ``bench()`` functions for NumPy modules.
� N� )�import_nose�suppress_warnings)�get_package_name�run_module_suite�
NoseTester�
_numpy_testerr r r c C s� | dd� }g }d| v sd| v r*t j�| �\} }|dv rn
|�|� d| v sd| v s|s4d|v r2dS dS |�� |d �d�rD|�d� d �|�S )
a&
Given a path where a package is installed, determine its name.
Parameters
----------
filepath : str
Path to a file. If the determination fails, "numpy" is returned.
Examples
--------
>>> np.testing.nosetester.get_package_name('nonsense')
'numpy'
N�
site-packages�
dist-packages)r r
�scipy�numpyr z.egg�.)�os�path�split�append�reverse�endswith�pop�join)�filepath�fullpath�pkg_name�p2� r �C/usr/lib/python3/dist-packages/numpy/testing/_private/nosetester.pyr s
�
r c C st | du rt �d�}|j�dd�} | du rt�|du r!t j| g }n|| g }t� }ddlm} |j ||� gd� dS )a�
Run a test module.
Equivalent to calling ``$ nosetests <argv> <file_to_run>`` from
the command line
Parameters
----------
file_to_run : str, optional
Path to test module, or None.
By default, run the module from which this function is called.
argv : list of strings
Arguments to be passed to the nose test runner. ``argv[0]`` is
ignored. All command line arguments accepted by ``nosetests``
will work. If it is the default value None, sys.argv is used.
.. versionadded:: 1.9.0
Examples
--------
Adding the following::
if __name__ == "__main__" :
run_module_suite(argv=sys.argv)
at the end of a test module will run the tests when that module is
called in the python interpreter.
Alternatively, calling::
>>> run_module_suite(file_to_run="numpy/tests/test_matlib.py") # doctest: +SKIP
from an interpreter will run all the test routine in 'test_matlib.py'.
Nr �__file__)�KnownFailurePlugin��argv�
addplugins)
�sys� _getframe�f_locals�get�AssertionErrorr r �noseclassesr �run)�file_to_runr �f�noser r r r r = s #
r c @ s^ e Zd ZdZ ddd�Zdd � Zd
d� Zdd
� Z ddd�Z ddd�Z ddd�Z
dS )r a�
Nose test runner.
This class is made available as numpy.testing.Tester, and a test function
is typically added to a package's __init__.py like so::
from numpy.testing import Tester
test = Tester().test
Calling this test function finds and runs all tests associated with the
package and all its sub-packages.
Attributes
----------
package_path : str
Full path to the package to test.
package_name : str
Name of the package to test.
Parameters
----------
package : module, str or None, optional
The package to test. If a string, this should be the full path to
the package. If None (default), `package` is set to the module from
which `NoseTester` is initialized.
raise_warnings : None, str or sequence of warnings, optional
This specifies which warnings to configure as 'raise' instead
of being shown once during the test execution. Valid strings are:
- "develop" : equals ``(Warning,)``
- "release" : equals ``()``, don't raise on any warnings.
Default is "release".
depth : int, optional
If `package` is None, then this can be used to initialize from the
module of the caller of (the caller of (...)) the code that
initializes `NoseTester`. Default of 0 means the module of the
immediate caller; higher values are useful for utility routines that
want to initialize `NoseTester` objects on behalf of other code.
N�releaser Fc C s� |d u rd}d }|d u r.t �d| �}|j�dd �}|d u r t�tj�|�}|j�dd �}nt|t t��rCtj�|j
�}t|dd �}nt|�}|| _
|d u rRt|�}|| _|| _|| _d S )Nr+ r r �__name__)r! r"