SILENT KILLERPanel

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 ]

Files and Folders in: //opt/hc_python/lib/python3.12/site-packages/nose//plugins/

NameTypeSizeLast ModifiedActions
__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.

Reading File: //opt/hc_python/lib/python3.12/site-packages/nose//plugins//collect.py

"""
This plugin bypasses the actual execution of tests, and instead just collects
test names. Fixtures are also bypassed, so running nosetests with the 
collection plugin enabled should be very quick.

This plugin is useful in combination with the testid plugin (``--with-id``).
Run both together to get an indexed list of all tests, which will enable you to
run individual tests by index number.

This plugin is also useful for counting tests in a test suite, and making
people watching your demo think all of your tests pass.
"""
from nose.plugins.base import Plugin
from nose.case import Test
import logging
import unittest
import collections

log = logging.getLogger(__name__)


class CollectOnly(Plugin):
    """
    Collect and output test names only, don't run any tests.
    """
    name = "collect-only"
    enableOpt = 'collect_only'

    def options(self, parser, env):
        """Register commandline options.
        """
        parser.add_option('--collect-only',
                          action='store_true',
                          dest=self.enableOpt,
                          default=env.get('NOSE_COLLECT_ONLY'),
                          help="Enable collect-only: %s [COLLECT_ONLY]" %
                          (self.help()))

    def prepareTestLoader(self, loader):
        """Install collect-only suite class in TestLoader.
        """
        # Disable context awareness
        log.debug("Preparing test loader")
        loader.suiteClass = TestSuiteFactory(self.conf)

    def prepareTestCase(self, test):
        """Replace actual test with dummy that always passes.
        """
        # Return something that always passes
        log.debug("Preparing test case %s", test)
        if not isinstance(test, Test):
            return
        def run(result):
            # We need to make these plugin calls because there won't be
            # a result proxy, due to using a stripped-down test suite
            self.conf.plugins.startTest(test)
            result.startTest(test)
            self.conf.plugins.addSuccess(test)
            result.addSuccess(test)
            self.conf.plugins.stopTest(test)
            result.stopTest(test)
        return run


class TestSuiteFactory:
    """
    Factory for producing configured test suites.
    """
    def __init__(self, conf):
        self.conf = conf

    def __call__(self, tests=(), **kw):
        return TestSuite(tests, conf=self.conf)


class TestSuite(unittest.TestSuite):
    """
    Basic test suite that bypasses most proxy and plugin calls, but does
    wrap tests in a nose.case.Test so prepareTestCase will be called.
    """
    def __init__(self, tests=(), conf=None):
        self.conf = conf
        # Exec lazy suites: makes discovery depth-first
        if isinstance(tests, collections.Callable):
            tests = tests()
        log.debug("TestSuite(%r)", tests)
        unittest.TestSuite.__init__(self, tests)

    def addTest(self, test):
        log.debug("Add test %s", test)
        if isinstance(test, unittest.TestSuite):
            self._tests.append(test)
        else:
            self._tests.append(Test(test, config=self.conf))


SILENT KILLER Tool