Sindbad~EG File Manager
�
)Μga0 � �X � d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl m
Z
e j d� � Ze j d� � Z
G d� dej � Z G d� de� Z G d � d
e� Z G d� de� Z G d
� de� Z G d� de� Z G d� de� Z G d� de� Z G d� de� Z G d� de� Z G d� de� Z G d� de� Z G d� de� Z G d� d e� Z G d!� d"e� Z G d#� d$e� Z G d%� d&e� Ze d'k( r ejB � yy)(� N)�utilc # � K � t j } t j j � } d�� | t _ t j j � t j j |� y# | t _ t j j � t j j |� w xY w�w)z�
Make sure sys.modules is the same object and has the same content
when exiting the context as when entering.
Similar to importlib.test.util.uncache, but doesn't require explicit
names.
N)�sys�modules�copy�clear�update)�sys_modules_saved�sys_modules_copys �D/usr/local/lib/python3.12/test/test_importlib/test_namespace_pkgs.py�sys_modules_contextr
s� � �� � �����{�{�'�'�)��-�
�'��������������+�,�� (��������������+�,�s �/C�A? �A C�?A
C � Cc + �* K � | j dt j � | j dt j � t j
di | ��}|5 t
� 5 d�� ddd� ddd� y# 1 sw Y �xY w# 1 sw Y yxY w�w)z�
Save import state and sys.modules cache and restore it on exit.
Typical usage:
>>> with namespace_tree_context(path=['/tmp/xxyy/portion1',
... '/tmp/xxyy/portion2']):
... pass
� meta_path�
path_hooksN� )�
setdefaultr r r r �import_stater
)�kwargs�import_contexts r �namespace_tree_contextr ( sc � �� � ���k�3�=�=�1�
���l�C�N�N�3��&�&�0��0�N� �,�.�
� /���.�.����s6 �AB�B�%A;�*B�2 B�;B � B�B�Bc � � e Zd ZdZej
j
ej
j e� d� Z d� Z
y)�NamespacePackageTestzj
Subclasses should define self.root and self.paths (under that root)
to be added to sys.path.
�namespace_pkgsc �� � | j D �cg c], }t j j | j |� ��. c}| _ | j
t | j
�� � y c c}w )N)�path)�paths�osr �join�root�resolved_paths�enterContextr )�selfr s r �setUpzNamespacePackageTest.setUp@ sV � �6:�j�j�
�6@�d�B�G�G�L�L����D�)�j�
���
���0�d�6I�6I�J�K��
s �1A.N)�__name__�
__module__�__qualname__�__doc__r r r �dirname�__file__r r# r � r r r 9 s1 � �� �7�7�<�<�������1�3C�D�D�Lr* r c �$ � e Zd ZdgZd� Zd� Zd� Zy)�SingleNamespacePackage�portion1c �X � dd l }| j |j j d� y �Nr �portion1 foo one��foo.one�assertEqual�one�attr�r"