Current Path: > > opt > hc_python > > lib > python3.12 > > site-packages > nose > plugins
Operation : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 Software : Apache Server IP : 162.0.232.56 | Your IP: 216.73.216.111 Domains : 1034 Domain(s) Permission : [ 0755 ]
Name | Type | Size | Last Modified | Actions |
---|---|---|---|---|
__pycache__ | Directory | - | - | |
__init__.py | File | 6291 bytes | April 04 2025 08:02:21. | |
allmodules.py | File | 1720 bytes | April 04 2025 08:02:21. | |
attrib.py | File | 9709 bytes | April 04 2025 08:02:21. | |
base.py | File | 26058 bytes | April 04 2025 08:02:21. | |
builtin.py | File | 1021 bytes | April 04 2025 08:02:21. | |
capture.py | File | 3364 bytes | April 04 2025 08:02:21. | |
collect.py | File | 3156 bytes | April 04 2025 08:02:21. | |
cover.py | File | 11677 bytes | April 04 2025 08:02:21. | |
debug.py | File | 2272 bytes | April 04 2025 08:02:21. | |
deprecated.py | File | 1551 bytes | April 04 2025 08:02:21. | |
doctests.py | File | 17478 bytes | April 04 2025 08:02:21. | |
errorclass.py | File | 7275 bytes | April 04 2025 08:02:21. | |
failuredetail.py | File | 1635 bytes | April 04 2025 08:02:21. | |
isolate.py | File | 3756 bytes | April 04 2025 08:02:21. | |
logcapture.py | File | 9358 bytes | April 04 2025 08:02:21. | |
manager.py | File | 15577 bytes | April 04 2025 08:02:21. | |
multiprocess.py | File | 35286 bytes | April 04 2025 08:02:21. | |
plugintest.py | File | 13533 bytes | April 04 2025 08:02:21. | |
prof.py | File | 5357 bytes | April 04 2025 08:02:21. | |
skip.py | File | 2142 bytes | April 04 2025 08:02:21. | |
testid.py | File | 9917 bytes | April 04 2025 08:02:21. | |
xunit.py | File | 11645 bytes | April 04 2025 08:02:21. |
"""The isolation plugin resets the contents of sys.modules after running each test module or package. Use it by setting ``--with-isolation`` or the NOSE_WITH_ISOLATION environment variable. The effects are similar to wrapping the following functions around the import and execution of each test module:: def setup(module): module._mods = sys.modules.copy() def teardown(module): to_del = [ m for m in sys.modules.keys() if m not in module._mods ] for mod in to_del: del sys.modules[mod] sys.modules.update(module._mods) Isolation works only during lazy loading. In normal use, this is only during discovery of modules within a directory, where the process of importing, loading tests and running tests from each module is encapsulated in a single loadTestsFromName call. This plugin implements loadTestsFromNames to force the same lazy-loading there, which allows isolation to work in directed mode as well as discovery, at the cost of some efficiency: lazy-loading names forces full context setup and teardown to run for each name, defeating the grouping that is normally used to ensure that context setup and teardown are run the fewest possible times for a given set of names. .. warning :: This plugin should not be used in conjunction with other plugins that assume that modules, once imported, will stay imported; for instance, it may cause very odd results when used with the coverage plugin. """ import logging import sys from nose.plugins import Plugin log = logging.getLogger('nose.plugins.isolation') class IsolationPlugin(Plugin): """ Activate the isolation plugin to isolate changes to external modules to a single test module or package. The isolation plugin resets the contents of sys.modules after each test module or package runs to its state before the test. PLEASE NOTE that this plugin should not be used with the coverage plugin, or in any other case where module reloading may produce undesirable side-effects. """ score = 10 # I want to be last name = 'isolation' def configure(self, options, conf): """Configure plugin. """ Plugin.configure(self, options, conf) self._mod_stack = [] def beforeContext(self): """Copy sys.modules onto my mod stack """ mods = sys.modules.copy() self._mod_stack.append(mods) def afterContext(self): """Pop my mod stack and restore sys.modules to the state it was in when mod stack was pushed. """ mods = self._mod_stack.pop() to_del = [ m for m in list(sys.modules.keys()) if m not in mods ] if to_del: log.debug('removing sys modules entries: %s', to_del) for mod in to_del: del sys.modules[mod] sys.modules.update(mods) def loadTestsFromNames(self, names, module=None): """Create a lazy suite that calls beforeContext and afterContext around each name. The side-effect of this is that full context fixtures will be set up and torn down around each test named. """ # Fast path for when we don't care if not names or len(names) == 1: return loader = self.loader plugins = self.conf.plugins def lazy(): for name in names: plugins.beforeContext() yield loader.loadTestsFromName(name, module=module) plugins.afterContext() return (loader.suiteClass(lazy), []) def prepareTestLoader(self, loader): """Get handle on test loader so we can use it in loadTestsFromNames. """ self.loader = loader
SILENT KILLER Tool