
    xKg                     |    d dl Zd dlZd dlZd dlZd dlmZ ddlm	Z	 e G d de	             Z
e G d de	             Zy)	    N)skip_parfors_unsupported   )DispatcherCacheUsecasesTestc                       e Zd Zej                  j                  e      Zej                  j                  ed      Z	dZ
ddZd Zd Zd Zy)	TestParforsCacheparfors_cache_usecases.pyparfors_caching_test_fodderc                    | j                         }| j                  d       t        ||      }t        j                  d      }t        j
                  j                   ||      |j                  |             |j                  j                         D cg c]  }|j                  j                   }}|j                  j                         \  }| j                  |dg       | j                  |dz         | j                          y c c}w )Nr   
   F   )import_modulecheck_pycachegetattrnponestestingassert_allclosepy_func	overloadsvalueslibraryhas_dynamic_globalsassertEqualrun_in_separate_process)selffname	num_funcsmodfarycresdynamic_globalss           d/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/numba/tests/test_parfors_caching.pyrun_testzTestParforsCache.run_test   s      "1Cggbk 	

""1S6199S>: (){{'9'9';=';t  <<;;'; 	 =##%5'29q=)$$&=s   Dc                 *    d}| j                  |       y )Narrayexprs_caser$   r   r   s     r#   test_arrayexprsz TestParforsCache.test_arrayexprs#   s    a    c                 *    d}| j                  |       y )Nprange_caser'   r(   s     r#   test_prangezTestParforsCache.test_prange'   s    ar*   c                 .    d}| j                  |d       y )Ncaller_case   )r   r'   r(   s     r#   test_callerzTestParforsCache.test_caller+   s     	a1%r*   N)r   )__name__
__module____qualname__ospathdirname__file__herejoinusecases_filemodnamer$   r)   r-   r1    r*   r#   r   r      sB    77??8$DGGLL'BCM+G'$&r*   r   c                       e Zd Zej                  j                  e      Zej                  j                  ed      Z	dZ
d Zd Zy)TestParforsCacheChangingThreadsr   r	   c                    dt        | j                  | j                        z  }i t        j                  dt        |      i}t        j                  t        j                  d|gt        j                  t        j                  |      }|j                         \  }}|j                  dk7  r*t        d|j                   d|j                          d	      y )
Nzif 1:
            import sys

            sys.path.insert(0, %(tempdir)r)
            mod = __import__(%(modname)r)
            mod.self_run()
            )tempdirr<   NUMBA_NUM_THREADSz-c)stdoutstderrenvr   zprocess failed with code z:stderr follows

)dictrA   r<   r5   environstr
subprocessPopensys
executablePIPEcommunicate
returncodeAssertionErrordecode)r   thread_countcodenew_envpopenouterrs          r#   r   z7TestParforsCacheChangingThreads.run_in_separate_process;   s     t||T\\BC JRZZI!4s<7HI  #..$!=(2
%,. $$&Sq  #<U=M=M<N O447JJL>"E F F !r*   c                     | j                  d       | j                  d       | j                  d       | j                  d       | j                  d       y )Nr   r      r   )r   r   )r   s    r#   test_cachingz,TestParforsCacheChangingThreads.test_cachingN   sH    1$$Q'5!$$Q'5!r*   N)r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r   r[   r=   r*   r#   r?   r?   2   s;    
 77??8$DGGLL'BCM+GF&"r*   r?   )os.pathr5   rJ   rL   numpyr   numba.tests.supportr   r[   r   r   r?   r=   r*   r#   <module>r_      sP      
  8 5 #&2 #& #&L  "&A  "  "r*   