Your IP : 216.73.216.213
B
R�X� � @ s: d dl Z d dlZd dlmZ d dlmZ G dd� d�ZdS )� N)�getSiteManager)�
Componentsc @ s6 e Zd ZdZe� ZdZdd� Zdd� Ze dd� �Z
d S )
�TestComponentsz�
A helper for providing a sterile registry when testing
with :mod:`zope.component`.
Instantiation will install an empty registry that will be returned
by :func:`zope.component.getSiteManager`.
Fc sJ t d�� _t�� fdd��� _� j�� � � jjsFt �
� j � d� j_d S )NZTestingc s � j S )N)�registry� )�selfr �H/opt/alt/python37/lib/python3.7/site-packages/testfixtures/components.py�<lambda> � z)TestComponents.__init__.<locals>.<lambda>T)r r r �sethook�old� instances�add� __class__�atexit_setup�atexit�register)r r )r r �__init__ s
zTestComponents.__init__c C s t �| j� | j�| � dS )z�
Remove the sterile registry and replace it with the one that
was in place before this :class:`TestComponents` was
instantiated.
N)r r r r
�remove)r r r r � uninstall s zTestComponents.uninstallc C s | j rt�d� d S )Nz5TestComponents instances not uninstalled by shutdown!)r
�warnings�warn)�clsr r r r ( s zTestComponents.atexitN)�__name__�
__module__�__qualname__�__doc__�setr
r r r �classmethodr r r r r r s r )r r Zzope.componentr Zzope.component.registryr r r r r r �<module> s