
    xKg_                     Z    d dl Z d dlZd dlZd dlZd dlmZ  G d de j                        Zy)    N)Pathc                       e Zd Zd Zy)TestUnpickleDeletedModulec                    dj                  g d      }d}t        j                         5 }t        j                  j                  |       t        | d| d      }t        |d      }|j                  |       |j                          ddl
m} d	d	d	       t        j                  |= t        j                        }t        j                  |      }| j!                   |d
      d       y	# 1 sw Y   ]xY w)a  Create a module that uses Numba, import a function from it.
        Then delete the module and pickle the function. The function
        should load from the pickle without a problem.

        Note - This is a simplified version of how Numba might be used
        on a distributed system using e.g. dask distributed. With the
        pickle being sent to the worker but not the original module.
        
)zfrom numba import vectorizez @vectorize(['float64(float64)'])zdef inc1(x):z    return x + 1
tmp_module/z.pyar   )inc1N      )jointempfileTemporaryDirectorysyspathappendr   openwritecloser   r   modulespickledumpsloadsassertEqual)selfsourcemodnametmp_dirfilenamefr   pkls           l/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/numba/tests/test_unpickle_without_module.py"test_loading_pickle_with_no_modulez<TestUnpickleDeletedModule.test_loading_pickle_with_no_module	   s     
 ((*gHHOOG$ wiq	56HXs#AGGFOGGI ( + KK  ll4 LL1q!% +*s   A$C**C3N)__name__
__module____qualname__r$        r#   r   r      s    ("r)   r   )unittestr   r   r   pathlibr   TestCaser   r(   r)   r#   <module>r-      s&      
  )" 1 1 )"r)   