HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3/dist-packages/twisted/python/test/__pycache__/modules_helpers.cpython-38.pyc
U


W[E�@s<dZddlmZmZddlZddlmZGdd�de�ZdS)z\
Facilities for helping test code which interacts with Python's module system
to load code.
�)�division�absolute_importN)�FilePathc@s*eZdZdZdd�Zdd�Zd
dd�Zd	S)�TwistedModulesMixinz�
    A mixin for C{twisted.trial.unittest.SynchronousTestCase} providing useful
    methods for manipulating Python's module system.
    cs6tjdd���fdd�}|�|�|tjdd�<dS)zW
        Replace sys.path, for the duration of the test, with the given value.
        Ncs�tjdd�<dS�N)�sys�path��ZoriginalSysPathr	�E/usr/lib/python3/dist-packages/twisted/python/test/modules_helpers.py�cleanUpSysPathsz:TwistedModulesMixin.replaceSysPath.<locals>.cleanUpSysPath)rr�
addCleanup)�selfZsysPathrr	r
r�replaceSysPaths
z"TwistedModulesMixin.replaceSysPathcs:tj����fdd�}|�|�tj��tj�|�dS)zZ
        Replace sys.modules, for the duration of the test, with the given value.
        cstj��tj���dSr)r�modules�clear�updater	�ZoriginalSysModulesr	r�cleanUpSysModules&s
z@TwistedModulesMixin.replaceSysModules.<locals>.cleanUpSysModulesN)rr�copyr
rr)rZ
sysModulesrr	rr�replaceSysModules!s



z%TwistedModulesMixin.replaceSysModules�test_packagecCs2t|���}|�d�}|��|�d��d�|S)z�
        Generate a L{FilePath} with one package, named C{pkgname}, on it, and
        return the L{FilePath} of the path entry.
        rz__init__.py�)rZmktempZchild�makedirsZ
setContent)rZpkgname�entry�pkgr	r	r�pathEntryWithOnePackage.s

z+TwistedModulesMixin.pathEntryWithOnePackageN)r)�__name__�
__module__�__qualname__�__doc__rrrr	r	r	rrs
r)	r Z
__future__rrrZtwisted.python.filepathr�objectrr	r	r	r�<module>s