U
    ,d_                     @   sB   d dl Z d dlZd dlZd dlZd dlmZ G dd de jZdS )    N)Pathc                   @   s   e Zd Zdd ZdS )TestUnpickleDeletedModulec              	   C   s   d ddddg}d}t N}tj| t| d| d}t|d	}|| |	  d
dl
m} W 5 Q R X tj|= t|}t|}| |dd dS )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   )inc1      N)jointempfileTemporaryDirectorysyspathappendr   openwritecloser   r   modulespickledumpsloadsassertEqual)selfsourcemodnameZtmp_dirfilenamefr   Zpkl r   L/tmp/pip-unpacked-wheel-eu7e0c37/numba/tests/test_unpickle_without_module.py"test_loading_pickle_with_no_module	   s&    





z<TestUnpickleDeletedModule.test_loading_pickle_with_no_moduleN)__name__
__module____qualname__r    r   r   r   r   r      s   r   )Zunittestr   r   r   pathlibr   ZTestCaser   r   r   r   r   <module>   s
   