Current File : //usr/lib/python3/dist-packages/twisted/python/test/__pycache__/modules_helpers.cpython-312.pyc |
�
Ϫ�f � �P � d Z ddlZddlmZ ddlmZmZmZ ddlm Z G d� d� Z
y)z\
Facilities for helping test code which interacts with Python's module system
to load code.
� N)�
ModuleType)�Iterable�List�Tuple)�FilePathc �^ � e Zd ZdZdee ddfd�Zdeeee f ddfd�Z
d
dedee fd �Zy)�TwistedModulesMixinz�
A mixin for C{twisted.trial.unittest.SynchronousTestCase} providing useful
methods for manipulating Python's module system.
�sysPath�returnNc � �� t j dd �d�fd�}| j |� |t j dd y)zW
Replace sys.path, for the duration of the test, with the given value.
Nc �, �� � t j d d y �N)�sys�path)�originalSysPaths ��E/usr/lib/python3/dist-packages/twisted/python/test/modules_helpers.py�cleanUpSysPathz:TwistedModulesMixin.replaceSysPath.<locals>.cleanUpSysPath s �� �)�C�H�H�Q�K� �r N)r r �
addCleanup)�selfr
r r s @r �replaceSysPathz"TwistedModulesMixin.replaceSysPath s2 �� � �(�(�1�+�� *�
����'������r �
sysModulesc �� �� t j j � �d�fd�}| j |� t j j � t j j |� y)zZ
Replace sys.modules, for the duration of the test, with the given value.
Nc � �� t j j � t j j � � y r )r �modules�clear�update)�originalSysModuless �r �cleanUpSysModulesz@TwistedModulesMixin.replaceSysModules.<locals>.cleanUpSysModules( s&