%PDF- %PDF-
Direktori : /proc/227033/root/opt/alt/python27/lib64/python2.7/site-packages/numpy/testing/ |
Current File : //proc/227033/root/opt/alt/python27/lib64/python2.7/site-packages/numpy/testing/nosetester.pyc |
� �9Zc @` s� d Z d d l m Z m Z m Z d d l Z d d l Z d d l Z d d l m Z d d l Z d � Z d � Z e e d � Z d e f d � � YZ d � Z d S( se Nose test running. This module implements ``test()`` and ``bench()`` functions for NumPy modules. i ( t divisiont absolute_importt print_functionN( t basestringc C` s� | } g } xQ d | k s( d | k r` t j j | � \ } } | d k rP Pn | j | � q W| s~ d | k rw d Sd Sn | j � | d j d � r� | j d � n d j | � 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( ( sK /opt/alt/python27/lib64/python2.7/site-packages/numpy/testing/nosetester.pyt get_package_name s c C` sq t } d } y d d l } Wn t k r5 t } n X| j | k rN t } n | sm d | } t | � � n | S( s# Import nose only when needed. i i NsW Need nose >= %d.%d.%d for tests - see http://somethingaboutorange.com/mrl/projects/nose( i i i ( t Truet noset ImportErrort Falset __versioninfo__( t fine_noset minimum_nose_versionR t msg( ( sK /opt/alt/python27/lib64/python2.7/site-packages/numpy/testing/nosetester.pyt import_nose8 s c C` s� | d k rH t j d � } | j j d d � } | d k rH t � qH n | d k rg t j | g } n | | g } t � } d d l m } | j d | d | � g � d S( s� 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") from an interpreter will run all the test routine in 'test_matlib.py'. i t __file__( t KnownFailurePlugint argvt addpluginsN( t Nonet syst _getframet f_localst gett AssertionErrorR R t noseclassesR t run( t file_to_runR t fR R ( ( sK /opt/alt/python27/lib64/python2.7/site-packages/numpy/testing/nosetester.pyt run_module_suiteM s # t NoseTesterc B` s� e Z d Z d d d d � Z d � Z d � Z d � Z d d d e e d � Z d d d e e d d � Z d d d d � 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 : None, 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. 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. t releasei c C` s | d k r d } n d } | d k r� t j d | � } | j j d d � } | d k rd t � n t j j | � } | j j d d � } nK t | t t � � r� t j j | j � } t | d d � } n t | � } | | _ | d k r� t | � } n | | _ | | _ d S( NR- i R t __name__( R! R"