]Kc @ sz d Z d d k Z d d k Z d Z d Z e d Z d Z d e f d YZ d Z d Z d Z d S( se Nose test running. This module implements ``test()`` and ``bench()`` functions for NumPy modules. iNc C s | } g } xV d | j p d | j o; t i i | \ } } | d j o Pn | i | q W| p d | j o d Sd Sn | i | d i d o | i d n d i | 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-packagest scipyt numpyi s .eggt .( s site-packagess dist-packages( t ost patht splitt appendt reverset endswitht popt join( t filepatht fullpatht pkg_namet p2( ( s> /usr/lib64/python2.6/site-packages/numpy/testing/nosetester.pyt get_package_name s c C s t } d } y d d k } d d k l } Wn t j o t } n X| i | j o t } n | p d | } t | n | S( s# Import nose only when needed. i i iN( t raisessW Need nose >= %d.%d.%d for tests - see http://somethingaboutorange.com/mrl/projects/nose( i i i ( t Truet noset nose.toolsR t ImportErrort Falset __versioninfo__( t fine_noset minimum_nose_versionR R t msg( ( s> /usr/lib64/python2.6/site-packages/numpy/testing/nosetester.pyt import_nose2 s c C sR | d j o( t i d } | i i d d } n t i d d | g d S( Ni t __file__t argvt ( t Nonet syst _getframet f_localst getR t run( t file_to_runt f( ( s> /usr/lib64/python2.6/site-packages/numpy/testing/nosetester.pyt run_module_suiteI s c C s; | i p d Sd h | d 6} | i h | d 6| _ d S( NsS Parameters ---------- label : {'fast', 'full', '', attribute identifer} Identifies the %(testtype)ss 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 nosetests -A option of 'not slow'. 'full' - fast (as above) and slow %(testtype)ss as in the no -A option to nosetests - same as '' None or '' - run all %(testtype)ss attribute_identifier - string passed directly to nosetests as '-A' verbose : integer verbosity value for test outputs, 1-10 extra_argv : list List with any extra args to pass to nosetestst testtypet test_header( t __doc__( t methR' R( ( ( s> /usr/lib64/python2.6/site-packages/numpy/testing/nosetester.pyt _docmethodR s t NoseTesterc B s e Z d Z d d Z d Z d Z d d d e e d Z d d d e e d Z d d d d Z e e d e e d e e d 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 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. c C s d } | d j oO t i d } | i i d d } t i i | } | i i d d } nN t | t t o+ t i i | i } t | d d } n t | } | | _ | d j o t | } n | | _ d S( s Test class init Parameters ---------- package : string or module If string, gives full path to package If None, extract calling module path Default is None i R t __name__N( R R R R! R" R R t dirnamet isinstancet typeR t getattrt strt package_pathR t package_name( t selft packageR4 R% R3 ( ( s> /usr/lib64/python2.6/site-packages/numpy/testing/nosetester.pyt __init__ s c C s t | i d g } | oU | d j oH t | t p t d n | d j o d } n | d | g 7} n | d t | g 7} | o | | 7} n | S( sE Generate argv for nosetest command %(test_header)s s -st fulls" Selection label should be a stringt fasts not slows -As --verbosity( R R3 R/ t basestringt TypeErrorR2 ( R5 t labelt verboset extra_argvR ( ( s> /usr/lib64/python2.6/site-packages/numpy/testing/nosetester.pyt _test_argv s c C s t } d d k } d | i GHt i i | i } d | GHd | i j o: d d k } d | i GHt i i | i } d | GHn t i i d d } d | GHd | i GHd S( Nis NumPy version %ss NumPy is installed in %sR s SciPy version %ss SciPy is installed in %ss R s Python version %ss nose version %d.%d.%d( R R t __version__R R R. R R4 R R t versiont replaceR ( R5 R R t npdirR t spdirt pyversion( ( s> /usr/lib64/python2.6/site-packages/numpy/testing/nosetester.pyt _show_system_info s R9 i c C sq | o$ d | j o | i d t } n | i | | | } | o | d g 7} n | o$ | d | i d d d d g 7} n | d d g 7} | d d g 7} | d d g 7} | d d g 7} | d d g 7} | d d g 7} t } d d k } d d k l } l } | | g } xD | i i i D]3 } | } | i d j o q0n | i | q0W| | f S( 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 --with-doctests --with-numpydoctests --cover-package=%ss --with-coverages --cover-testss --cover-inclusives --cover-erases --excludet f2py_extt f2py_f90_extt gen_extt pyrex_extt swig_extt array_from_pyobjiN( t NumpyDoctestt KnownFailuret doctest( t removeR R? R4 R t nose.plugins.builtint noseclassesRM RN t pluginst builtint nameR ( R5 R<