$52 GRAYBYTE WORDPRESS FILE MANAGER $79

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/alt/python37/lib/python3.7/site-packages/nose/plugins/

HOME
Current File : /opt/alt/python37/lib/python3.7/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

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 callable(tests):
            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))


Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
31 Aug 2024 6.49 AM
root / 996
0755
__pycache__
--
31 Aug 2024 6.49 AM
root / 996
0755
__init__.py
6.144 KB
6 Apr 2013 5.25 AM
root / 996
0644
allmodules.py
1.68 KB
29 Sep 2012 3.18 PM
root / 996
0644
attrib.py
9.439 KB
14 Nov 2023 10.11 PM
root / 996
0644
base.py
25.447 KB
14 Nov 2023 10.11 PM
root / 996
0644
builtin.py
0.997 KB
3 Oct 2012 2.19 AM
root / 996
0644
capture.py
3.285 KB
14 Nov 2023 10.11 PM
root / 996
0644
collect.py
3.04 KB
29 Sep 2012 3.18 PM
root / 996
0644
cover.py
11.403 KB
14 Nov 2023 10.11 PM
root / 996
0644
debug.py
2.219 KB
19 Apr 2014 8.48 PM
root / 996
0644
deprecated.py
1.515 KB
19 Apr 2014 8.48 PM
root / 996
0644
doctests.py
17.068 KB
14 Nov 2023 10.11 PM
root / 996
0644
errorclass.py
7.104 KB
14 Nov 2023 10.11 PM
root / 996
0644
failuredetail.py
1.597 KB
4 Apr 2015 3.52 PM
root / 996
0644
isolate.py
3.668 KB
14 Nov 2023 10.11 PM
root / 996
0644
logcapture.py
9.139 KB
14 Nov 2023 10.11 PM
root / 996
0644
manager.py
15.212 KB
14 Nov 2023 10.11 PM
root / 996
0644
multiprocess.py
34.459 KB
14 Nov 2023 10.11 PM
root / 996
0644
plugintest.py
13.216 KB
14 Nov 2023 10.11 PM
root / 996
0644
prof.py
5.231 KB
29 Sep 2012 3.18 PM
root / 996
0644
skip.py
2.092 KB
4 Apr 2015 3.52 PM
root / 996
0644
testid.py
9.685 KB
14 Nov 2023 10.11 PM
root / 996
0644
xunit.py
11.372 KB
14 Nov 2023 10.11 PM
root / 996
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF