Current File : //proc/self/root/proc/self/root/lib64/python2.7/site-packages/numpy/testing/nosetester.pyc
�
E�`Qc@sndZddlZddlZddlZddlZd�Zd�Zdd�Z	de
fd��YZdS(se
Nose test running.

This module implements ``test()`` and ``bench()`` functions for NumPy modules.

i����NcCs�|}g}xQd|ks(d|kr`tjj|�\}}|dkrPPn|j|�qW|s~d|krwdSdSn|j�|djd�r�|jd�ndj|�S(	s&
    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'

    s
site-packagess
dist-packagestscipytnumpyis.eggt.(s
site-packagess
dist-packages(tostpathtsplittappendtreversetendswithtpoptjoin(tfilepathtfullpathtpkg_nametp2((s>/usr/lib64/python2.7/site-packages/numpy/testing/nosetester.pytget_package_names
cCs�t}d}y ddl}ddlm}Wntk
rEt}nX|j|kr^t}n|s}d|}t|��n|S(s# Import nose only when needed.
    ii
i����N(traisessWNeed nose >= %d.%d.%d for tests - see http://somethingaboutorange.com/mrl/projects/nose(ii
i(tTruetnoset
nose.toolsRtImportErrortFalset__versioninfo__(t	fine_nosetminimum_nose_versionRRtmsg((s>/usr/lib64/python2.7/site-packages/numpy/testing/nosetester.pytimport_nose4s

	cCse|dkrHtjd�}|jjdd�}|dkrHt�qHnt�jdd|g�dS(Nit__file__targvt(tNonetsyst	_getframetf_localstgettAssertionErrorRtrun(tfile_to_runtf((s>/usr/lib64/python2.7/site-packages/numpy/testing/nosetester.pytrun_module_suiteKst
NoseTestercBs�eZdZdddddgZddd�Zd�Zd	�Zd
�Zddde	e	d
�Z
ddde	e	dd�Zdddd�ZRS(s�
    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 : str or sequence of warnings, optional
        This specifies which warnings to configure as 'raise' instead
        of 'warn' during the test execution.  Valid strings are:

          - "develop" : equals ``(DeprecationWarning, RuntimeWarning)``
          - "release" : equals ``()``, don't raise on any warnings.

        See Notes for more details.

    Notes
    -----
    The default for `raise_warnings` is
    ``(DeprecationWarning, RuntimeWarning)`` for the master branch of NumPy,
    and ``()`` for maintenance branches and released versions.  The purpose
    of this switching behavior is to catch as many warnings as possible
    during development, but not give problems for packaging of released
    versions.

    tf2py_exttf2py_f90_exttgen_extt	pyrex_exttswig_exttreleasecCs�d}|dkrutjd�}|jjdd�}|dkrKt�ntjj|�}|jjdd�}nKt	|t
t��r�tjj|j�}t|dd�}nt
|�}||_|dkr�t|�}n||_||_dS(NiRt__name__(RRR R!R"R#RRtdirnamet
isinstancettypeRtgetattrtstrtpackage_pathRtpackage_nametraise_warnings(tselftpackageR7R6R&R5((s>/usr/lib64/python2.7/site-packages/numpy/testing/nosetester.pyt__init__�s"			cCs�t|jdg}|rj|dkrjt|t�sBtd��n|dkrWd}n|d|g7}n|dt|�g7}|r�||7}n|S(s Generate argv for nosetest command

        Parameters
        ----------
        label : {'fast', 'full', '', attribute identifier}, optional
            see ``test`` docstring
        verbose : int, optional
            Verbosity value for test outputs, in the range 1-10. Default is 1.
        extra_argv : list, optional
            List with any extra arguments to pass to nosetests.

        Returns
        -------
        argv : list
            command line arguments that will be passed to nose
        s-stfulls"Selection label should be a stringtfastsnot slows-As--verbosity(RR5R1t
basestringt	TypeErrorR4(R8tlabeltverboset
extra_argvR((s>/usr/lib64/python2.7/site-packages/numpy/testing/nosetester.pyt
_test_argv�s	
cCs�t�}ddl}d|jGHtjj|j�}d|GHd|jkr�ddl}d|jGHtjj|j�}d|GHnt	j
jdd�}d	|GHd
|jGHdS(Ni����sNumPy version %ssNumPy is installed in %sRsSciPy version %ssSciPy is installed in %ss
RsPython version %ssnose version %d.%d.%d(
RRt__version__RRR0RR6RRtversiontreplaceR(R8RRtnpdirRtspdirt	pyversion((s>/usr/lib64/python2.7/site-packages/numpy/testing/nosetester.pyt_show_system_info�s			cCsddlm}|�S(s� Return instantiated plugin for doctests

        Allows subclassing of this class to override doctester

        A return value of None means use the nose builtin doctest plugin
        i����(tNumpyDoctest(tnoseclassesRJ(R8RJ((s>/usr/lib64/python2.7/site-packages/numpy/testing/nosetester.pyt_get_custom_doctester�sR<icCsot�|j|||�}x!|jD]}|d|g7}q&W|rf|d|jdddg7}nddl}ddlm}	m}
|	�g}|g|jj	jD]}|�^q�7}d	|k}
|t
kr�|
r�t}n|j�}|dkr|re|
re|d	g7}qenI|
r2|jd	�n||
d
�|g7}|re|d|jg7}n||fS(s�
        Run tests for module using nose.

        This method does the heavy lifting for the `test` method. It takes all
        the same arguments, for details see `test`.

        See Also
        --------
        test

        s	--excludes--cover-package=%ss--with-coverages
--cover-testss
--cover-erasei����N(tKnownFailuret	Unpluggers--with-doctesttdoctests--with-(RRBtexcludesR6tnose.plugins.builtinRKRMRNtpluginstbuiltinRRRLRtremovetname(R8R?R@RAtdocteststcoverageRtenameRRMRNRRtptdoctest_argvtplug((s>/usr/lib64/python2.7/site-packages/numpy/testing/nosetester.pytprepare_test_args�s0)	
cCs�t|d�}ddl}||_|r9d|jGHnd|jGH|j�ddl}d|_|dkr||j}nt	dt
tfdd�}	||	j�kr�|	|}nt
jjj�}
|
j�tj�tjdd	t
�x!|D]}tjd
d	|�q�Wtjddd
�tjddd�tjddd�zPddlm}|j|||||�\}
}|d|
dtd|�}Wd|
j�X|jS(s�
        Run tests for module using nose.

        Parameters
        ----------
        label : {'fast', 'full', '', attribute identifier}, optional
            Identifies the tests to run. This can be a string to pass to
            the nosetests executable with the '-A' option, or one of several
            special values.  Special values are:
            * 'fast' - the default - which corresponds to the ``nosetests -A``
              option of 'not slow'.
            * 'full' - fast (as above) and slow tests as in the
              'no -A' option to nosetests - this is the same as ''.
            * None or '' - run all tests.
            attribute_identifier - string passed directly to nosetests as '-A'.
        verbose : int, optional
            Verbosity value for test outputs, in the range 1-10. Default is 1.
        extra_argv : list, optional
            List with any extra arguments to pass to nosetests.
        doctests : bool, optional
            If True, run doctests in module. Default is False.
        coverage : bool, optional
            If True, report coverage of NumPy code. Default is False.
            (This requires the `coverage module:
             <http://nedbatchelder.com/code/modules/coverage.html>`_).
        raise_warnings : str or sequence of warnings, optional
            This specifies which warnings to configure as 'raise' instead
            of 'warn' during the test execution.  Valid strings are:

              - "develop" : equals ``(DeprecationWarning, RuntimeWarning)``
              - "release" : equals ``()``, don't raise on any warnings.

        Returns
        -------
        result : object
            Returns the result of running the tests as a
            ``nose.result.TextTestResult`` object.

        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
        Running unit tests for numpy.lib
        ...
        Ran 976 tests in 3.933s

        OK

        >>> result.errors #doctest: +SKIP
        []
        >>> result.knownfail #doctest: +SKIP
        []
        ii����Ns&Running unit tests and doctests for %ssRunning unit tests for %stdevelopR.talwaystcategoryterrortignoretmessagesNot importing directorysnumpy.dtype size changedsnumpy.ufunc size changed(tNumpyTestProgramRtexitRR((tmintutilsR@R6RIRORtmasterR7tdicttDeprecationWarningtRuntimeWarningtkeysRttestingtWarningManagert	__enter__twarningst
resetwarningstfilterwarningsRKRcR\Rt__exit__tresult(R8R?R@RARVRWR7RfROt
_warn_optstwarn_ctxtwarningtypeRcRRRtt((s>/usr/lib64/python2.7/site-packages/numpy/testing/nosetester.pyttest
s>@	
		



	cCs�d|jGH|j�|j|||�}|ddtjg7}t�}ddlm}|d�g}|jd|d|�S(	s�
        Run benchmarks for module using nose.

        Parameters
        ----------
        label : {'fast', 'full', '', attribute identifier}, optional
            Identifies the benchmarks to run. This can be a string to pass to
            the nosetests executable with the '-A' option, or one of several
            special values.  Special values are:
            * 'fast' - the default - which corresponds to the ``nosetests -A``
              option of 'not slow'.
            * 'full' - fast (as above) and slow benchmarks as in the
              'no -A' option to nosetests - this is the same as ''.
            * None or '' - run all tests.
            attribute_identifier - string passed directly to nosetests as '-A'.
        verbose : int, optional
            Verbosity value for benchmark outputs, in the range 1-10. Default is 1.
        extra_argv : list, optional
            List with any extra arguments to pass to nosetests.

        Returns
        -------
        success : bool
            Returns True if running the benchmarks works, False if an error
            occurred.

        Notes
        -----
        Benchmarks are like tests, but have names starting with "bench" instead
        of "test", and can be found under the "benchmarks" sub-directory of the
        module.

        Each NumPy module exposes `bench` in its namespace to run all benchmarks
        for it.

        Examples
        --------
        >>> success = np.lib.bench() #doctest: +SKIP
        Running benchmarks for numpy.lib
        ...
        using 562341 items:
        unique:
        0.11
        unique1d:
        0.11
        ratio: 1.0
        nUnique: 56230 == 56230
        ...
        OK

        >>> success #doctest: +SKIP
        True

        sRunning benchmarks for %ss--matchs(?:^|[\\b_\\.%s-])[Bb]enchi����(RNRORt
addplugins(	R6RIRBRtsepRRKRNR$(R8R?R@RARRRNtadd_plugins((s>/usr/lib64/python2.7/site-packages/numpy/testing/nosetester.pytbench~s8
	N(
R/t
__module__t__doc__RPRR:RBRIRLRR\RxR|(((s>/usr/lib64/python2.7/site-packages/numpy/testing/nosetester.pyR(Us ,				
	-	r(R~RRRotnumpy.testing.utilsRRRRR'tobjectR((((s>/usr/lib64/python2.7/site-packages/numpy/testing/nosetester.pyt<module>s	(