HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/test/__pycache__/test_pkgimport.cpython-37.pyc
B

��g�
�@svddlZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
Gdd�dej�Ze
dkrre��dS)�N)�cache_from_source)�create_empty_filec@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�
TestImportcOsRd|_x&|jtjkr,|jt�tj�7_qW|jd|_tj	j
|f|�|�dS)NZPACKAGE_z.foo)�package_name�sys�modules�random�choose�string�
ascii_letters�module_name�unittest�TestCase�__init__)�self�args�kw�r�//usr/local/lib/python3.7/test/test_pkgimport.pyrs
zTestImport.__init__cCs,x&|j|jfD]}|tjkrtj|=qWdS)N)rrrr)rrrrr�remove_moduless
zTestImport.remove_modulescCsbt��|_tj�|j�tj�|j|j�|_	t�
|j	�ttj�|j	d��tj�|j	d�|_dS)Nz__init__.pyzfoo.py)
�tempfileZmkdtemp�test_dirr�path�append�os�joinrZpackage_dir�mkdirr�module_path)rrrr�setUps


zTestImport.setUpcCs<t�|j�|�tj�|j�d�tj�|j�|��dS)Nr)	�shutilZrmtreerZassertNotEqualrr�count�remover)rrrr�tearDown#szTestImport.tearDownc	CsFt|j�}tj�|�r t�|�t|jd��}|�|�WdQRXdS)N�w)rrrr�existsr!�open�write)r�contentsZ
compiled_path�frrr�rewrite_file)s


zTestImport.rewrite_filecCs�|�d�yt|j�Wntk
r,Yn
Xtd��|�|jtj�|�t	tj|j
d��d}x |tt�kr�|t
�tj�7}qdW|�|�yt|j�Wntk
r�Yn
Xtd��|�d|�t|j�j}|�t||�d�dS)N�forzFailed to induce SyntaxError�foo�azFailed to induce NameError.z%s = 1�)r)�
__import__r�SyntaxError�RuntimeErrorZassertNotInrrZassertFalse�hasattrr�dir�__builtins__rr	r
r�	NameErrorr+ZassertEqual�getattr)r�var�modulerrr�test_package_import__semantics0s(

z)TestImport.test_package_import__semanticsN)	�__name__�
__module__�__qualname__rrrr"r)r8rrrrrs	r�__main__)rrrr
rrr
�importlib.utilrZtest.supportrrrr9�mainrrrr�<module>sC