PATH: //proc/thread-self/root/opt/cloudlinux/venv/lib/python3.11/site-packages/testfixtures
FILE_BARU
CREATE
FOLDER_BARU
MKDIR
UPLOAD_FILE
GO
[ .. KEMBALI ]
📄 __init__.py
↓
X
📁 __pycache__/
X
📄 comparison.py
↓
X
📄 compat.py
↓
X
📄 components.py
↓
X
📄 datetime.py
↓
X
📄 django.py
↓
X
📄 logcapture.py
↓
X
📄 mock.py
↓
X
📄 outputcapture.py
↓
X
📄 popen.py
↓
X
📄 replace.py
↓
X
📄 resolve.py
↓
X
📄 rmtree.py
↓
X
📄 shouldraise.py
↓
X
📄 shouldwarn.py
↓
X
📄 sybil.py
↓
X
📄 tempdirectory.py
↓
X
📁 tests/
X
📄 twisted.py
↓
X
📄 utils.py
↓
X
📄 version.txt
↓
X
SAVING...
BERHASIL DIUBAH!
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!' )
SIMPAN PERUBAHAN