X7ROOT File Manager
Current Path:
/opt/cloudlinux/venv/lib/python3.11/site-packages/testfixtures
opt
/
cloudlinux
/
venv
/
lib
/
python3.11
/
site-packages
/
testfixtures
/
ðŸ“
..
📄
__init__.py
(1.19 KB)
ðŸ“
__pycache__
📄
comparison.py
(39.14 KB)
📄
compat.py
(224 B)
📄
components.py
(1.31 KB)
📄
datetime.py
(24.42 KB)
📄
django.py
(2.88 KB)
📄
logcapture.py
(10.75 KB)
📄
mock.py
(1.21 KB)
📄
outputcapture.py
(4.69 KB)
📄
popen.py
(9.89 KB)
📄
replace.py
(12.15 KB)
📄
resolve.py
(2.05 KB)
📄
rmtree.py
(2.52 KB)
📄
shouldraise.py
(3.58 KB)
📄
shouldwarn.py
(2.21 KB)
📄
sybil.py
(2.28 KB)
📄
tempdirectory.py
(12.89 KB)
ðŸ“
tests
📄
twisted.py
(4.8 KB)
📄
utils.py
(2.74 KB)
📄
version.txt
(6 B)
Editing: components.py
""" Helpers for working with Zope and its components. """ import atexit import warnings from typing import Set from zope.component import getSiteManager from zope.interface.registry import Components class TestComponents: """ A helper for providing a sterile registry when testing with ``zope.component``. Instantiation will install an empty registry that will be returned by :func:`zope.component.getSiteManager`. """ __test__: bool = False instances: Set['TestComponents'] = set() atexit_setup: bool = False def __init__(self): self.registry: Components = Components('Testing') self.old: Components = getSiteManager.sethook(lambda: self.registry) self.instances.add(self) if not self.__class__.atexit_setup: atexit.register(self.atexit) self.__class__.atexit_setup = True def uninstall(self): """ Remove the sterile registry and replace it with the one that was in place before this :class:`TestComponents` was instantiated. """ getSiteManager.sethook(self.old) self.instances.remove(self) @classmethod def atexit(cls): if cls.instances: warnings.warn( 'TestComponents instances not uninstalled by shutdown!' )
Upload File
Create Folder