How to use the nose2.session.Session function in nose2

To help you get started, we’ve selected a few nose2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mgrijalva / nose2-html-report / tests / test_nose_plugin.py View on Github external
def create_plugin_instance():
    return HTMLReporter(session=Session())
github nose-devs / nose2 / nose2 / collector.py View on Github external
def _get_objects(self):
            ssn = session.Session()
            ldr = loader.PluggableTestLoader(ssn)
            rnr = runner.PluggableTestRunner(ssn)
            return ssn, ldr, rnr
github nose-devs / nose2 / nose2 / main.py View on Github external
The class to instantiate to create a test runner.  Default:
       :class:`nose2.runner.PluggableTestRunner`.

       .. warning ::

          Overriding this attribute is the only way to customize
          the test runner class. Passing a test runner to
          :func:`__init__` does not work.

    .. attribute :: defaultPlugins

       List of default plugin modules to load.

    """
    sessionClass = session.Session
    _currentSession = None
    loaderClass = loader.PluggableTestLoader
    runnerClass = runner.PluggableTestRunner
    defaultPlugins = plugins.DEFAULT_PLUGINS
    excludePlugins = ()

    # XXX override __init__ to warn that testLoader and testRunner are ignored?
    def __init__(self, **kw):
        plugins = kw.pop('plugins', [])
        exclude = kw.pop('excludePlugins', [])
        hooks = kw.pop('extraHooks', [])
        self.defaultPlugins = list(self.defaultPlugins)
        self.excludePlugins = list(self.excludePlugins)
        self.extraHooks = hooks
        self.defaultPlugins.extend(plugins)
        self.excludePlugins.extend(exclude)
github nose-devs / nose2 / nose2 / plugins / mp.py View on Github external
def import_session(rlog, session_export):
    ssn = session.Session()
    ssn.config = session_export['config']
    ssn.hooks = RecordingPluginInterface()
    ssn.verbosity = session_export['verbosity']
    ssn.startDir = session_export['startDir']
    ssn.topLevelDir = session_export['topLevelDir']
    ssn.prepareSysPath()
    loader_ = loader.PluggableTestLoader(ssn)
    ssn.testLoader = loader_
    result_ = result.PluggableTestResult(ssn)
    ssn.testResult = result_
    runner_ = runner.PluggableTestRunner(ssn)  # needed??
    ssn.testRunner = runner_
    # load and register plugins, forcing multiprocess to the end
    ssn.plugins = [
        plugin(session=ssn) for plugin in session_export['pluginClasses']
        if plugin is not MultiProcess