{
    "file_diffs": [
        {
            "old_file_content": "unreleased\n==========\n\nFeatures\n--------\n\n- Added an execution policy hook to the request pipeline. An execution\n  policy has the ability to control creation and execution of the request\n  objects before they enter rest of the pipeline. This means for a given\n  request that the policy may create more than one request for retry\n  purposes. See https://github.com/Pylons/pyramid/pull/2964\n\n- Support an ``open_url`` config setting in the ``pserve`` section of the\n  config file. This url is used to open a web browser when ``pserve --browser``\n  is invoked. When this setting is unavailable the ``pserve`` script will\n  attempt to guess the port the server is using from the\n  ``server:<server_name>`` section of the config file but there is no\n  requirement that the server is being run in this format so it may fail.\n  See https://github.com/Pylons/pyramid/pull/2984\n\nBug Fixes\n---------\n\n- HTTPException's accepts a detail kwarg that may be used to pass additional\n  details to the exception. You may now pass objects so long as they have a\n  valid __str__ method. See https://github.com/Pylons/pyramid/pull/2951\n\n- Fix a reference cycle causing memory leaks in which the registry\n  would keep a ``Configurator`` instance alive even after the configurator\n  was discarded. Another fix was also added for the ``global_registries``\n  object in which the registry was stored in a closure preventing it from\n  being deallocated. See https://github.com/Pylons/pyramid/pull/2967\n\n- Fix a bug directly invoking ``pyramid.scripts.pserve.main`` with the\n  ``--reload`` option in which ``sys.argv`` is always used in the subprocess\n  instead of the supplied ``argv``.\n  See https://github.com/Pylons/pyramid/pull/2962\n\nDeprecations\n------------\n\nBackward Incompatibilities\n--------------------------\n\nDocumentation Changes\n---------------------\n",
            "new_file_content": "unreleased\n==========\n\nFeatures\n--------\n\n- Added an execution policy hook to the request pipeline. An execution\n  policy has the ability to control creation and execution of the request\n  objects before they enter rest of the pipeline. This means for a given\n  request that the policy may create more than one request for retry\n  purposes. See https://github.com/Pylons/pyramid/pull/2964\n\n- Support an ``open_url`` config setting in the ``pserve`` section of the\n  config file. This url is used to open a web browser when ``pserve --browser``\n  is invoked. When this setting is unavailable the ``pserve`` script will\n  attempt to guess the port the server is using from the\n  ``server:<server_name>`` section of the config file but there is no\n  requirement that the server is being run in this format so it may fail.\n  See https://github.com/Pylons/pyramid/pull/2984\n\n- The threadlocals are now available inside any function invoked via\n  ``config.include``. This means the only config-time code that cannot rely\n  on threadlocals is code executed from non-actions inside the main. This\n  can be alleviated by invoking ``config.begin()`` and ``config.end()``\n  appropriately. See https://github.com/Pylons/pyramid/pull/2989\n\nBug Fixes\n---------\n\n- HTTPException's accepts a detail kwarg that may be used to pass additional\n  details to the exception. You may now pass objects so long as they have a\n  valid __str__ method. See https://github.com/Pylons/pyramid/pull/2951\n\n- Fix a reference cycle causing memory leaks in which the registry\n  would keep a ``Configurator`` instance alive even after the configurator\n  was discarded. Another fix was also added for the ``global_registries``\n  object in which the registry was stored in a closure preventing it from\n  being deallocated. See https://github.com/Pylons/pyramid/pull/2967\n\n- Fix a bug directly invoking ``pyramid.scripts.pserve.main`` with the\n  ``--reload`` option in which ``sys.argv`` is always used in the subprocess\n  instead of the supplied ``argv``.\n  See https://github.com/Pylons/pyramid/pull/2962\n\nDeprecations\n------------\n\nBackward Incompatibilities\n--------------------------\n\nDocumentation Changes\n---------------------\n",
            "header": {
                "file": {
                    "path": "CHANGES.txt"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "7676a69f9",
                "new_commit_hash": "c8a87f625",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/CHANGES.txt"
            },
            "plus_file": {
                "path": "b/CHANGES.txt"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 18,
                            "length": 6
                        },
                        "new_range": {
                            "start": 18,
                            "length": 12
                        },
                        "section": "Features"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "  requirement that the server is being run in this format so it may fail.",
                                "type": "context"
                            },
                            {
                                "content": "  See https://github.com/Pylons/pyramid/pull/2984",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "- The threadlocals are now available inside any function invoked via",
                                "type": "added"
                            },
                            {
                                "content": "  ``config.include``. This means the only config-time code that cannot rely",
                                "type": "added"
                            },
                            {
                                "content": "  on threadlocals is code executed from non-actions inside the main. This",
                                "type": "added"
                            },
                            {
                                "content": "  can be alleviated by invoking ``config.begin()`` and ``config.end()``",
                                "type": "added"
                            },
                            {
                                "content": "  appropriately. See https://github.com/Pylons/pyramid/pull/2989",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "Bug Fixes",
                                "type": "context"
                            },
                            {
                                "content": "---------",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "import inspect\nimport itertools\nimport logging\nimport operator\nimport os\nimport sys\nimport threading\nimport venusian\n\nfrom webob.exc import WSGIHTTPException as WebobWSGIHTTPException\n\nfrom pyramid.interfaces import (\n    IDebugLogger,\n    IExceptionResponse,\n    IPredicateList,\n    PHASE0_CONFIG,\n    PHASE1_CONFIG,\n    PHASE2_CONFIG,\n    PHASE3_CONFIG,\n    )\n\nfrom pyramid.asset import resolve_asset_spec\n\nfrom pyramid.authorization import ACLAuthorizationPolicy\n\nfrom pyramid.compat import (\n    text_,\n    reraise,\n    string_types,\n    )\n\nfrom pyramid.events import ApplicationCreated\n\nfrom pyramid.exceptions import (\n    ConfigurationConflictError,\n    ConfigurationError,\n    ConfigurationExecutionError,\n    )\n\nfrom pyramid.httpexceptions import default_exceptionresponse_view\n\nfrom pyramid.path import (\n    caller_package,\n    package_of,\n    )\n\nfrom pyramid.registry import (\n    Introspectable,\n    Introspector,\n    Registry,\n    undefer,\n    )\n\nfrom pyramid.router import Router\n\nfrom pyramid.settings import aslist\n\nfrom pyramid.threadlocal import manager\n\nfrom pyramid.util import (\n    ActionInfo,\n    WeakOrderedSet,\n    action_method,\n    object_description,\n    )\n\nfrom pyramid.config.adapters import AdaptersConfiguratorMixin\nfrom pyramid.config.assets import AssetsConfiguratorMixin\nfrom pyramid.config.factories import FactoriesConfiguratorMixin\nfrom pyramid.config.i18n import I18NConfiguratorMixin\nfrom pyramid.config.rendering import RenderingConfiguratorMixin\nfrom pyramid.config.routes import RoutesConfiguratorMixin\nfrom pyramid.config.security import SecurityConfiguratorMixin\nfrom pyramid.config.settings import SettingsConfiguratorMixin\nfrom pyramid.config.testing import TestingConfiguratorMixin\nfrom pyramid.config.tweens import TweensConfiguratorMixin\nfrom pyramid.config.util import PredicateList, not_\nfrom pyramid.config.views import ViewsConfiguratorMixin\nfrom pyramid.config.zca import ZCAConfiguratorMixin\n\nfrom pyramid.path import DottedNameResolver\n\nempty = text_('')\n_marker = object()\n\nConfigurationError = ConfigurationError # pyflakes\n\nnot_ = not_ # pyflakes, this is an API\n\nPHASE0_CONFIG = PHASE0_CONFIG  # api\nPHASE1_CONFIG = PHASE1_CONFIG  # api\nPHASE2_CONFIG = PHASE2_CONFIG  # api\nPHASE3_CONFIG = PHASE3_CONFIG  # api\n\nclass Configurator(\n    TestingConfiguratorMixin,\n    TweensConfiguratorMixin,\n    SecurityConfiguratorMixin,\n    ViewsConfiguratorMixin,\n    RoutesConfiguratorMixin,\n    ZCAConfiguratorMixin,\n    I18NConfiguratorMixin,\n    RenderingConfiguratorMixin,\n    AssetsConfiguratorMixin,\n    SettingsConfiguratorMixin,\n    FactoriesConfiguratorMixin,\n    AdaptersConfiguratorMixin,\n    ):\n    \"\"\"\n    A Configurator is used to configure a :app:`Pyramid`\n    :term:`application registry`.\n\n    If the ``registry`` argument is not ``None``, it must\n    be an instance of the :class:`pyramid.registry.Registry` class\n    representing the registry to configure.  If ``registry`` is ``None``, the\n    configurator will create a :class:`pyramid.registry.Registry` instance\n    itself; it will also perform some default configuration that would not\n    otherwise be done.  After its construction, the configurator may be used\n    to add further configuration to the registry.\n\n    .. warning:: If ``registry`` is assigned the above-mentioned class\n       instance, all other constructor arguments are ignored,\n       with the exception of ``package``.\n\n    If the ``package`` argument is passed, it must be a reference to a Python\n    :term:`package` (e.g. ``sys.modules['thepackage']``) or a :term:`dotted\n    Python name` to the same.  This value is used as a basis to convert\n    relative paths passed to various configuration methods, such as methods\n    which accept a ``renderer`` argument, into absolute paths.  If ``None``\n    is passed (the default), the package is assumed to be the Python package\n    in which the *caller* of the ``Configurator`` constructor lives.\n\n    If the ``root_package`` is passed, it will propagate through the\n    configuration hierarchy as a way for included packages to locate\n    resources relative to the package in which the main ``Configurator`` was\n    created. If ``None`` is passed (the default), the ``root_package`` will\n    be derived from the ``package`` argument. The ``package`` attribute is\n    always pointing at the package being included when using :meth:`.include`,\n    whereas the ``root_package`` does not change.\n\n    If the ``settings`` argument is passed, it should be a Python dictionary\n    representing the :term:`deployment settings` for this application.  These\n    are later retrievable using the\n    :attr:`pyramid.registry.Registry.settings` attribute (aka\n    ``request.registry.settings``).\n\n    If the ``root_factory`` argument is passed, it should be an object\n    representing the default :term:`root factory` for your application or a\n    :term:`dotted Python name` to the same.  If it is ``None``, a default\n    root factory will be used.\n\n    If ``authentication_policy`` is passed, it should be an instance\n    of an :term:`authentication policy` or a :term:`dotted Python\n    name` to the same.\n\n    If ``authorization_policy`` is passed, it should be an instance of\n    an :term:`authorization policy` or a :term:`dotted Python name` to\n    the same.\n\n    .. note:: A ``ConfigurationError`` will be raised when an\n       authorization policy is supplied without also supplying an\n       authentication policy (authorization requires authentication).\n\n    If ``renderers`` is ``None`` (the default), a default set of\n    :term:`renderer` factories is used. Else, it should be a list of\n    tuples representing a set of renderer factories which should be\n    configured into this application, and each tuple representing a set of\n    positional values that should be passed to\n    :meth:`pyramid.config.Configurator.add_renderer`.\n\n    If ``debug_logger`` is not passed, a default debug logger that logs to a\n    logger will be used (the logger name will be the package name of the\n    *caller* of this configurator).  If it is passed, it should be an\n    instance of the :class:`logging.Logger` (PEP 282) standard library class\n    or a Python logger name.  The debug logger is used by :app:`Pyramid`\n    itself to log warnings and authorization debugging information.\n\n    If ``locale_negotiator`` is passed, it should be a :term:`locale\n    negotiator` implementation or a :term:`dotted Python name` to\n    same.  See :ref:`custom_locale_negotiator`.\n\n    If ``request_factory`` is passed, it should be a :term:`request\n    factory` implementation or a :term:`dotted Python name` to the same.\n    See :ref:`changing_the_request_factory`.  By default it is ``None``,\n    which means use the default request factory.\n\n    If ``response_factory`` is passed, it should be a :term:`response\n    factory` implementation or a :term:`dotted Python name` to the same.\n    See :ref:`changing_the_response_factory`.  By default it is ``None``,\n    which means use the default response factory.\n\n    If ``default_permission`` is passed, it should be a\n    :term:`permission` string to be used as the default permission for\n    all view configuration registrations performed against this\n    Configurator.  An example of a permission string:``'view'``.\n    Adding a default permission makes it unnecessary to protect each\n    view configuration with an explicit permission, unless your\n    application policy requires some exception for a particular view.\n    By default, ``default_permission`` is ``None``, meaning that view\n    configurations which do not explicitly declare a permission will\n    always be executable by entirely anonymous users (any\n    authorization policy in effect is ignored).\n\n    .. seealso::\n\n        See also :ref:`setting_a_default_permission`.\n\n    If ``session_factory`` is passed, it should be an object which\n    implements the :term:`session factory` interface.  If a nondefault\n    value is passed, the ``session_factory`` will be used to create a\n    session object when ``request.session`` is accessed.  Note that\n    the same outcome can be achieved by calling\n    :meth:`pyramid.config.Configurator.set_session_factory`.  By\n    default, this argument is ``None``, indicating that no session\n    factory will be configured (and thus accessing ``request.session``\n    will throw an error) unless ``set_session_factory`` is called later\n    during configuration.\n\n    If ``autocommit`` is ``True``, every method called on the configurator\n    will cause an immediate action, and no configuration conflict detection\n    will be used. If ``autocommit`` is ``False``, most methods of the\n    configurator will defer their action until\n    :meth:`pyramid.config.Configurator.commit` is called.  When\n    :meth:`pyramid.config.Configurator.commit` is called, the actions implied\n    by the called methods will be checked for configuration conflicts unless\n    ``autocommit`` is ``True``.  If a conflict is detected, a\n    ``ConfigurationConflictError`` will be raised.  Calling\n    :meth:`pyramid.config.Configurator.make_wsgi_app` always implies a final\n    commit.\n\n    If ``default_view_mapper`` is passed, it will be used as the default\n    :term:`view mapper` factory for view configurations that don't otherwise\n    specify one (see :class:`pyramid.interfaces.IViewMapperFactory`).  If\n    ``default_view_mapper`` is not passed, a superdefault view mapper will be\n    used.\n\n    If ``exceptionresponse_view`` is passed, it must be a :term:`view\n    callable` or ``None``.  If it is a view callable, it will be used as an\n    exception view callable when an :term:`exception response` is raised. If\n    ``exceptionresponse_view`` is ``None``, no exception response view will\n    be registered, and all raised exception responses will be bubbled up to\n    Pyramid's caller.  By\n    default, the ``pyramid.httpexceptions.default_exceptionresponse_view``\n    function is used as the ``exceptionresponse_view``.\n\n    If ``route_prefix`` is passed, all routes added with\n    :meth:`pyramid.config.Configurator.add_route` will have the specified path\n    prepended to their pattern.\n\n    If ``introspection`` is passed, it must be a boolean value.  If it's\n    ``True``, introspection values during actions will be kept for use\n    for tools like the debug toolbar.  If it's ``False``, introspection\n    values provided by registrations will be ignored.  By default, it is\n    ``True``.\n\n    .. versionadded:: 1.1\n       The ``exceptionresponse_view`` argument.\n\n    .. versionadded:: 1.2\n       The ``route_prefix`` argument.\n\n    .. versionadded:: 1.3\n       The ``introspection`` argument.\n\n    .. versionadded:: 1.6\n       The ``root_package`` argument.\n       The ``response_factory`` argument.\n    \"\"\"\n    manager = manager # for testing injection\n    venusian = venusian # for testing injection\n    _ainfo = None\n    basepath = None\n    includepath = ()\n    info = ''\n    object_description = staticmethod(object_description)\n    introspectable = Introspectable\n    inspect = inspect\n\n    def __init__(self,\n                 registry=None,\n                 package=None,\n                 settings=None,\n                 root_factory=None,\n                 authentication_policy=None,\n                 authorization_policy=None,\n                 renderers=None,\n                 debug_logger=None,\n                 locale_negotiator=None,\n                 request_factory=None,\n                 response_factory=None,\n                 default_permission=None,\n                 session_factory=None,\n                 default_view_mapper=None,\n                 autocommit=False,\n                 exceptionresponse_view=default_exceptionresponse_view,\n                 route_prefix=None,\n                 introspection=True,\n                 root_package=None,\n                 ):\n        if package is None:\n            package = caller_package()\n        if root_package is None:\n            root_package = package\n        name_resolver = DottedNameResolver(package)\n        self.name_resolver = name_resolver\n        self.package_name = name_resolver.get_package_name()\n        self.package = name_resolver.get_package()\n        self.root_package = root_package\n        self.registry = registry\n        self.autocommit = autocommit\n        self.route_prefix = route_prefix\n        self.introspection = introspection\n        if registry is None:\n            registry = Registry(self.package_name)\n            self.registry = registry\n            self.setup_registry(\n                settings=settings,\n                root_factory=root_factory,\n                authentication_policy=authentication_policy,\n                authorization_policy=authorization_policy,\n                renderers=renderers,\n                debug_logger=debug_logger,\n                locale_negotiator=locale_negotiator,\n                request_factory=request_factory,\n                response_factory=response_factory,\n                default_permission=default_permission,\n                session_factory=session_factory,\n                default_view_mapper=default_view_mapper,\n                exceptionresponse_view=exceptionresponse_view,\n                )\n\n    def setup_registry(self,\n                       settings=None,\n                       root_factory=None,\n                       authentication_policy=None,\n                       authorization_policy=None,\n                       renderers=None,\n                       debug_logger=None,\n                       locale_negotiator=None,\n                       request_factory=None,\n                       response_factory=None,\n                       default_permission=None,\n                       session_factory=None,\n                       default_view_mapper=None,\n                       exceptionresponse_view=default_exceptionresponse_view,\n                       ):\n        \"\"\" When you pass a non-``None`` ``registry`` argument to the\n        :term:`Configurator` constructor, no initial setup is performed\n        against the registry.  This is because the registry you pass in may\n        have already been initialized for use under :app:`Pyramid` via a\n        different configurator.  However, in some circumstances (such as when\n        you want to use a global registry instead of a registry created as a\n        result of the Configurator constructor), or when you want to reset\n        the initial setup of a registry, you *do* want to explicitly\n        initialize the registry associated with a Configurator for use under\n        :app:`Pyramid`.  Use ``setup_registry`` to do this initialization.\n\n        ``setup_registry`` configures settings, a root factory, security\n        policies, renderers, a debug logger, a locale negotiator, and various\n        other settings using the configurator's current registry, as per the\n        descriptions in the Configurator constructor.\"\"\"\n\n        registry = self.registry\n\n        self._fix_registry()\n\n        self._set_settings(settings)\n\n        if isinstance(debug_logger, string_types):\n            debug_logger = logging.getLogger(debug_logger)\n\n        if debug_logger is None:\n            debug_logger = logging.getLogger(self.package_name)\n\n        registry.registerUtility(debug_logger, IDebugLogger)\n\n        self.add_default_response_adapters()\n        self.add_default_renderers()\n        self.add_default_view_predicates()\n        self.add_default_view_derivers()\n        self.add_default_route_predicates()\n        self.add_default_tweens()\n\n        if exceptionresponse_view is not None:\n            exceptionresponse_view = self.maybe_dotted(exceptionresponse_view)\n            self.add_view(exceptionresponse_view, context=IExceptionResponse)\n            self.add_view(exceptionresponse_view,context=WebobWSGIHTTPException)\n\n        # commit below because:\n        #\n        # - the default exceptionresponse_view requires the superdefault view\n        #   mapper, so we need to configure it before adding default_view_mapper\n        #\n        # - superdefault renderers should be overrideable without requiring\n        #   the user to commit before calling config.add_renderer\n\n        self.commit()\n\n        # self.commit() should not be called within this method after this\n        # point because the following registrations should be treated as\n        # analogues of methods called by the user after configurator\n        # construction.  Rationale: user-supplied implementations should be\n        # preferred rather than add-on author implementations with the help of\n        # automatic conflict resolution.\n\n        if authentication_policy and not authorization_policy:\n            authorization_policy = ACLAuthorizationPolicy() # default\n\n        if authorization_policy:\n            self.set_authorization_policy(authorization_policy)\n\n        if authentication_policy:\n            self.set_authentication_policy(authentication_policy)\n\n        if default_view_mapper is not None:\n            self.set_view_mapper(default_view_mapper)\n\n        if renderers:\n            for name, renderer in renderers:\n                self.add_renderer(name, renderer)\n\n        if root_factory is not None:\n            self.set_root_factory(root_factory)\n\n        if locale_negotiator:\n            self.set_locale_negotiator(locale_negotiator)\n\n        if request_factory:\n            self.set_request_factory(request_factory)\n\n        if response_factory:\n            self.set_response_factory(response_factory)\n\n        if default_permission:\n            self.set_default_permission(default_permission)\n\n        if session_factory is not None:\n            self.set_session_factory(session_factory)\n\n        tweens = aslist(registry.settings.get('pyramid.tweens', []))\n        for factory in tweens:\n            self._add_tween(factory, explicit=True)\n\n        includes = aslist(registry.settings.get('pyramid.includes', []))\n        for inc in includes:\n            self.include(inc)\n\n    def _make_spec(self, path_or_spec):\n        package, filename = resolve_asset_spec(path_or_spec, self.package_name)\n        if package is None:\n            return filename # absolute filename\n        return '%s:%s' % (package, filename)\n\n    def _fix_registry(self):\n        \"\"\" Fix up a ZCA component registry that is not a\n        pyramid.registry.Registry by adding analogues of ``has_listeners``,\n        ``notify``, ``queryAdapterOrSelf``, and ``registerSelfAdapter``\n        through monkey-patching.\"\"\"\n\n        _registry = self.registry\n\n        if not hasattr(_registry, 'notify'):\n            def notify(*events):\n                [ _ for _ in _registry.subscribers(events, None) ]\n            _registry.notify = notify\n\n        if not hasattr(_registry, 'has_listeners'):\n            _registry.has_listeners = True\n\n        if not hasattr(_registry, 'queryAdapterOrSelf'):\n            def queryAdapterOrSelf(object, interface, default=None):\n                if not interface.providedBy(object):\n                    return _registry.queryAdapter(object, interface,\n                                                  default=default)\n                return object\n            _registry.queryAdapterOrSelf = queryAdapterOrSelf\n\n        if not hasattr(_registry, 'registerSelfAdapter'):\n            def registerSelfAdapter(required=None, provided=None,\n                                    name=empty, info=empty, event=True):\n                return _registry.registerAdapter(lambda x: x,\n                                                 required=required,\n                                                 provided=provided, name=name,\n                                                 info=info, event=event)\n            _registry.registerSelfAdapter = registerSelfAdapter\n\n        if not hasattr(_registry, '_lock'):\n            _registry._lock = threading.Lock()\n\n        if not hasattr(_registry, '_clear_view_lookup_cache'):\n            def _clear_view_lookup_cache():\n                _registry._view_lookup_cache = {}\n            _registry._clear_view_lookup_cache = _clear_view_lookup_cache\n\n\n    # API\n\n    def _get_introspector(self):\n        introspector = getattr(self.registry, 'introspector', _marker)\n        if introspector is _marker:\n            introspector = Introspector()\n            self._set_introspector(introspector)\n        return introspector\n\n    def _set_introspector(self, introspector):\n        self.registry.introspector = introspector\n\n    def _del_introspector(self):\n        del self.registry.introspector\n\n    introspector = property(\n        _get_introspector, _set_introspector, _del_introspector\n        )\n\n    def get_predlist(self, name):\n        predlist = self.registry.queryUtility(IPredicateList, name=name)\n        if predlist is None:\n            predlist = PredicateList()\n            self.registry.registerUtility(predlist, IPredicateList, name=name)\n        return predlist\n\n\n    def _add_predicate(self, type, name, factory, weighs_more_than=None,\n                       weighs_less_than=None):\n        factory = self.maybe_dotted(factory)\n        discriminator = ('%s option' % type, name)\n        intr = self.introspectable(\n            '%s predicates' % type,\n            discriminator,\n            '%s predicate named %s' % (type, name),\n            '%s predicate' % type)\n        intr['name'] = name\n        intr['factory'] = factory\n        intr['weighs_more_than'] = weighs_more_than\n        intr['weighs_less_than'] = weighs_less_than\n        def register():\n            predlist = self.get_predlist(type)\n            predlist.add(name, factory, weighs_more_than=weighs_more_than,\n                         weighs_less_than=weighs_less_than)\n        self.action(discriminator, register, introspectables=(intr,),\n                    order=PHASE1_CONFIG) # must be registered early\n\n    @property\n    def action_info(self):\n        info = self.info # usually a ZCML action (ParserInfo) if self.info\n        if not info:\n            # Try to provide more accurate info for conflict reports\n            if self._ainfo:\n                info = self._ainfo[0]\n            else:\n                info = ActionInfo(None, 0, '', '')\n        return info\n\n    def action(self, discriminator, callable=None, args=(), kw=None, order=0,\n               introspectables=(), **extra):\n        \"\"\" Register an action which will be executed when\n        :meth:`pyramid.config.Configurator.commit` is called (or executed\n        immediately if ``autocommit`` is ``True``).\n\n        .. warning:: This method is typically only used by :app:`Pyramid`\n           framework extension authors, not by :app:`Pyramid` application\n           developers.\n\n        The ``discriminator`` uniquely identifies the action.  It must be\n        given, but it can be ``None``, to indicate that the action never\n        conflicts.  It must be a hashable value.\n\n        The ``callable`` is a callable object which performs the task\n        associated with the action when the action is executed.  It is\n        optional.\n\n        ``args`` and ``kw`` are tuple and dict objects respectively, which\n        are passed to ``callable`` when this action is executed.  Both are\n        optional.\n\n        ``order`` is a grouping mechanism; an action with a lower order will\n        be executed before an action with a higher order (has no effect when\n        autocommit is ``True``).\n\n        ``introspectables`` is a sequence of :term:`introspectable` objects\n        (or the empty sequence if no introspectable objects are associated\n        with this action).  If this configurator's ``introspection``\n        attribute is ``False``, these introspectables will be ignored.\n\n        ``extra`` provides a facility for inserting extra keys and values\n        into an action dictionary.\n        \"\"\"\n        # catch nonhashable discriminators here; most unit tests use\n        # autocommit=False, which won't catch unhashable discriminators\n        assert hash(discriminator) \n\n        if kw is None:\n            kw = {}\n\n        autocommit = self.autocommit\n        action_info = self.action_info\n\n        if not self.introspection:\n            # if we're not introspecting, ignore any introspectables passed\n            # to us\n            introspectables = ()\n\n        if autocommit:\n            # callables can depend on the side effects of resolving a\n            # deferred discriminator\n            self.begin()\n            try:\n                undefer(discriminator)\n                if callable is not None:\n                    callable(*args, **kw)\n                for introspectable in introspectables:\n                    introspectable.register(self.introspector, action_info)\n            finally:\n                self.end()\n\n        else:\n            action = extra\n            action.update(\n                dict(\n                    discriminator=discriminator,\n                    callable=callable,\n                    args=args,\n                    kw=kw,\n                    order=order,\n                    info=action_info,\n                    includepath=self.includepath,\n                    introspectables=introspectables,\n                    )\n                )\n            self.action_state.action(**action)\n\n    def _get_action_state(self):\n        registry = self.registry\n        try:\n            state = registry.action_state\n        except AttributeError:\n            state = ActionState()\n            registry.action_state = state\n        return state\n\n    def _set_action_state(self, state):\n        self.registry.action_state = state\n\n    action_state = property(_get_action_state, _set_action_state)\n\n    _ctx = action_state # bw compat\n\n    def commit(self):\n        \"\"\" Commit any pending configuration actions. If a configuration\n        conflict is detected in the pending configuration actions, this method\n        will raise a :exc:`ConfigurationConflictError`; within the traceback\n        of this error will be information about the source of the conflict,\n        usually including file names and line numbers of the cause of the\n        configuration conflicts.\"\"\"\n        self.begin()\n        try:\n            self.action_state.execute_actions(introspector=self.introspector)\n        finally:\n            self.end()\n        self.action_state = ActionState() # old actions have been processed\n\n    def include(self, callable, route_prefix=None):\n        \"\"\"Include a configuration callable, to support imperative\n        application extensibility.\n\n        .. warning:: In versions of :app:`Pyramid` prior to 1.2, this\n            function accepted ``*callables``, but this has been changed\n            to support only a single callable.\n\n        A configuration callable should be a callable that accepts a single\n        argument named ``config``, which will be an instance of a\n        :term:`Configurator`.  However, be warned that it will not be the same\n        configurator instance on which you call this method.  The\n        code which runs as a result of calling the callable should invoke\n        methods on the configurator passed to it which add configuration\n        state.  The return value of a callable will be ignored.\n\n        Values allowed to be presented via the ``callable`` argument to\n        this method: any callable Python object or any :term:`dotted Python\n        name` which resolves to a callable Python object.  It may also be a\n        Python :term:`module`, in which case, the module will be searched for\n        a callable named ``includeme``, which will be treated as the\n        configuration callable.\n\n        For example, if the ``includeme`` function below lives in a module\n        named ``myapp.myconfig``:\n\n        .. code-block:: python\n           :linenos:\n\n           # myapp.myconfig module\n\n           def my_view(request):\n               from pyramid.response import Response\n               return Response('OK')\n\n           def includeme(config):\n               config.add_view(my_view)\n\n        You might cause it to be included within your Pyramid application like\n        so:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include('myapp.myconfig.includeme')\n\n        Because the function is named ``includeme``, the function name can\n        also be omitted from the dotted name reference:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include('myapp.myconfig')\n\n        Included configuration statements will be overridden by local\n        configuration statements if an included callable causes a\n        configuration conflict by registering something with the same\n        configuration parameters.\n\n        If the ``route_prefix`` is supplied, it must be a string.  Any calls\n        to :meth:`pyramid.config.Configurator.add_route` within the included\n        callable will have their pattern prefixed with the value of\n        ``route_prefix``. This can be used to help mount a set of routes at a\n        different location than the included callable's author intended, while\n        still maintaining the same route names.  For example:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def included(config):\n               config.add_route('show_users', '/show')\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include(included, route_prefix='/users')\n\n        In the above configuration, the ``show_users`` route will have an\n        effective route pattern of ``/users/show``, instead of ``/show``\n        because the ``route_prefix`` argument will be prepended to the\n        pattern.\n\n        .. versionadded:: 1.2\n           The ``route_prefix`` parameter.\n\n        \"\"\"\n        # \"\"\" <-- emacs\n\n        action_state = self.action_state\n\n        if route_prefix is None:\n            route_prefix = ''\n\n        old_route_prefix = self.route_prefix\n        if old_route_prefix is None:\n            old_route_prefix = ''\n\n        route_prefix = '%s/%s' % (\n            old_route_prefix.rstrip('/'),\n            route_prefix.lstrip('/')\n            )\n        route_prefix = route_prefix.strip('/')\n        if not route_prefix:\n            route_prefix = None\n\n        c = self.maybe_dotted(callable)\n        module = self.inspect.getmodule(c)\n        if module is c:\n            try:\n                c = getattr(module, 'includeme')\n            except AttributeError:\n                raise ConfigurationError(\n                    \"module %r has no attribute 'includeme'\" % (module.__name__)\n                    )\n                                                       \n        spec = module.__name__ + ':' + c.__name__\n        sourcefile = self.inspect.getsourcefile(c)\n\n        if sourcefile is None:\n            raise ConfigurationError(\n                'No source file for module %r (.py file must exist, '\n                'refusing to use orphan .pyc or .pyo file).' % module.__name__)\n            \n\n        if action_state.processSpec(spec):\n            configurator = self.__class__(\n                registry=self.registry,\n                package=package_of(module),\n                root_package=self.root_package,\n                autocommit=self.autocommit,\n                route_prefix=route_prefix,\n                )\n            configurator.basepath = os.path.dirname(sourcefile)\n            configurator.includepath = self.includepath + (spec,)\n            c(configurator)\n\n    def add_directive(self, name, directive, action_wrap=True):\n        \"\"\"\n        Add a directive method to the configurator.\n\n        .. warning:: This method is typically only used by :app:`Pyramid`\n           framework extension authors, not by :app:`Pyramid` application\n           developers.\n\n        Framework extenders can add directive methods to a configurator by\n        instructing their users to call ``config.add_directive('somename',\n        'some.callable')``.  This will make ``some.callable`` accessible as\n        ``config.somename``.  ``some.callable`` should be a function which\n        accepts ``config`` as a first argument, and arbitrary positional and\n        keyword arguments following.  It should use config.action as\n        necessary to perform actions.  Directive methods can then be invoked\n        like 'built-in' directives such as ``add_view``, ``add_route``, etc.\n\n        The ``action_wrap`` argument should be ``True`` for directives which\n        perform ``config.action`` with potentially conflicting\n        discriminators.  ``action_wrap`` will cause the directive to be\n        wrapped in a decorator which provides more accurate conflict\n        cause information.\n\n        ``add_directive`` does not participate in conflict detection, and\n        later calls to ``add_directive`` will override earlier calls.\n        \"\"\"\n        c = self.maybe_dotted(directive)\n        if not hasattr(self.registry, '_directives'):\n            self.registry._directives = {}\n        self.registry._directives[name] = (c, action_wrap)\n\n    def __getattr__(self, name):\n        # allow directive extension names to work\n        directives = getattr(self.registry, '_directives', {})\n        c = directives.get(name)\n        if c is None:\n            raise AttributeError(name)\n        c, action_wrap = c\n        if action_wrap:\n            c = action_method(c)\n        # Create a bound method (works on both Py2 and Py3)\n        # http://stackoverflow.com/a/1015405/209039\n        m = c.__get__(self, self.__class__)\n        return m\n\n    def with_package(self, package):\n        \"\"\" Return a new Configurator instance with the same registry\n        as this configurator. ``package`` may be an actual Python package\n        object or a :term:`dotted Python name` representing a package.\"\"\"\n        configurator = self.__class__(\n            registry=self.registry,\n            package=package,\n            root_package=self.root_package,\n            autocommit=self.autocommit,\n            route_prefix=self.route_prefix,\n            introspection=self.introspection,\n            )\n        configurator.basepath = self.basepath\n        configurator.includepath = self.includepath\n        configurator.info = self.info\n        return configurator\n\n    def maybe_dotted(self, dotted):\n        \"\"\" Resolve the :term:`dotted Python name` ``dotted`` to a\n        global Python object.  If ``dotted`` is not a string, return\n        it without attempting to do any name resolution.  If\n        ``dotted`` is a relative dotted name (e.g. ``.foo.bar``,\n        consider it relative to the ``package`` argument supplied to\n        this Configurator's constructor.\"\"\"\n        return self.name_resolver.maybe_resolve(dotted)\n\n    def absolute_asset_spec(self, relative_spec):\n        \"\"\" Resolve the potentially relative :term:`asset\n        specification` string passed as ``relative_spec`` into an\n        absolute asset specification string and return the string.\n        Use the ``package`` of this configurator as the package to\n        which the asset specification will be considered relative\n        when generating an absolute asset specification.  If the\n        provided ``relative_spec`` argument is already absolute, or if\n        the ``relative_spec`` is not a string, it is simply returned.\"\"\"\n        if not isinstance(relative_spec, string_types):\n            return relative_spec\n        return self._make_spec(relative_spec)\n\n    absolute_resource_spec = absolute_asset_spec # b/w compat forever\n\n    def begin(self, request=_marker):\n        \"\"\" Indicate that application or test configuration has begun.\n        This pushes a dictionary containing the :term:`application\n        registry` implied by ``registry`` attribute of this\n        configurator and the :term:`request` implied by the\n        ``request`` argument onto the :term:`thread local` stack\n        consulted by various :mod:`pyramid.threadlocal` API\n        functions.\n\n        If ``request`` is not specified and the registry owned by the\n        configurator is already pushed as the current threadlocal registry\n        then this method will keep the current threadlocal request unchanged.\n\n        .. versionchanged:: 1.8\n           The current threadlocal request is propagated if the current\n           threadlocal registry remains unchanged.\n\n        \"\"\"\n        if request is _marker:\n            current = self.manager.get()\n            if current['registry'] == self.registry:\n                request = current['request']\n            else:\n                request = None\n        self.manager.push({'registry':self.registry, 'request':request})\n\n    def end(self):\n        \"\"\" Indicate that application or test configuration has ended.\n        This pops the last value pushed onto the :term:`thread local`\n        stack (usually by the ``begin`` method) and returns that\n        value.\n        \"\"\"\n        return self.manager.pop()\n\n    # this is *not* an action method (uses caller_package)\n    def scan(self, package=None, categories=None, onerror=None, ignore=None,\n             **kw):\n        \"\"\"Scan a Python package and any of its subpackages for objects\n        marked with :term:`configuration decoration` such as\n        :class:`pyramid.view.view_config`.  Any decorated object found will\n        influence the current configuration state.\n\n        The ``package`` argument should be a Python :term:`package` or module\n        object (or a :term:`dotted Python name` which refers to such a\n        package or module).  If ``package`` is ``None``, the package of the\n        *caller* is used.\n\n        The ``categories`` argument, if provided, should be the\n        :term:`Venusian` 'scan categories' to use during scanning.  Providing\n        this argument is not often necessary; specifying scan categories is\n        an extremely advanced usage.  By default, ``categories`` is ``None``\n        which will execute *all* Venusian decorator callbacks including\n        :app:`Pyramid`-related decorators such as\n        :class:`pyramid.view.view_config`.  See the :term:`Venusian`\n        documentation for more information about limiting a scan by using an\n        explicit set of categories.\n\n        The ``onerror`` argument, if provided, should be a Venusian\n        ``onerror`` callback function.  The onerror function is passed to\n        :meth:`venusian.Scanner.scan` to influence error behavior when an\n        exception is raised during the scanning process.  See the\n        :term:`Venusian` documentation for more information about ``onerror``\n        callbacks.\n\n        The ``ignore`` argument, if provided, should be a Venusian ``ignore``\n        value.  Providing an ``ignore`` argument allows the scan to ignore\n        particular modules, packages, or global objects during a scan.\n        ``ignore`` can be a string or a callable, or a list containing\n        strings or callables.  The simplest usage of ``ignore`` is to provide\n        a module or package by providing a full path to its dotted name.  For\n        example: ``config.scan(ignore='my.module.subpackage')`` would ignore\n        the ``my.module.subpackage`` package during a scan, which would\n        prevent the subpackage and any of its submodules from being imported\n        and scanned.  See the :term:`Venusian` documentation for more\n        information about the ``ignore`` argument.\n\n        To perform a ``scan``, Pyramid creates a Venusian ``Scanner`` object.\n        The ``kw`` argument represents a set of keyword arguments to pass to\n        the Venusian ``Scanner`` object's constructor.  See the\n        :term:`venusian` documentation (its ``Scanner`` class) for more\n        information about the constructor.  By default, the only keyword\n        arguments passed to the Scanner constructor are ``{'config':self}``\n        where ``self`` is this configurator object.  This services the\n        requirement of all built-in Pyramid decorators, but extension systems\n        may require additional arguments.  Providing this argument is not\n        often necessary; it's an advanced usage.\n\n        .. versionadded:: 1.1\n           The ``**kw`` argument.\n\n        .. versionadded:: 1.3\n           The ``ignore`` argument.\n\n        \"\"\"\n        package = self.maybe_dotted(package)\n        if package is None: # pragma: no cover\n            package = caller_package()\n\n        ctorkw = {'config': self}\n        ctorkw.update(kw)\n\n        scanner = self.venusian.Scanner(**ctorkw)\n\n        scanner.scan(package, categories=categories, onerror=onerror,\n                     ignore=ignore)\n\n    def make_wsgi_app(self):\n        \"\"\" Commits any pending configuration statements, sends a\n        :class:`pyramid.events.ApplicationCreated` event to all listeners,\n        adds this configuration's registry to\n        :attr:`pyramid.config.global_registries`, and returns a\n        :app:`Pyramid` WSGI application representing the committed\n        configuration state.\"\"\"\n        self.commit()\n        app = Router(self.registry)\n\n        # Allow tools like \"pshell development.ini\" to find the 'last'\n        # registry configured.\n        global_registries.add(self.registry)\n\n        # Push the registry onto the stack in case any code that depends on\n        # the registry threadlocal APIs used in listeners subscribed to the\n        # IApplicationCreated event.\n        self.begin()\n        try:\n            self.registry.notify(ApplicationCreated(app))\n        finally:\n            self.end()\n\n        return app\n\n\n# this class is licensed under the ZPL (stolen from Zope)\nclass ActionState(object):\n    def __init__(self):\n        # NB \"actions\" is an API, dep'd upon by pyramid_zcml's load_zcml func\n        self.actions = []\n        self._seen_files = set()\n\n    def processSpec(self, spec):\n        \"\"\"Check whether a callable needs to be processed.  The ``spec``\n        refers to a unique identifier for the callable.\n\n        Return True if processing is needed and False otherwise. If\n        the callable needs to be processed, it will be marked as\n        processed, assuming that the caller will procces the callable if\n        it needs to be processed.\n        \"\"\"\n        if spec in self._seen_files:\n            return False\n        self._seen_files.add(spec)\n        return True\n\n    def action(self, discriminator, callable=None, args=(), kw=None, order=0,\n               includepath=(), info=None, introspectables=(), **extra):\n        \"\"\"Add an action with the given discriminator, callable and arguments\n        \"\"\"\n        if kw is None:\n            kw = {}\n        action = extra\n        action.update(\n            dict(\n                discriminator=discriminator,\n                callable=callable,\n                args=args,\n                kw=kw,\n                includepath=includepath,\n                info=info,\n                order=order,\n                introspectables=introspectables,\n                )\n            )\n        self.actions.append(action)\n\n    def execute_actions(self, clear=True, introspector=None):\n        \"\"\"Execute the configuration actions\n\n        This calls the action callables after resolving conflicts\n\n        For example:\n\n        >>> output = []\n        >>> def f(*a, **k):\n        ...    output.append(('f', a, k))\n        >>> context = ActionState()\n        >>> context.actions = [\n        ...   (1, f, (1,)),\n        ...   (1, f, (11,), {}, ('x', )),\n        ...   (2, f, (2,)),\n        ...   ]\n        >>> context.execute_actions()\n        >>> output\n        [('f', (1,), {}), ('f', (2,), {})]\n\n        If the action raises an error, we convert it to a\n        ConfigurationExecutionError.\n\n        >>> output = []\n        >>> def bad():\n        ...    bad.xxx\n        >>> context.actions = [\n        ...   (1, f, (1,)),\n        ...   (1, f, (11,), {}, ('x', )),\n        ...   (2, f, (2,)),\n        ...   (3, bad, (), {}, (), 'oops')\n        ...   ]\n        >>> try:\n        ...    v = context.execute_actions()\n        ... except ConfigurationExecutionError, v:\n        ...    pass\n        >>> print(v)\n        exceptions.AttributeError: 'function' object has no attribute 'xxx'\n          in:\n          oops\n\n        Note that actions executed before the error still have an effect:\n\n        >>> output\n        [('f', (1,), {}), ('f', (2,), {})]\n\n        The execution is re-entrant such that actions may be added by other\n        actions with the one caveat that the order of any added actions must\n        be equal to or larger than the current action.\n\n        >>> output = []\n        >>> def f(*a, **k):\n        ...   output.append(('f', a, k))\n        ...   context.actions.append((3, g, (8,), {}))\n        >>> def g(*a, **k):\n        ...    output.append(('g', a, k))\n        >>> context.actions = [\n        ...   (1, f, (1,)),\n        ...   ]\n        >>> context.execute_actions()\n        >>> output\n        [('f', (1,), {}), ('g', (8,), {})]\n\n        \"\"\"\n        try:\n            all_actions = []\n            executed_actions = []\n            action_iter = iter([])\n            conflict_state = ConflictResolverState()\n\n            while True:\n                # We clear the actions list prior to execution so if there\n                # are some new actions then we add them to the mix and resolve\n                # conflicts again. This orders the new actions as well as\n                # ensures that the previously executed actions have no new\n                # conflicts.\n                if self.actions:\n                    all_actions.extend(self.actions)\n                    action_iter = resolveConflicts(\n                        self.actions,\n                        state=conflict_state,\n                    )\n                    self.actions = []\n\n                action = next(action_iter, None)\n                if action is None:\n                    # we are done!\n                    break\n\n                callable = action['callable']\n                args = action['args']\n                kw = action['kw']\n                info = action['info']\n                # we use \"get\" below in case an action was added via a ZCML\n                # directive that did not know about introspectables\n                introspectables = action.get('introspectables', ())\n\n                try:\n                    if callable is not None:\n                        callable(*args, **kw)\n                except Exception:\n                    t, v, tb = sys.exc_info()\n                    try:\n                        reraise(ConfigurationExecutionError,\n                                ConfigurationExecutionError(t, v, info),\n                                tb)\n                    finally:\n                        del t, v, tb\n\n                if introspector is not None:\n                    for introspectable in introspectables:\n                        introspectable.register(introspector, info)\n\n                executed_actions.append(action)\n\n            self.actions = all_actions\n            return executed_actions\n\n        finally:\n            if clear:\n                self.actions = []\n\n\nclass ConflictResolverState(object):\n    def __init__(self):\n        # keep a set of resolved discriminators to test against to ensure\n        # that a new action does not conflict with something already executed\n        self.resolved_ainfos = {}\n\n        # actions left over from a previous iteration\n        self.remaining_actions = []\n\n        # after executing an action we memoize its order to avoid any new\n        # actions sending us backward\n        self.min_order = None\n\n        # unique tracks the index of the action so we need it to increase\n        # monotonically across invocations to resolveConflicts\n        self.start = 0\n\n\n# this function is licensed under the ZPL (stolen from Zope)\ndef resolveConflicts(actions, state=None):\n    \"\"\"Resolve conflicting actions\n\n    Given an actions list, identify and try to resolve conflicting actions.\n    Actions conflict if they have the same non-None discriminator.\n\n    Conflicting actions can be resolved if the include path of one of\n    the actions is a prefix of the includepaths of the other\n    conflicting actions and is unequal to the include paths in the\n    other conflicting actions.\n\n    Actions are resolved on a per-order basis because some discriminators\n    cannot be computed until earlier actions have executed. An action in an\n    earlier order may execute successfully only to find out later that it was\n    overridden by another action with a smaller include path. This will result\n    in a conflict as there is no way to revert the original action.\n\n    ``state`` may be an instance of ``ConflictResolverState`` that\n    can be used to resume execution and resolve the new actions against the\n    list of executed actions from a previous call.\n\n    \"\"\"\n    if state is None:\n        state = ConflictResolverState()\n\n    # pick up where we left off last time, but track the new actions as well\n    state.remaining_actions.extend(normalize_actions(actions))\n    actions = state.remaining_actions\n\n    def orderandpos(v):\n        n, v = v\n        return (v['order'] or 0, n)\n\n    def orderonly(v):\n        n, v = v\n        return v['order'] or 0\n\n    sactions = sorted(enumerate(actions, start=state.start), key=orderandpos)\n    for order, actiongroup in itertools.groupby(sactions, orderonly):\n        # \"order\" is an integer grouping. Actions in a lower order will be\n        # executed before actions in a higher order.  All of the actions in\n        # one grouping will be executed (its callable, if any will be called)\n        # before any of the actions in the next.\n        output = []\n        unique = {}\n\n        # error out if we went backward in order\n        if state.min_order is not None and order < state.min_order:\n            r = ['Actions were added to order={0} after execution had moved '\n                 'on to order={1}. Conflicting actions: '\n                 .format(order, state.min_order)]\n            for i, action in actiongroup:\n                for line in str(action['info']).rstrip().split('\\n'):\n                    r.append(\"  \" + line)\n            raise ConfigurationError('\\n'.join(r))\n\n        for i, action in actiongroup:\n            # Within an order, actions are executed sequentially based on\n            # original action ordering (\"i\").\n\n            # \"ainfo\" is a tuple of (i, action) where \"i\" is an integer\n            # expressing the relative position of this action in the action\n            # list being resolved, and \"action\" is an action dictionary.  The\n            # purpose of an ainfo is to associate an \"i\" with a particular\n            # action; \"i\" exists for sorting after conflict resolution.\n            ainfo = (i, action)\n\n            # wait to defer discriminators until we are on their order because\n            # the discriminator may depend on state from a previous order\n            discriminator = undefer(action['discriminator'])\n            action['discriminator'] = discriminator\n\n            if discriminator is None:\n                # The discriminator is None, so this action can never conflict.\n                # We can add it directly to the result.\n                output.append(ainfo)\n                continue\n\n            L = unique.setdefault(discriminator, [])\n            L.append(ainfo)\n\n        # Check for conflicts\n        conflicts = {}\n        for discriminator, ainfos in unique.items():\n            # We use (includepath, i) as a sort key because we need to\n            # sort the actions by the paths so that the shortest path with a\n            # given prefix comes first.  The \"first\" action is the one with the\n            # shortest include path.  We break sorting ties using \"i\".\n            def bypath(ainfo):\n                path, i = ainfo[1]['includepath'], ainfo[0]\n                return path, order, i\n\n            ainfos.sort(key=bypath)\n            ainfo, rest = ainfos[0], ainfos[1:]\n            _, action = ainfo\n\n            # ensure this new action does not conflict with a previously\n            # resolved action from an earlier order / invocation\n            prev_ainfo = state.resolved_ainfos.get(discriminator)\n            if prev_ainfo is not None:\n                _, paction = prev_ainfo\n                basepath, baseinfo = paction['includepath'], paction['info']\n                includepath = action['includepath']\n                # if the new action conflicts with the resolved action then\n                # note the conflict, otherwise drop the action as it's\n                # effectively overriden by the previous action\n                if (includepath[:len(basepath)] != basepath or\n                        includepath == basepath):\n                    L = conflicts.setdefault(discriminator, [baseinfo])\n                    L.append(action['info'])\n\n            else:\n                output.append(ainfo)\n\n            basepath, baseinfo = action['includepath'], action['info']\n            for _, action in rest:\n                includepath = action['includepath']\n                # Test whether path is a prefix of opath\n                if (includepath[:len(basepath)] != basepath or  # not a prefix\n                        includepath == basepath):\n                    L = conflicts.setdefault(discriminator, [baseinfo])\n                    L.append(action['info'])\n\n        if conflicts:\n            raise ConfigurationConflictError(conflicts)\n\n        # sort resolved actions by \"i\" and yield them one by one\n        for i, action in sorted(output, key=operator.itemgetter(0)):\n            # do not memoize the order until we resolve an action inside it\n            state.min_order = action['order']\n            state.start = i + 1\n            state.remaining_actions.remove(action)\n            state.resolved_ainfos[action['discriminator']] = (i, action)\n            yield action\n\n\ndef normalize_actions(actions):\n    \"\"\"Convert old-style tuple actions to new-style dicts.\"\"\"\n    result = []\n    for v in actions:\n        if not isinstance(v, dict):\n            v = expand_action_tuple(*v)\n        result.append(v)\n    return result\n\n\ndef expand_action_tuple(\n    discriminator, callable=None, args=(), kw=None, includepath=(),\n    info=None, order=0, introspectables=(),\n):\n    if kw is None:\n        kw = {}\n    return dict(\n        discriminator=discriminator,\n        callable=callable,\n        args=args,\n        kw=kw,\n        includepath=includepath,\n        info=info,\n        order=order,\n        introspectables=introspectables,\n        )\n\n\nglobal_registries = WeakOrderedSet()\n",
            "new_file_content": "import inspect\nimport itertools\nimport logging\nimport operator\nimport os\nimport sys\nimport threading\nimport venusian\n\nfrom webob.exc import WSGIHTTPException as WebobWSGIHTTPException\n\nfrom pyramid.interfaces import (\n    IDebugLogger,\n    IExceptionResponse,\n    IPredicateList,\n    PHASE0_CONFIG,\n    PHASE1_CONFIG,\n    PHASE2_CONFIG,\n    PHASE3_CONFIG,\n    )\n\nfrom pyramid.asset import resolve_asset_spec\n\nfrom pyramid.authorization import ACLAuthorizationPolicy\n\nfrom pyramid.compat import (\n    text_,\n    reraise,\n    string_types,\n    )\n\nfrom pyramid.events import ApplicationCreated\n\nfrom pyramid.exceptions import (\n    ConfigurationConflictError,\n    ConfigurationError,\n    ConfigurationExecutionError,\n    )\n\nfrom pyramid.httpexceptions import default_exceptionresponse_view\n\nfrom pyramid.path import (\n    caller_package,\n    package_of,\n    )\n\nfrom pyramid.registry import (\n    Introspectable,\n    Introspector,\n    Registry,\n    undefer,\n    )\n\nfrom pyramid.router import Router\n\nfrom pyramid.settings import aslist\n\nfrom pyramid.threadlocal import manager\n\nfrom pyramid.util import (\n    ActionInfo,\n    WeakOrderedSet,\n    action_method,\n    object_description,\n    )\n\nfrom pyramid.config.adapters import AdaptersConfiguratorMixin\nfrom pyramid.config.assets import AssetsConfiguratorMixin\nfrom pyramid.config.factories import FactoriesConfiguratorMixin\nfrom pyramid.config.i18n import I18NConfiguratorMixin\nfrom pyramid.config.rendering import RenderingConfiguratorMixin\nfrom pyramid.config.routes import RoutesConfiguratorMixin\nfrom pyramid.config.security import SecurityConfiguratorMixin\nfrom pyramid.config.settings import SettingsConfiguratorMixin\nfrom pyramid.config.testing import TestingConfiguratorMixin\nfrom pyramid.config.tweens import TweensConfiguratorMixin\nfrom pyramid.config.util import PredicateList, not_\nfrom pyramid.config.views import ViewsConfiguratorMixin\nfrom pyramid.config.zca import ZCAConfiguratorMixin\n\nfrom pyramid.path import DottedNameResolver\n\nempty = text_('')\n_marker = object()\n\nConfigurationError = ConfigurationError # pyflakes\n\nnot_ = not_ # pyflakes, this is an API\n\nPHASE0_CONFIG = PHASE0_CONFIG  # api\nPHASE1_CONFIG = PHASE1_CONFIG  # api\nPHASE2_CONFIG = PHASE2_CONFIG  # api\nPHASE3_CONFIG = PHASE3_CONFIG  # api\n\nclass Configurator(\n    TestingConfiguratorMixin,\n    TweensConfiguratorMixin,\n    SecurityConfiguratorMixin,\n    ViewsConfiguratorMixin,\n    RoutesConfiguratorMixin,\n    ZCAConfiguratorMixin,\n    I18NConfiguratorMixin,\n    RenderingConfiguratorMixin,\n    AssetsConfiguratorMixin,\n    SettingsConfiguratorMixin,\n    FactoriesConfiguratorMixin,\n    AdaptersConfiguratorMixin,\n    ):\n    \"\"\"\n    A Configurator is used to configure a :app:`Pyramid`\n    :term:`application registry`.\n\n    If the ``registry`` argument is not ``None``, it must\n    be an instance of the :class:`pyramid.registry.Registry` class\n    representing the registry to configure.  If ``registry`` is ``None``, the\n    configurator will create a :class:`pyramid.registry.Registry` instance\n    itself; it will also perform some default configuration that would not\n    otherwise be done.  After its construction, the configurator may be used\n    to add further configuration to the registry.\n\n    .. warning:: If ``registry`` is assigned the above-mentioned class\n       instance, all other constructor arguments are ignored,\n       with the exception of ``package``.\n\n    If the ``package`` argument is passed, it must be a reference to a Python\n    :term:`package` (e.g. ``sys.modules['thepackage']``) or a :term:`dotted\n    Python name` to the same.  This value is used as a basis to convert\n    relative paths passed to various configuration methods, such as methods\n    which accept a ``renderer`` argument, into absolute paths.  If ``None``\n    is passed (the default), the package is assumed to be the Python package\n    in which the *caller* of the ``Configurator`` constructor lives.\n\n    If the ``root_package`` is passed, it will propagate through the\n    configuration hierarchy as a way for included packages to locate\n    resources relative to the package in which the main ``Configurator`` was\n    created. If ``None`` is passed (the default), the ``root_package`` will\n    be derived from the ``package`` argument. The ``package`` attribute is\n    always pointing at the package being included when using :meth:`.include`,\n    whereas the ``root_package`` does not change.\n\n    If the ``settings`` argument is passed, it should be a Python dictionary\n    representing the :term:`deployment settings` for this application.  These\n    are later retrievable using the\n    :attr:`pyramid.registry.Registry.settings` attribute (aka\n    ``request.registry.settings``).\n\n    If the ``root_factory`` argument is passed, it should be an object\n    representing the default :term:`root factory` for your application or a\n    :term:`dotted Python name` to the same.  If it is ``None``, a default\n    root factory will be used.\n\n    If ``authentication_policy`` is passed, it should be an instance\n    of an :term:`authentication policy` or a :term:`dotted Python\n    name` to the same.\n\n    If ``authorization_policy`` is passed, it should be an instance of\n    an :term:`authorization policy` or a :term:`dotted Python name` to\n    the same.\n\n    .. note:: A ``ConfigurationError`` will be raised when an\n       authorization policy is supplied without also supplying an\n       authentication policy (authorization requires authentication).\n\n    If ``renderers`` is ``None`` (the default), a default set of\n    :term:`renderer` factories is used. Else, it should be a list of\n    tuples representing a set of renderer factories which should be\n    configured into this application, and each tuple representing a set of\n    positional values that should be passed to\n    :meth:`pyramid.config.Configurator.add_renderer`.\n\n    If ``debug_logger`` is not passed, a default debug logger that logs to a\n    logger will be used (the logger name will be the package name of the\n    *caller* of this configurator).  If it is passed, it should be an\n    instance of the :class:`logging.Logger` (PEP 282) standard library class\n    or a Python logger name.  The debug logger is used by :app:`Pyramid`\n    itself to log warnings and authorization debugging information.\n\n    If ``locale_negotiator`` is passed, it should be a :term:`locale\n    negotiator` implementation or a :term:`dotted Python name` to\n    same.  See :ref:`custom_locale_negotiator`.\n\n    If ``request_factory`` is passed, it should be a :term:`request\n    factory` implementation or a :term:`dotted Python name` to the same.\n    See :ref:`changing_the_request_factory`.  By default it is ``None``,\n    which means use the default request factory.\n\n    If ``response_factory`` is passed, it should be a :term:`response\n    factory` implementation or a :term:`dotted Python name` to the same.\n    See :ref:`changing_the_response_factory`.  By default it is ``None``,\n    which means use the default response factory.\n\n    If ``default_permission`` is passed, it should be a\n    :term:`permission` string to be used as the default permission for\n    all view configuration registrations performed against this\n    Configurator.  An example of a permission string:``'view'``.\n    Adding a default permission makes it unnecessary to protect each\n    view configuration with an explicit permission, unless your\n    application policy requires some exception for a particular view.\n    By default, ``default_permission`` is ``None``, meaning that view\n    configurations which do not explicitly declare a permission will\n    always be executable by entirely anonymous users (any\n    authorization policy in effect is ignored).\n\n    .. seealso::\n\n        See also :ref:`setting_a_default_permission`.\n\n    If ``session_factory`` is passed, it should be an object which\n    implements the :term:`session factory` interface.  If a nondefault\n    value is passed, the ``session_factory`` will be used to create a\n    session object when ``request.session`` is accessed.  Note that\n    the same outcome can be achieved by calling\n    :meth:`pyramid.config.Configurator.set_session_factory`.  By\n    default, this argument is ``None``, indicating that no session\n    factory will be configured (and thus accessing ``request.session``\n    will throw an error) unless ``set_session_factory`` is called later\n    during configuration.\n\n    If ``autocommit`` is ``True``, every method called on the configurator\n    will cause an immediate action, and no configuration conflict detection\n    will be used. If ``autocommit`` is ``False``, most methods of the\n    configurator will defer their action until\n    :meth:`pyramid.config.Configurator.commit` is called.  When\n    :meth:`pyramid.config.Configurator.commit` is called, the actions implied\n    by the called methods will be checked for configuration conflicts unless\n    ``autocommit`` is ``True``.  If a conflict is detected, a\n    ``ConfigurationConflictError`` will be raised.  Calling\n    :meth:`pyramid.config.Configurator.make_wsgi_app` always implies a final\n    commit.\n\n    If ``default_view_mapper`` is passed, it will be used as the default\n    :term:`view mapper` factory for view configurations that don't otherwise\n    specify one (see :class:`pyramid.interfaces.IViewMapperFactory`).  If\n    ``default_view_mapper`` is not passed, a superdefault view mapper will be\n    used.\n\n    If ``exceptionresponse_view`` is passed, it must be a :term:`view\n    callable` or ``None``.  If it is a view callable, it will be used as an\n    exception view callable when an :term:`exception response` is raised. If\n    ``exceptionresponse_view`` is ``None``, no exception response view will\n    be registered, and all raised exception responses will be bubbled up to\n    Pyramid's caller.  By\n    default, the ``pyramid.httpexceptions.default_exceptionresponse_view``\n    function is used as the ``exceptionresponse_view``.\n\n    If ``route_prefix`` is passed, all routes added with\n    :meth:`pyramid.config.Configurator.add_route` will have the specified path\n    prepended to their pattern.\n\n    If ``introspection`` is passed, it must be a boolean value.  If it's\n    ``True``, introspection values during actions will be kept for use\n    for tools like the debug toolbar.  If it's ``False``, introspection\n    values provided by registrations will be ignored.  By default, it is\n    ``True``.\n\n    .. versionadded:: 1.1\n       The ``exceptionresponse_view`` argument.\n\n    .. versionadded:: 1.2\n       The ``route_prefix`` argument.\n\n    .. versionadded:: 1.3\n       The ``introspection`` argument.\n\n    .. versionadded:: 1.6\n       The ``root_package`` argument.\n       The ``response_factory`` argument.\n    \"\"\"\n    manager = manager # for testing injection\n    venusian = venusian # for testing injection\n    _ainfo = None\n    basepath = None\n    includepath = ()\n    info = ''\n    object_description = staticmethod(object_description)\n    introspectable = Introspectable\n    inspect = inspect\n\n    def __init__(self,\n                 registry=None,\n                 package=None,\n                 settings=None,\n                 root_factory=None,\n                 authentication_policy=None,\n                 authorization_policy=None,\n                 renderers=None,\n                 debug_logger=None,\n                 locale_negotiator=None,\n                 request_factory=None,\n                 response_factory=None,\n                 default_permission=None,\n                 session_factory=None,\n                 default_view_mapper=None,\n                 autocommit=False,\n                 exceptionresponse_view=default_exceptionresponse_view,\n                 route_prefix=None,\n                 introspection=True,\n                 root_package=None,\n                 ):\n        if package is None:\n            package = caller_package()\n        if root_package is None:\n            root_package = package\n        name_resolver = DottedNameResolver(package)\n        self.name_resolver = name_resolver\n        self.package_name = name_resolver.get_package_name()\n        self.package = name_resolver.get_package()\n        self.root_package = root_package\n        self.registry = registry\n        self.autocommit = autocommit\n        self.route_prefix = route_prefix\n        self.introspection = introspection\n        if registry is None:\n            registry = Registry(self.package_name)\n            self.registry = registry\n            self.setup_registry(\n                settings=settings,\n                root_factory=root_factory,\n                authentication_policy=authentication_policy,\n                authorization_policy=authorization_policy,\n                renderers=renderers,\n                debug_logger=debug_logger,\n                locale_negotiator=locale_negotiator,\n                request_factory=request_factory,\n                response_factory=response_factory,\n                default_permission=default_permission,\n                session_factory=session_factory,\n                default_view_mapper=default_view_mapper,\n                exceptionresponse_view=exceptionresponse_view,\n                )\n\n    def setup_registry(self,\n                       settings=None,\n                       root_factory=None,\n                       authentication_policy=None,\n                       authorization_policy=None,\n                       renderers=None,\n                       debug_logger=None,\n                       locale_negotiator=None,\n                       request_factory=None,\n                       response_factory=None,\n                       default_permission=None,\n                       session_factory=None,\n                       default_view_mapper=None,\n                       exceptionresponse_view=default_exceptionresponse_view,\n                       ):\n        \"\"\" When you pass a non-``None`` ``registry`` argument to the\n        :term:`Configurator` constructor, no initial setup is performed\n        against the registry.  This is because the registry you pass in may\n        have already been initialized for use under :app:`Pyramid` via a\n        different configurator.  However, in some circumstances (such as when\n        you want to use a global registry instead of a registry created as a\n        result of the Configurator constructor), or when you want to reset\n        the initial setup of a registry, you *do* want to explicitly\n        initialize the registry associated with a Configurator for use under\n        :app:`Pyramid`.  Use ``setup_registry`` to do this initialization.\n\n        ``setup_registry`` configures settings, a root factory, security\n        policies, renderers, a debug logger, a locale negotiator, and various\n        other settings using the configurator's current registry, as per the\n        descriptions in the Configurator constructor.\"\"\"\n\n        registry = self.registry\n\n        self._fix_registry()\n\n        self._set_settings(settings)\n\n        if isinstance(debug_logger, string_types):\n            debug_logger = logging.getLogger(debug_logger)\n\n        if debug_logger is None:\n            debug_logger = logging.getLogger(self.package_name)\n\n        registry.registerUtility(debug_logger, IDebugLogger)\n\n        self.add_default_response_adapters()\n        self.add_default_renderers()\n        self.add_default_view_predicates()\n        self.add_default_view_derivers()\n        self.add_default_route_predicates()\n        self.add_default_tweens()\n\n        if exceptionresponse_view is not None:\n            exceptionresponse_view = self.maybe_dotted(exceptionresponse_view)\n            self.add_view(exceptionresponse_view, context=IExceptionResponse)\n            self.add_view(exceptionresponse_view,context=WebobWSGIHTTPException)\n\n        # commit below because:\n        #\n        # - the default exceptionresponse_view requires the superdefault view\n        #   mapper, so we need to configure it before adding default_view_mapper\n        #\n        # - superdefault renderers should be overrideable without requiring\n        #   the user to commit before calling config.add_renderer\n\n        self.commit()\n\n        # self.commit() should not be called within this method after this\n        # point because the following registrations should be treated as\n        # analogues of methods called by the user after configurator\n        # construction.  Rationale: user-supplied implementations should be\n        # preferred rather than add-on author implementations with the help of\n        # automatic conflict resolution.\n\n        if authentication_policy and not authorization_policy:\n            authorization_policy = ACLAuthorizationPolicy() # default\n\n        if authorization_policy:\n            self.set_authorization_policy(authorization_policy)\n\n        if authentication_policy:\n            self.set_authentication_policy(authentication_policy)\n\n        if default_view_mapper is not None:\n            self.set_view_mapper(default_view_mapper)\n\n        if renderers:\n            for name, renderer in renderers:\n                self.add_renderer(name, renderer)\n\n        if root_factory is not None:\n            self.set_root_factory(root_factory)\n\n        if locale_negotiator:\n            self.set_locale_negotiator(locale_negotiator)\n\n        if request_factory:\n            self.set_request_factory(request_factory)\n\n        if response_factory:\n            self.set_response_factory(response_factory)\n\n        if default_permission:\n            self.set_default_permission(default_permission)\n\n        if session_factory is not None:\n            self.set_session_factory(session_factory)\n\n        tweens = aslist(registry.settings.get('pyramid.tweens', []))\n        for factory in tweens:\n            self._add_tween(factory, explicit=True)\n\n        includes = aslist(registry.settings.get('pyramid.includes', []))\n        for inc in includes:\n            self.include(inc)\n\n    def _make_spec(self, path_or_spec):\n        package, filename = resolve_asset_spec(path_or_spec, self.package_name)\n        if package is None:\n            return filename # absolute filename\n        return '%s:%s' % (package, filename)\n\n    def _fix_registry(self):\n        \"\"\" Fix up a ZCA component registry that is not a\n        pyramid.registry.Registry by adding analogues of ``has_listeners``,\n        ``notify``, ``queryAdapterOrSelf``, and ``registerSelfAdapter``\n        through monkey-patching.\"\"\"\n\n        _registry = self.registry\n\n        if not hasattr(_registry, 'notify'):\n            def notify(*events):\n                [ _ for _ in _registry.subscribers(events, None) ]\n            _registry.notify = notify\n\n        if not hasattr(_registry, 'has_listeners'):\n            _registry.has_listeners = True\n\n        if not hasattr(_registry, 'queryAdapterOrSelf'):\n            def queryAdapterOrSelf(object, interface, default=None):\n                if not interface.providedBy(object):\n                    return _registry.queryAdapter(object, interface,\n                                                  default=default)\n                return object\n            _registry.queryAdapterOrSelf = queryAdapterOrSelf\n\n        if not hasattr(_registry, 'registerSelfAdapter'):\n            def registerSelfAdapter(required=None, provided=None,\n                                    name=empty, info=empty, event=True):\n                return _registry.registerAdapter(lambda x: x,\n                                                 required=required,\n                                                 provided=provided, name=name,\n                                                 info=info, event=event)\n            _registry.registerSelfAdapter = registerSelfAdapter\n\n        if not hasattr(_registry, '_lock'):\n            _registry._lock = threading.Lock()\n\n        if not hasattr(_registry, '_clear_view_lookup_cache'):\n            def _clear_view_lookup_cache():\n                _registry._view_lookup_cache = {}\n            _registry._clear_view_lookup_cache = _clear_view_lookup_cache\n\n\n    # API\n\n    def _get_introspector(self):\n        introspector = getattr(self.registry, 'introspector', _marker)\n        if introspector is _marker:\n            introspector = Introspector()\n            self._set_introspector(introspector)\n        return introspector\n\n    def _set_introspector(self, introspector):\n        self.registry.introspector = introspector\n\n    def _del_introspector(self):\n        del self.registry.introspector\n\n    introspector = property(\n        _get_introspector, _set_introspector, _del_introspector\n        )\n\n    def get_predlist(self, name):\n        predlist = self.registry.queryUtility(IPredicateList, name=name)\n        if predlist is None:\n            predlist = PredicateList()\n            self.registry.registerUtility(predlist, IPredicateList, name=name)\n        return predlist\n\n\n    def _add_predicate(self, type, name, factory, weighs_more_than=None,\n                       weighs_less_than=None):\n        factory = self.maybe_dotted(factory)\n        discriminator = ('%s option' % type, name)\n        intr = self.introspectable(\n            '%s predicates' % type,\n            discriminator,\n            '%s predicate named %s' % (type, name),\n            '%s predicate' % type)\n        intr['name'] = name\n        intr['factory'] = factory\n        intr['weighs_more_than'] = weighs_more_than\n        intr['weighs_less_than'] = weighs_less_than\n        def register():\n            predlist = self.get_predlist(type)\n            predlist.add(name, factory, weighs_more_than=weighs_more_than,\n                         weighs_less_than=weighs_less_than)\n        self.action(discriminator, register, introspectables=(intr,),\n                    order=PHASE1_CONFIG) # must be registered early\n\n    @property\n    def action_info(self):\n        info = self.info # usually a ZCML action (ParserInfo) if self.info\n        if not info:\n            # Try to provide more accurate info for conflict reports\n            if self._ainfo:\n                info = self._ainfo[0]\n            else:\n                info = ActionInfo(None, 0, '', '')\n        return info\n\n    def action(self, discriminator, callable=None, args=(), kw=None, order=0,\n               introspectables=(), **extra):\n        \"\"\" Register an action which will be executed when\n        :meth:`pyramid.config.Configurator.commit` is called (or executed\n        immediately if ``autocommit`` is ``True``).\n\n        .. warning:: This method is typically only used by :app:`Pyramid`\n           framework extension authors, not by :app:`Pyramid` application\n           developers.\n\n        The ``discriminator`` uniquely identifies the action.  It must be\n        given, but it can be ``None``, to indicate that the action never\n        conflicts.  It must be a hashable value.\n\n        The ``callable`` is a callable object which performs the task\n        associated with the action when the action is executed.  It is\n        optional.\n\n        ``args`` and ``kw`` are tuple and dict objects respectively, which\n        are passed to ``callable`` when this action is executed.  Both are\n        optional.\n\n        ``order`` is a grouping mechanism; an action with a lower order will\n        be executed before an action with a higher order (has no effect when\n        autocommit is ``True``).\n\n        ``introspectables`` is a sequence of :term:`introspectable` objects\n        (or the empty sequence if no introspectable objects are associated\n        with this action).  If this configurator's ``introspection``\n        attribute is ``False``, these introspectables will be ignored.\n\n        ``extra`` provides a facility for inserting extra keys and values\n        into an action dictionary.\n        \"\"\"\n        # catch nonhashable discriminators here; most unit tests use\n        # autocommit=False, which won't catch unhashable discriminators\n        assert hash(discriminator) \n\n        if kw is None:\n            kw = {}\n\n        autocommit = self.autocommit\n        action_info = self.action_info\n\n        if not self.introspection:\n            # if we're not introspecting, ignore any introspectables passed\n            # to us\n            introspectables = ()\n\n        if autocommit:\n            # callables can depend on the side effects of resolving a\n            # deferred discriminator\n            self.begin()\n            try:\n                undefer(discriminator)\n                if callable is not None:\n                    callable(*args, **kw)\n                for introspectable in introspectables:\n                    introspectable.register(self.introspector, action_info)\n            finally:\n                self.end()\n\n        else:\n            action = extra\n            action.update(\n                dict(\n                    discriminator=discriminator,\n                    callable=callable,\n                    args=args,\n                    kw=kw,\n                    order=order,\n                    info=action_info,\n                    includepath=self.includepath,\n                    introspectables=introspectables,\n                    )\n                )\n            self.action_state.action(**action)\n\n    def _get_action_state(self):\n        registry = self.registry\n        try:\n            state = registry.action_state\n        except AttributeError:\n            state = ActionState()\n            registry.action_state = state\n        return state\n\n    def _set_action_state(self, state):\n        self.registry.action_state = state\n\n    action_state = property(_get_action_state, _set_action_state)\n\n    _ctx = action_state # bw compat\n\n    def commit(self):\n        \"\"\" Commit any pending configuration actions. If a configuration\n        conflict is detected in the pending configuration actions, this method\n        will raise a :exc:`ConfigurationConflictError`; within the traceback\n        of this error will be information about the source of the conflict,\n        usually including file names and line numbers of the cause of the\n        configuration conflicts.\"\"\"\n        self.begin()\n        try:\n            self.action_state.execute_actions(introspector=self.introspector)\n        finally:\n            self.end()\n        self.action_state = ActionState() # old actions have been processed\n\n    def include(self, callable, route_prefix=None):\n        \"\"\"Include a configuration callable, to support imperative\n        application extensibility.\n\n        .. warning:: In versions of :app:`Pyramid` prior to 1.2, this\n            function accepted ``*callables``, but this has been changed\n            to support only a single callable.\n\n        A configuration callable should be a callable that accepts a single\n        argument named ``config``, which will be an instance of a\n        :term:`Configurator`.  However, be warned that it will not be the same\n        configurator instance on which you call this method.  The\n        code which runs as a result of calling the callable should invoke\n        methods on the configurator passed to it which add configuration\n        state.  The return value of a callable will be ignored.\n\n        Values allowed to be presented via the ``callable`` argument to\n        this method: any callable Python object or any :term:`dotted Python\n        name` which resolves to a callable Python object.  It may also be a\n        Python :term:`module`, in which case, the module will be searched for\n        a callable named ``includeme``, which will be treated as the\n        configuration callable.\n\n        For example, if the ``includeme`` function below lives in a module\n        named ``myapp.myconfig``:\n\n        .. code-block:: python\n           :linenos:\n\n           # myapp.myconfig module\n\n           def my_view(request):\n               from pyramid.response import Response\n               return Response('OK')\n\n           def includeme(config):\n               config.add_view(my_view)\n\n        You might cause it to be included within your Pyramid application like\n        so:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include('myapp.myconfig.includeme')\n\n        Because the function is named ``includeme``, the function name can\n        also be omitted from the dotted name reference:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include('myapp.myconfig')\n\n        Included configuration statements will be overridden by local\n        configuration statements if an included callable causes a\n        configuration conflict by registering something with the same\n        configuration parameters.\n\n        If the ``route_prefix`` is supplied, it must be a string.  Any calls\n        to :meth:`pyramid.config.Configurator.add_route` within the included\n        callable will have their pattern prefixed with the value of\n        ``route_prefix``. This can be used to help mount a set of routes at a\n        different location than the included callable's author intended, while\n        still maintaining the same route names.  For example:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def included(config):\n               config.add_route('show_users', '/show')\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include(included, route_prefix='/users')\n\n        In the above configuration, the ``show_users`` route will have an\n        effective route pattern of ``/users/show``, instead of ``/show``\n        because the ``route_prefix`` argument will be prepended to the\n        pattern.\n\n        .. versionadded:: 1.2\n           The ``route_prefix`` parameter.\n\n        .. versionchanged:: 1.9\n           The included function is wrapped with a call to\n           :meth:`pyramid.config.Configurator.begin` and\n           :meth:`pyramid.config.Configurator.end` while it is executed.\n\n        \"\"\"\n        # \"\"\" <-- emacs\n\n        action_state = self.action_state\n\n        if route_prefix is None:\n            route_prefix = ''\n\n        old_route_prefix = self.route_prefix\n        if old_route_prefix is None:\n            old_route_prefix = ''\n\n        route_prefix = '%s/%s' % (\n            old_route_prefix.rstrip('/'),\n            route_prefix.lstrip('/')\n            )\n        route_prefix = route_prefix.strip('/')\n        if not route_prefix:\n            route_prefix = None\n\n        c = self.maybe_dotted(callable)\n        module = self.inspect.getmodule(c)\n        if module is c:\n            try:\n                c = getattr(module, 'includeme')\n            except AttributeError:\n                raise ConfigurationError(\n                    \"module %r has no attribute 'includeme'\" % (module.__name__)\n                    )\n                                                       \n        spec = module.__name__ + ':' + c.__name__\n        sourcefile = self.inspect.getsourcefile(c)\n\n        if sourcefile is None:\n            raise ConfigurationError(\n                'No source file for module %r (.py file must exist, '\n                'refusing to use orphan .pyc or .pyo file).' % module.__name__)\n            \n\n        if action_state.processSpec(spec):\n            configurator = self.__class__(\n                registry=self.registry,\n                package=package_of(module),\n                root_package=self.root_package,\n                autocommit=self.autocommit,\n                route_prefix=route_prefix,\n                )\n            configurator.basepath = os.path.dirname(sourcefile)\n            configurator.includepath = self.includepath + (spec,)\n            self.begin()\n            try:\n                c(configurator)\n            finally:\n                self.end()\n\n    def add_directive(self, name, directive, action_wrap=True):\n        \"\"\"\n        Add a directive method to the configurator.\n\n        .. warning:: This method is typically only used by :app:`Pyramid`\n           framework extension authors, not by :app:`Pyramid` application\n           developers.\n\n        Framework extenders can add directive methods to a configurator by\n        instructing their users to call ``config.add_directive('somename',\n        'some.callable')``.  This will make ``some.callable`` accessible as\n        ``config.somename``.  ``some.callable`` should be a function which\n        accepts ``config`` as a first argument, and arbitrary positional and\n        keyword arguments following.  It should use config.action as\n        necessary to perform actions.  Directive methods can then be invoked\n        like 'built-in' directives such as ``add_view``, ``add_route``, etc.\n\n        The ``action_wrap`` argument should be ``True`` for directives which\n        perform ``config.action`` with potentially conflicting\n        discriminators.  ``action_wrap`` will cause the directive to be\n        wrapped in a decorator which provides more accurate conflict\n        cause information.\n\n        ``add_directive`` does not participate in conflict detection, and\n        later calls to ``add_directive`` will override earlier calls.\n        \"\"\"\n        c = self.maybe_dotted(directive)\n        if not hasattr(self.registry, '_directives'):\n            self.registry._directives = {}\n        self.registry._directives[name] = (c, action_wrap)\n\n    def __getattr__(self, name):\n        # allow directive extension names to work\n        directives = getattr(self.registry, '_directives', {})\n        c = directives.get(name)\n        if c is None:\n            raise AttributeError(name)\n        c, action_wrap = c\n        if action_wrap:\n            c = action_method(c)\n        # Create a bound method (works on both Py2 and Py3)\n        # http://stackoverflow.com/a/1015405/209039\n        m = c.__get__(self, self.__class__)\n        return m\n\n    def with_package(self, package):\n        \"\"\" Return a new Configurator instance with the same registry\n        as this configurator. ``package`` may be an actual Python package\n        object or a :term:`dotted Python name` representing a package.\"\"\"\n        configurator = self.__class__(\n            registry=self.registry,\n            package=package,\n            root_package=self.root_package,\n            autocommit=self.autocommit,\n            route_prefix=self.route_prefix,\n            introspection=self.introspection,\n            )\n        configurator.basepath = self.basepath\n        configurator.includepath = self.includepath\n        configurator.info = self.info\n        return configurator\n\n    def maybe_dotted(self, dotted):\n        \"\"\" Resolve the :term:`dotted Python name` ``dotted`` to a\n        global Python object.  If ``dotted`` is not a string, return\n        it without attempting to do any name resolution.  If\n        ``dotted`` is a relative dotted name (e.g. ``.foo.bar``,\n        consider it relative to the ``package`` argument supplied to\n        this Configurator's constructor.\"\"\"\n        return self.name_resolver.maybe_resolve(dotted)\n\n    def absolute_asset_spec(self, relative_spec):\n        \"\"\" Resolve the potentially relative :term:`asset\n        specification` string passed as ``relative_spec`` into an\n        absolute asset specification string and return the string.\n        Use the ``package`` of this configurator as the package to\n        which the asset specification will be considered relative\n        when generating an absolute asset specification.  If the\n        provided ``relative_spec`` argument is already absolute, or if\n        the ``relative_spec`` is not a string, it is simply returned.\"\"\"\n        if not isinstance(relative_spec, string_types):\n            return relative_spec\n        return self._make_spec(relative_spec)\n\n    absolute_resource_spec = absolute_asset_spec # b/w compat forever\n\n    def begin(self, request=_marker):\n        \"\"\" Indicate that application or test configuration has begun.\n        This pushes a dictionary containing the :term:`application\n        registry` implied by ``registry`` attribute of this\n        configurator and the :term:`request` implied by the\n        ``request`` argument onto the :term:`thread local` stack\n        consulted by various :mod:`pyramid.threadlocal` API\n        functions.\n\n        If ``request`` is not specified and the registry owned by the\n        configurator is already pushed as the current threadlocal registry\n        then this method will keep the current threadlocal request unchanged.\n\n        .. versionchanged:: 1.8\n           The current threadlocal request is propagated if the current\n           threadlocal registry remains unchanged.\n\n        \"\"\"\n        if request is _marker:\n            current = self.manager.get()\n            if current['registry'] == self.registry:\n                request = current['request']\n            else:\n                request = None\n        self.manager.push({'registry':self.registry, 'request':request})\n\n    def end(self):\n        \"\"\" Indicate that application or test configuration has ended.\n        This pops the last value pushed onto the :term:`thread local`\n        stack (usually by the ``begin`` method) and returns that\n        value.\n        \"\"\"\n        return self.manager.pop()\n\n    # this is *not* an action method (uses caller_package)\n    def scan(self, package=None, categories=None, onerror=None, ignore=None,\n             **kw):\n        \"\"\"Scan a Python package and any of its subpackages for objects\n        marked with :term:`configuration decoration` such as\n        :class:`pyramid.view.view_config`.  Any decorated object found will\n        influence the current configuration state.\n\n        The ``package`` argument should be a Python :term:`package` or module\n        object (or a :term:`dotted Python name` which refers to such a\n        package or module).  If ``package`` is ``None``, the package of the\n        *caller* is used.\n\n        The ``categories`` argument, if provided, should be the\n        :term:`Venusian` 'scan categories' to use during scanning.  Providing\n        this argument is not often necessary; specifying scan categories is\n        an extremely advanced usage.  By default, ``categories`` is ``None``\n        which will execute *all* Venusian decorator callbacks including\n        :app:`Pyramid`-related decorators such as\n        :class:`pyramid.view.view_config`.  See the :term:`Venusian`\n        documentation for more information about limiting a scan by using an\n        explicit set of categories.\n\n        The ``onerror`` argument, if provided, should be a Venusian\n        ``onerror`` callback function.  The onerror function is passed to\n        :meth:`venusian.Scanner.scan` to influence error behavior when an\n        exception is raised during the scanning process.  See the\n        :term:`Venusian` documentation for more information about ``onerror``\n        callbacks.\n\n        The ``ignore`` argument, if provided, should be a Venusian ``ignore``\n        value.  Providing an ``ignore`` argument allows the scan to ignore\n        particular modules, packages, or global objects during a scan.\n        ``ignore`` can be a string or a callable, or a list containing\n        strings or callables.  The simplest usage of ``ignore`` is to provide\n        a module or package by providing a full path to its dotted name.  For\n        example: ``config.scan(ignore='my.module.subpackage')`` would ignore\n        the ``my.module.subpackage`` package during a scan, which would\n        prevent the subpackage and any of its submodules from being imported\n        and scanned.  See the :term:`Venusian` documentation for more\n        information about the ``ignore`` argument.\n\n        To perform a ``scan``, Pyramid creates a Venusian ``Scanner`` object.\n        The ``kw`` argument represents a set of keyword arguments to pass to\n        the Venusian ``Scanner`` object's constructor.  See the\n        :term:`venusian` documentation (its ``Scanner`` class) for more\n        information about the constructor.  By default, the only keyword\n        arguments passed to the Scanner constructor are ``{'config':self}``\n        where ``self`` is this configurator object.  This services the\n        requirement of all built-in Pyramid decorators, but extension systems\n        may require additional arguments.  Providing this argument is not\n        often necessary; it's an advanced usage.\n\n        .. versionadded:: 1.1\n           The ``**kw`` argument.\n\n        .. versionadded:: 1.3\n           The ``ignore`` argument.\n\n        \"\"\"\n        package = self.maybe_dotted(package)\n        if package is None: # pragma: no cover\n            package = caller_package()\n\n        ctorkw = {'config': self}\n        ctorkw.update(kw)\n\n        scanner = self.venusian.Scanner(**ctorkw)\n\n        scanner.scan(package, categories=categories, onerror=onerror,\n                     ignore=ignore)\n\n    def make_wsgi_app(self):\n        \"\"\" Commits any pending configuration statements, sends a\n        :class:`pyramid.events.ApplicationCreated` event to all listeners,\n        adds this configuration's registry to\n        :attr:`pyramid.config.global_registries`, and returns a\n        :app:`Pyramid` WSGI application representing the committed\n        configuration state.\"\"\"\n        self.commit()\n        app = Router(self.registry)\n\n        # Allow tools like \"pshell development.ini\" to find the 'last'\n        # registry configured.\n        global_registries.add(self.registry)\n\n        # Push the registry onto the stack in case any code that depends on\n        # the registry threadlocal APIs used in listeners subscribed to the\n        # IApplicationCreated event.\n        self.begin()\n        try:\n            self.registry.notify(ApplicationCreated(app))\n        finally:\n            self.end()\n\n        return app\n\n\n# this class is licensed under the ZPL (stolen from Zope)\nclass ActionState(object):\n    def __init__(self):\n        # NB \"actions\" is an API, dep'd upon by pyramid_zcml's load_zcml func\n        self.actions = []\n        self._seen_files = set()\n\n    def processSpec(self, spec):\n        \"\"\"Check whether a callable needs to be processed.  The ``spec``\n        refers to a unique identifier for the callable.\n\n        Return True if processing is needed and False otherwise. If\n        the callable needs to be processed, it will be marked as\n        processed, assuming that the caller will procces the callable if\n        it needs to be processed.\n        \"\"\"\n        if spec in self._seen_files:\n            return False\n        self._seen_files.add(spec)\n        return True\n\n    def action(self, discriminator, callable=None, args=(), kw=None, order=0,\n               includepath=(), info=None, introspectables=(), **extra):\n        \"\"\"Add an action with the given discriminator, callable and arguments\n        \"\"\"\n        if kw is None:\n            kw = {}\n        action = extra\n        action.update(\n            dict(\n                discriminator=discriminator,\n                callable=callable,\n                args=args,\n                kw=kw,\n                includepath=includepath,\n                info=info,\n                order=order,\n                introspectables=introspectables,\n                )\n            )\n        self.actions.append(action)\n\n    def execute_actions(self, clear=True, introspector=None):\n        \"\"\"Execute the configuration actions\n\n        This calls the action callables after resolving conflicts\n\n        For example:\n\n        >>> output = []\n        >>> def f(*a, **k):\n        ...    output.append(('f', a, k))\n        >>> context = ActionState()\n        >>> context.actions = [\n        ...   (1, f, (1,)),\n        ...   (1, f, (11,), {}, ('x', )),\n        ...   (2, f, (2,)),\n        ...   ]\n        >>> context.execute_actions()\n        >>> output\n        [('f', (1,), {}), ('f', (2,), {})]\n\n        If the action raises an error, we convert it to a\n        ConfigurationExecutionError.\n\n        >>> output = []\n        >>> def bad():\n        ...    bad.xxx\n        >>> context.actions = [\n        ...   (1, f, (1,)),\n        ...   (1, f, (11,), {}, ('x', )),\n        ...   (2, f, (2,)),\n        ...   (3, bad, (), {}, (), 'oops')\n        ...   ]\n        >>> try:\n        ...    v = context.execute_actions()\n        ... except ConfigurationExecutionError, v:\n        ...    pass\n        >>> print(v)\n        exceptions.AttributeError: 'function' object has no attribute 'xxx'\n          in:\n          oops\n\n        Note that actions executed before the error still have an effect:\n\n        >>> output\n        [('f', (1,), {}), ('f', (2,), {})]\n\n        The execution is re-entrant such that actions may be added by other\n        actions with the one caveat that the order of any added actions must\n        be equal to or larger than the current action.\n\n        >>> output = []\n        >>> def f(*a, **k):\n        ...   output.append(('f', a, k))\n        ...   context.actions.append((3, g, (8,), {}))\n        >>> def g(*a, **k):\n        ...    output.append(('g', a, k))\n        >>> context.actions = [\n        ...   (1, f, (1,)),\n        ...   ]\n        >>> context.execute_actions()\n        >>> output\n        [('f', (1,), {}), ('g', (8,), {})]\n\n        \"\"\"\n        try:\n            all_actions = []\n            executed_actions = []\n            action_iter = iter([])\n            conflict_state = ConflictResolverState()\n\n            while True:\n                # We clear the actions list prior to execution so if there\n                # are some new actions then we add them to the mix and resolve\n                # conflicts again. This orders the new actions as well as\n                # ensures that the previously executed actions have no new\n                # conflicts.\n                if self.actions:\n                    all_actions.extend(self.actions)\n                    action_iter = resolveConflicts(\n                        self.actions,\n                        state=conflict_state,\n                    )\n                    self.actions = []\n\n                action = next(action_iter, None)\n                if action is None:\n                    # we are done!\n                    break\n\n                callable = action['callable']\n                args = action['args']\n                kw = action['kw']\n                info = action['info']\n                # we use \"get\" below in case an action was added via a ZCML\n                # directive that did not know about introspectables\n                introspectables = action.get('introspectables', ())\n\n                try:\n                    if callable is not None:\n                        callable(*args, **kw)\n                except Exception:\n                    t, v, tb = sys.exc_info()\n                    try:\n                        reraise(ConfigurationExecutionError,\n                                ConfigurationExecutionError(t, v, info),\n                                tb)\n                    finally:\n                        del t, v, tb\n\n                if introspector is not None:\n                    for introspectable in introspectables:\n                        introspectable.register(introspector, info)\n\n                executed_actions.append(action)\n\n            self.actions = all_actions\n            return executed_actions\n\n        finally:\n            if clear:\n                self.actions = []\n\n\nclass ConflictResolverState(object):\n    def __init__(self):\n        # keep a set of resolved discriminators to test against to ensure\n        # that a new action does not conflict with something already executed\n        self.resolved_ainfos = {}\n\n        # actions left over from a previous iteration\n        self.remaining_actions = []\n\n        # after executing an action we memoize its order to avoid any new\n        # actions sending us backward\n        self.min_order = None\n\n        # unique tracks the index of the action so we need it to increase\n        # monotonically across invocations to resolveConflicts\n        self.start = 0\n\n\n# this function is licensed under the ZPL (stolen from Zope)\ndef resolveConflicts(actions, state=None):\n    \"\"\"Resolve conflicting actions\n\n    Given an actions list, identify and try to resolve conflicting actions.\n    Actions conflict if they have the same non-None discriminator.\n\n    Conflicting actions can be resolved if the include path of one of\n    the actions is a prefix of the includepaths of the other\n    conflicting actions and is unequal to the include paths in the\n    other conflicting actions.\n\n    Actions are resolved on a per-order basis because some discriminators\n    cannot be computed until earlier actions have executed. An action in an\n    earlier order may execute successfully only to find out later that it was\n    overridden by another action with a smaller include path. This will result\n    in a conflict as there is no way to revert the original action.\n\n    ``state`` may be an instance of ``ConflictResolverState`` that\n    can be used to resume execution and resolve the new actions against the\n    list of executed actions from a previous call.\n\n    \"\"\"\n    if state is None:\n        state = ConflictResolverState()\n\n    # pick up where we left off last time, but track the new actions as well\n    state.remaining_actions.extend(normalize_actions(actions))\n    actions = state.remaining_actions\n\n    def orderandpos(v):\n        n, v = v\n        return (v['order'] or 0, n)\n\n    def orderonly(v):\n        n, v = v\n        return v['order'] or 0\n\n    sactions = sorted(enumerate(actions, start=state.start), key=orderandpos)\n    for order, actiongroup in itertools.groupby(sactions, orderonly):\n        # \"order\" is an integer grouping. Actions in a lower order will be\n        # executed before actions in a higher order.  All of the actions in\n        # one grouping will be executed (its callable, if any will be called)\n        # before any of the actions in the next.\n        output = []\n        unique = {}\n\n        # error out if we went backward in order\n        if state.min_order is not None and order < state.min_order:\n            r = ['Actions were added to order={0} after execution had moved '\n                 'on to order={1}. Conflicting actions: '\n                 .format(order, state.min_order)]\n            for i, action in actiongroup:\n                for line in str(action['info']).rstrip().split('\\n'):\n                    r.append(\"  \" + line)\n            raise ConfigurationError('\\n'.join(r))\n\n        for i, action in actiongroup:\n            # Within an order, actions are executed sequentially based on\n            # original action ordering (\"i\").\n\n            # \"ainfo\" is a tuple of (i, action) where \"i\" is an integer\n            # expressing the relative position of this action in the action\n            # list being resolved, and \"action\" is an action dictionary.  The\n            # purpose of an ainfo is to associate an \"i\" with a particular\n            # action; \"i\" exists for sorting after conflict resolution.\n            ainfo = (i, action)\n\n            # wait to defer discriminators until we are on their order because\n            # the discriminator may depend on state from a previous order\n            discriminator = undefer(action['discriminator'])\n            action['discriminator'] = discriminator\n\n            if discriminator is None:\n                # The discriminator is None, so this action can never conflict.\n                # We can add it directly to the result.\n                output.append(ainfo)\n                continue\n\n            L = unique.setdefault(discriminator, [])\n            L.append(ainfo)\n\n        # Check for conflicts\n        conflicts = {}\n        for discriminator, ainfos in unique.items():\n            # We use (includepath, i) as a sort key because we need to\n            # sort the actions by the paths so that the shortest path with a\n            # given prefix comes first.  The \"first\" action is the one with the\n            # shortest include path.  We break sorting ties using \"i\".\n            def bypath(ainfo):\n                path, i = ainfo[1]['includepath'], ainfo[0]\n                return path, order, i\n\n            ainfos.sort(key=bypath)\n            ainfo, rest = ainfos[0], ainfos[1:]\n            _, action = ainfo\n\n            # ensure this new action does not conflict with a previously\n            # resolved action from an earlier order / invocation\n            prev_ainfo = state.resolved_ainfos.get(discriminator)\n            if prev_ainfo is not None:\n                _, paction = prev_ainfo\n                basepath, baseinfo = paction['includepath'], paction['info']\n                includepath = action['includepath']\n                # if the new action conflicts with the resolved action then\n                # note the conflict, otherwise drop the action as it's\n                # effectively overriden by the previous action\n                if (includepath[:len(basepath)] != basepath or\n                        includepath == basepath):\n                    L = conflicts.setdefault(discriminator, [baseinfo])\n                    L.append(action['info'])\n\n            else:\n                output.append(ainfo)\n\n            basepath, baseinfo = action['includepath'], action['info']\n            for _, action in rest:\n                includepath = action['includepath']\n                # Test whether path is a prefix of opath\n                if (includepath[:len(basepath)] != basepath or  # not a prefix\n                        includepath == basepath):\n                    L = conflicts.setdefault(discriminator, [baseinfo])\n                    L.append(action['info'])\n\n        if conflicts:\n            raise ConfigurationConflictError(conflicts)\n\n        # sort resolved actions by \"i\" and yield them one by one\n        for i, action in sorted(output, key=operator.itemgetter(0)):\n            # do not memoize the order until we resolve an action inside it\n            state.min_order = action['order']\n            state.start = i + 1\n            state.remaining_actions.remove(action)\n            state.resolved_ainfos[action['discriminator']] = (i, action)\n            yield action\n\n\ndef normalize_actions(actions):\n    \"\"\"Convert old-style tuple actions to new-style dicts.\"\"\"\n    result = []\n    for v in actions:\n        if not isinstance(v, dict):\n            v = expand_action_tuple(*v)\n        result.append(v)\n    return result\n\n\ndef expand_action_tuple(\n    discriminator, callable=None, args=(), kw=None, includepath=(),\n    info=None, order=0, introspectables=(),\n):\n    if kw is None:\n        kw = {}\n    return dict(\n        discriminator=discriminator,\n        callable=callable,\n        args=args,\n        kw=kw,\n        includepath=includepath,\n        info=info,\n        order=order,\n        introspectables=introspectables,\n        )\n\n\nglobal_registries = WeakOrderedSet()\n",
            "header": {
                "file": {
                    "path": "pyramid/config/__init__.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "304d3a85e",
                "new_commit_hash": "6c661aa59",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/pyramid/config/__init__.py"
            },
            "plus_file": {
                "path": "b/pyramid/config/__init__.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 753,
                            "length": 6
                        },
                        "new_range": {
                            "start": 753,
                            "length": 11
                        },
                        "section": "class Configurator("
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        .. versionadded:: 1.2",
                                "type": "context"
                            },
                            {
                                "content": "           The ``route_prefix`` parameter.",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        .. versionchanged:: 1.9",
                                "type": "added"
                            },
                            {
                                "content": "           The included function is wrapped with a call to",
                                "type": "added"
                            },
                            {
                                "content": "           :meth:`pyramid.config.Configurator.begin` and",
                                "type": "added"
                            },
                            {
                                "content": "           :meth:`pyramid.config.Configurator.end` while it is executed.",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        \"\"\"",
                                "type": "context"
                            },
                            {
                                "content": "        # \"\"\" <-- emacs",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "pyramid/config/__init__.py",
                            "type": "class",
                            "name": "Configurator",
                            "content": "class Configurator(\n    TestingConfiguratorMixin,\n    TweensConfiguratorMixin,\n    SecurityConfiguratorMixin,\n    ViewsConfiguratorMixin,\n    RoutesConfiguratorMixin,\n    ZCAConfiguratorMixin,\n    I18NConfiguratorMixin,\n    RenderingConfiguratorMixin,\n    AssetsConfiguratorMixin,\n    SettingsConfiguratorMixin,\n    FactoriesConfiguratorMixin,\n    AdaptersConfiguratorMixin,\n    ):\n    \"\"\"\n    A Configurator is used to configure a :app:`Pyramid`\n    :term:`application registry`.\n\n    If the ``registry`` argument is not ``None``, it must\n    be an instance of the :class:`pyramid.registry.Registry` class\n    representing the registry to configure.  If ``registry`` is ``None``, the\n    configurator will create a :class:`pyramid.registry.Registry` instance\n    itself; it will also perform some default configuration that would not\n    otherwise be done.  After its construction, the configurator may be used\n    to add further configuration to the registry.\n\n    .. warning:: If ``registry`` is assigned the above-mentioned class\n       instance, all other constructor arguments are ignored,\n       with the exception of ``package``.\n\n    If the ``package`` argument is passed, it must be a reference to a Python\n    :term:`package` (e.g. ``sys.modules['thepackage']``) or a :term:`dotted\n    Python name` to the same.  This value is used as a basis to convert\n    relative paths passed to various configuration methods, such as methods\n    which accept a ``renderer`` argument, into absolute paths.  If ``None``\n    is passed (the default), the package is assumed to be the Python package\n    in which the *caller* of the ``Configurator`` constructor lives.\n\n    If the ``root_package`` is passed, it will propagate through the\n    configuration hierarchy as a way for included packages to locate\n    resources relative to the package in which the main ``Configurator`` was\n    created. If ``None`` is passed (the default), the ``root_package`` will\n    be derived from the ``package`` argument. The ``package`` attribute is\n    always pointing at the package being included when using :meth:`.include`,\n    whereas the ``root_package`` does not change.\n\n    If the ``settings`` argument is passed, it should be a Python dictionary\n    representing the :term:`deployment settings` for this application.  These\n    are later retrievable using the\n    :attr:`pyramid.registry.Registry.settings` attribute (aka\n    ``request.registry.settings``).\n\n    If the ``root_factory`` argument is passed, it should be an object\n    representing the default :term:`root factory` for your application or a\n    :term:`dotted Python name` to the same.  If it is ``None``, a default\n    root factory will be used.\n\n    If ``authentication_policy`` is passed, it should be an instance\n    of an :term:`authentication policy` or a :term:`dotted Python\n    name` to the same.\n\n    If ``authorization_policy`` is passed, it should be an instance of\n    an :term:`authorization policy` or a :term:`dotted Python name` to\n    the same.\n\n    .. note:: A ``ConfigurationError`` will be raised when an\n       authorization policy is supplied without also supplying an\n       authentication policy (authorization requires authentication).\n\n    If ``renderers`` is ``None`` (the default), a default set of\n    :term:`renderer` factories is used. Else, it should be a list of\n    tuples representing a set of renderer factories which should be\n    configured into this application, and each tuple representing a set of\n    positional values that should be passed to\n    :meth:`pyramid.config.Configurator.add_renderer`.\n\n    If ``debug_logger`` is not passed, a default debug logger that logs to a\n    logger will be used (the logger name will be the package name of the\n    *caller* of this configurator).  If it is passed, it should be an\n    instance of the :class:`logging.Logger` (PEP 282) standard library class\n    or a Python logger name.  The debug logger is used by :app:`Pyramid`\n    itself to log warnings and authorization debugging information.\n\n    If ``locale_negotiator`` is passed, it should be a :term:`locale\n    negotiator` implementation or a :term:`dotted Python name` to\n    same.  See :ref:`custom_locale_negotiator`.\n\n    If ``request_factory`` is passed, it should be a :term:`request\n    factory` implementation or a :term:`dotted Python name` to the same.\n    See :ref:`changing_the_request_factory`.  By default it is ``None``,\n    which means use the default request factory.\n\n    If ``response_factory`` is passed, it should be a :term:`response\n    factory` implementation or a :term:`dotted Python name` to the same.\n    See :ref:`changing_the_response_factory`.  By default it is ``None``,\n    which means use the default response factory.\n\n    If ``default_permission`` is passed, it should be a\n    :term:`permission` string to be used as the default permission for\n    all view configuration registrations performed against this\n    Configurator.  An example of a permission string:``'view'``.\n    Adding a default permission makes it unnecessary to protect each\n    view configuration with an explicit permission, unless your\n    application policy requires some exception for a particular view.\n    By default, ``default_permission`` is ``None``, meaning that view\n    configurations which do not explicitly declare a permission will\n    always be executable by entirely anonymous users (any\n    authorization policy in effect is ignored).\n\n    .. seealso::\n\n        See also :ref:`setting_a_default_permission`.\n\n    If ``session_factory`` is passed, it should be an object which\n    implements the :term:`session factory` interface.  If a nondefault\n    value is passed, the ``session_factory`` will be used to create a\n    session object when ``request.session`` is accessed.  Note that\n    the same outcome can be achieved by calling\n    :meth:`pyramid.config.Configurator.set_session_factory`.  By\n    default, this argument is ``None``, indicating that no session\n    factory will be configured (and thus accessing ``request.session``\n    will throw an error) unless ``set_session_factory`` is called later\n    during configuration.\n\n    If ``autocommit`` is ``True``, every method called on the configurator\n    will cause an immediate action, and no configuration conflict detection\n    will be used. If ``autocommit`` is ``False``, most methods of the\n    configurator will defer their action until\n    :meth:`pyramid.config.Configurator.commit` is called.  When\n    :meth:`pyramid.config.Configurator.commit` is called, the actions implied\n    by the called methods will be checked for configuration conflicts unless\n    ``autocommit`` is ``True``.  If a conflict is detected, a\n    ``ConfigurationConflictError`` will be raised.  Calling\n    :meth:`pyramid.config.Configurator.make_wsgi_app` always implies a final\n    commit.\n\n    If ``default_view_mapper`` is passed, it will be used as the default\n    :term:`view mapper` factory for view configurations that don't otherwise\n    specify one (see :class:`pyramid.interfaces.IViewMapperFactory`).  If\n    ``default_view_mapper`` is not passed, a superdefault view mapper will be\n    used.\n\n    If ``exceptionresponse_view`` is passed, it must be a :term:`view\n    callable` or ``None``.  If it is a view callable, it will be used as an\n    exception view callable when an :term:`exception response` is raised. If\n    ``exceptionresponse_view`` is ``None``, no exception response view will\n    be registered, and all raised exception responses will be bubbled up to\n    Pyramid's caller.  By\n    default, the ``pyramid.httpexceptions.default_exceptionresponse_view``\n    function is used as the ``exceptionresponse_view``.\n\n    If ``route_prefix`` is passed, all routes added with\n    :meth:`pyramid.config.Configurator.add_route` will have the specified path\n    prepended to their pattern.\n\n    If ``introspection`` is passed, it must be a boolean value.  If it's\n    ``True``, introspection values during actions will be kept for use\n    for tools like the debug toolbar.  If it's ``False``, introspection\n    values provided by registrations will be ignored.  By default, it is\n    ``True``.\n\n    .. versionadded:: 1.1\n       The ``exceptionresponse_view`` argument.\n\n    .. versionadded:: 1.2\n       The ``route_prefix`` argument.\n\n    .. versionadded:: 1.3\n       The ``introspection`` argument.\n\n    .. versionadded:: 1.6\n       The ``root_package`` argument.\n       The ``response_factory`` argument.\n    \"\"\"\n    manager = manager # for testing injection\n    venusian = venusian # for testing injection\n    _ainfo = None\n    basepath = None\n    includepath = ()\n    info = ''\n    object_description = staticmethod(object_description)\n    introspectable = Introspectable\n    inspect = inspect\n\n    def __init__(self,\n                 registry=None,\n                 package=None,\n                 settings=None,\n                 root_factory=None,\n                 authentication_policy=None,\n                 authorization_policy=None,\n                 renderers=None,\n                 debug_logger=None,\n                 locale_negotiator=None,\n                 request_factory=None,\n                 response_factory=None,\n                 default_permission=None,\n                 session_factory=None,\n                 default_view_mapper=None,\n                 autocommit=False,\n                 exceptionresponse_view=default_exceptionresponse_view,\n                 route_prefix=None,\n                 introspection=True,\n                 root_package=None,\n                 ):\n        if package is None:\n            package = caller_package()\n        if root_package is None:\n            root_package = package\n        name_resolver = DottedNameResolver(package)\n        self.name_resolver = name_resolver\n        self.package_name = name_resolver.get_package_name()\n        self.package = name_resolver.get_package()\n        self.root_package = root_package\n        self.registry = registry\n        self.autocommit = autocommit\n        self.route_prefix = route_prefix\n        self.introspection = introspection\n        if registry is None:\n            registry = Registry(self.package_name)\n            self.registry = registry\n            self.setup_registry(\n                settings=settings,\n                root_factory=root_factory,\n                authentication_policy=authentication_policy,\n                authorization_policy=authorization_policy,\n                renderers=renderers,\n                debug_logger=debug_logger,\n                locale_negotiator=locale_negotiator,\n                request_factory=request_factory,\n                response_factory=response_factory,\n                default_permission=default_permission,\n                session_factory=session_factory,\n                default_view_mapper=default_view_mapper,\n                exceptionresponse_view=exceptionresponse_view,\n                )\n\n    def setup_registry(self,\n                       settings=None,\n                       root_factory=None,\n                       authentication_policy=None,\n                       authorization_policy=None,\n                       renderers=None,\n                       debug_logger=None,\n                       locale_negotiator=None,\n                       request_factory=None,\n                       response_factory=None,\n                       default_permission=None,\n                       session_factory=None,\n                       default_view_mapper=None,\n                       exceptionresponse_view=default_exceptionresponse_view,\n                       ):\n        \"\"\" When you pass a non-``None`` ``registry`` argument to the\n        :term:`Configurator` constructor, no initial setup is performed\n        against the registry.  This is because the registry you pass in may\n        have already been initialized for use under :app:`Pyramid` via a\n        different configurator.  However, in some circumstances (such as when\n        you want to use a global registry instead of a registry created as a\n        result of the Configurator constructor), or when you want to reset\n        the initial setup of a registry, you *do* want to explicitly\n        initialize the registry associated with a Configurator for use under\n        :app:`Pyramid`.  Use ``setup_registry`` to do this initialization.\n\n        ``setup_registry`` configures settings, a root factory, security\n        policies, renderers, a debug logger, a locale negotiator, and various\n        other settings using the configurator's current registry, as per the\n        descriptions in the Configurator constructor.\"\"\"\n\n        registry = self.registry\n\n        self._fix_registry()\n\n        self._set_settings(settings)\n\n        if isinstance(debug_logger, string_types):\n            debug_logger = logging.getLogger(debug_logger)\n\n        if debug_logger is None:\n            debug_logger = logging.getLogger(self.package_name)\n\n        registry.registerUtility(debug_logger, IDebugLogger)\n\n        self.add_default_response_adapters()\n        self.add_default_renderers()\n        self.add_default_view_predicates()\n        self.add_default_view_derivers()\n        self.add_default_route_predicates()\n        self.add_default_tweens()\n\n        if exceptionresponse_view is not None:\n            exceptionresponse_view = self.maybe_dotted(exceptionresponse_view)\n            self.add_view(exceptionresponse_view, context=IExceptionResponse)\n            self.add_view(exceptionresponse_view,context=WebobWSGIHTTPException)\n\n        # commit below because:\n        #\n        # - the default exceptionresponse_view requires the superdefault view\n        #   mapper, so we need to configure it before adding default_view_mapper\n        #\n        # - superdefault renderers should be overrideable without requiring\n        #   the user to commit before calling config.add_renderer\n\n        self.commit()\n\n        # self.commit() should not be called within this method after this\n        # point because the following registrations should be treated as\n        # analogues of methods called by the user after configurator\n        # construction.  Rationale: user-supplied implementations should be\n        # preferred rather than add-on author implementations with the help of\n        # automatic conflict resolution.\n\n        if authentication_policy and not authorization_policy:\n            authorization_policy = ACLAuthorizationPolicy() # default\n\n        if authorization_policy:\n            self.set_authorization_policy(authorization_policy)\n\n        if authentication_policy:\n            self.set_authentication_policy(authentication_policy)\n\n        if default_view_mapper is not None:\n            self.set_view_mapper(default_view_mapper)\n\n        if renderers:\n            for name, renderer in renderers:\n                self.add_renderer(name, renderer)\n\n        if root_factory is not None:\n            self.set_root_factory(root_factory)\n\n        if locale_negotiator:\n            self.set_locale_negotiator(locale_negotiator)\n\n        if request_factory:\n            self.set_request_factory(request_factory)\n\n        if response_factory:\n            self.set_response_factory(response_factory)\n\n        if default_permission:\n            self.set_default_permission(default_permission)\n\n        if session_factory is not None:\n            self.set_session_factory(session_factory)\n\n        tweens = aslist(registry.settings.get('pyramid.tweens', []))\n        for factory in tweens:\n            self._add_tween(factory, explicit=True)\n\n        includes = aslist(registry.settings.get('pyramid.includes', []))\n        for inc in includes:\n            self.include(inc)\n\n    def _make_spec(self, path_or_spec):\n        package, filename = resolve_asset_spec(path_or_spec, self.package_name)\n        if package is None:\n            return filename # absolute filename\n        return '%s:%s' % (package, filename)\n\n    def _fix_registry(self):\n        \"\"\" Fix up a ZCA component registry that is not a\n        pyramid.registry.Registry by adding analogues of ``has_listeners``,\n        ``notify``, ``queryAdapterOrSelf``, and ``registerSelfAdapter``\n        through monkey-patching.\"\"\"\n\n        _registry = self.registry\n\n        if not hasattr(_registry, 'notify'):\n            def notify(*events):\n                [ _ for _ in _registry.subscribers(events, None) ]\n            _registry.notify = notify\n\n        if not hasattr(_registry, 'has_listeners'):\n            _registry.has_listeners = True\n\n        if not hasattr(_registry, 'queryAdapterOrSelf'):\n            def queryAdapterOrSelf(object, interface, default=None):\n                if not interface.providedBy(object):\n                    return _registry.queryAdapter(object, interface,\n                                                  default=default)\n                return object\n            _registry.queryAdapterOrSelf = queryAdapterOrSelf\n\n        if not hasattr(_registry, 'registerSelfAdapter'):\n            def registerSelfAdapter(required=None, provided=None,\n                                    name=empty, info=empty, event=True):\n                return _registry.registerAdapter(lambda x: x,\n                                                 required=required,\n                                                 provided=provided, name=name,\n                                                 info=info, event=event)\n            _registry.registerSelfAdapter = registerSelfAdapter\n\n        if not hasattr(_registry, '_lock'):\n            _registry._lock = threading.Lock()\n\n        if not hasattr(_registry, '_clear_view_lookup_cache'):\n            def _clear_view_lookup_cache():\n                _registry._view_lookup_cache = {}\n            _registry._clear_view_lookup_cache = _clear_view_lookup_cache\n\n\n    # API\n\n    def _get_introspector(self):\n        introspector = getattr(self.registry, 'introspector', _marker)\n        if introspector is _marker:\n            introspector = Introspector()\n            self._set_introspector(introspector)\n        return introspector\n\n    def _set_introspector(self, introspector):\n        self.registry.introspector = introspector\n\n    def _del_introspector(self):\n        del self.registry.introspector\n\n    introspector = property(\n        _get_introspector, _set_introspector, _del_introspector\n        )\n\n    def get_predlist(self, name):\n        predlist = self.registry.queryUtility(IPredicateList, name=name)\n        if predlist is None:\n            predlist = PredicateList()\n            self.registry.registerUtility(predlist, IPredicateList, name=name)\n        return predlist\n\n\n    def _add_predicate(self, type, name, factory, weighs_more_than=None,\n                       weighs_less_than=None):\n        factory = self.maybe_dotted(factory)\n        discriminator = ('%s option' % type, name)\n        intr = self.introspectable(\n            '%s predicates' % type,\n            discriminator,\n            '%s predicate named %s' % (type, name),\n            '%s predicate' % type)\n        intr['name'] = name\n        intr['factory'] = factory\n        intr['weighs_more_than'] = weighs_more_than\n        intr['weighs_less_than'] = weighs_less_than\n        def register():\n            predlist = self.get_predlist(type)\n            predlist.add(name, factory, weighs_more_than=weighs_more_than,\n                         weighs_less_than=weighs_less_than)\n        self.action(discriminator, register, introspectables=(intr,),\n                    order=PHASE1_CONFIG) # must be registered early\n\n    @property\n    def action_info(self):\n        info = self.info # usually a ZCML action (ParserInfo) if self.info\n        if not info:\n            # Try to provide more accurate info for conflict reports\n            if self._ainfo:\n                info = self._ainfo[0]\n            else:\n                info = ActionInfo(None, 0, '', '')\n        return info\n\n    def action(self, discriminator, callable=None, args=(), kw=None, order=0,\n               introspectables=(), **extra):\n        \"\"\" Register an action which will be executed when\n        :meth:`pyramid.config.Configurator.commit` is called (or executed\n        immediately if ``autocommit`` is ``True``).\n\n        .. warning:: This method is typically only used by :app:`Pyramid`\n           framework extension authors, not by :app:`Pyramid` application\n           developers.\n\n        The ``discriminator`` uniquely identifies the action.  It must be\n        given, but it can be ``None``, to indicate that the action never\n        conflicts.  It must be a hashable value.\n\n        The ``callable`` is a callable object which performs the task\n        associated with the action when the action is executed.  It is\n        optional.\n\n        ``args`` and ``kw`` are tuple and dict objects respectively, which\n        are passed to ``callable`` when this action is executed.  Both are\n        optional.\n\n        ``order`` is a grouping mechanism; an action with a lower order will\n        be executed before an action with a higher order (has no effect when\n        autocommit is ``True``).\n\n        ``introspectables`` is a sequence of :term:`introspectable` objects\n        (or the empty sequence if no introspectable objects are associated\n        with this action).  If this configurator's ``introspection``\n        attribute is ``False``, these introspectables will be ignored.\n\n        ``extra`` provides a facility for inserting extra keys and values\n        into an action dictionary.\n        \"\"\"\n        # catch nonhashable discriminators here; most unit tests use\n        # autocommit=False, which won't catch unhashable discriminators\n        assert hash(discriminator) \n\n        if kw is None:\n            kw = {}\n\n        autocommit = self.autocommit\n        action_info = self.action_info\n\n        if not self.introspection:\n            # if we're not introspecting, ignore any introspectables passed\n            # to us\n            introspectables = ()\n\n        if autocommit:\n            # callables can depend on the side effects of resolving a\n            # deferred discriminator\n            self.begin()\n            try:\n                undefer(discriminator)\n                if callable is not None:\n                    callable(*args, **kw)\n                for introspectable in introspectables:\n                    introspectable.register(self.introspector, action_info)\n            finally:\n                self.end()\n\n        else:\n            action = extra\n            action.update(\n                dict(\n                    discriminator=discriminator,\n                    callable=callable,\n                    args=args,\n                    kw=kw,\n                    order=order,\n                    info=action_info,\n                    includepath=self.includepath,\n                    introspectables=introspectables,\n                    )\n                )\n            self.action_state.action(**action)\n\n    def _get_action_state(self):\n        registry = self.registry\n        try:\n            state = registry.action_state\n        except AttributeError:\n            state = ActionState()\n            registry.action_state = state\n        return state\n\n    def _set_action_state(self, state):\n        self.registry.action_state = state\n\n    action_state = property(_get_action_state, _set_action_state)\n\n    _ctx = action_state # bw compat\n\n    def commit(self):\n        \"\"\" Commit any pending configuration actions. If a configuration\n        conflict is detected in the pending configuration actions, this method\n        will raise a :exc:`ConfigurationConflictError`; within the traceback\n        of this error will be information about the source of the conflict,\n        usually including file names and line numbers of the cause of the\n        configuration conflicts.\"\"\"\n        self.begin()\n        try:\n            self.action_state.execute_actions(introspector=self.introspector)\n        finally:\n            self.end()\n        self.action_state = ActionState() # old actions have been processed\n\n    def include(self, callable, route_prefix=None):\n        \"\"\"Include a configuration callable, to support imperative\n        application extensibility.\n\n        .. warning:: In versions of :app:`Pyramid` prior to 1.2, this\n            function accepted ``*callables``, but this has been changed\n            to support only a single callable.\n\n        A configuration callable should be a callable that accepts a single\n        argument named ``config``, which will be an instance of a\n        :term:`Configurator`.  However, be warned that it will not be the same\n        configurator instance on which you call this method.  The\n        code which runs as a result of calling the callable should invoke\n        methods on the configurator passed to it which add configuration\n        state.  The return value of a callable will be ignored.\n\n        Values allowed to be presented via the ``callable`` argument to\n        this method: any callable Python object or any :term:`dotted Python\n        name` which resolves to a callable Python object.  It may also be a\n        Python :term:`module`, in which case, the module will be searched for\n        a callable named ``includeme``, which will be treated as the\n        configuration callable.\n\n        For example, if the ``includeme`` function below lives in a module\n        named ``myapp.myconfig``:\n\n        .. code-block:: python\n           :linenos:\n\n           # myapp.myconfig module\n\n           def my_view(request):\n               from pyramid.response import Response\n               return Response('OK')\n\n           def includeme(config):\n               config.add_view(my_view)\n\n        You might cause it to be included within your Pyramid application like\n        so:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include('myapp.myconfig.includeme')\n\n        Because the function is named ``includeme``, the function name can\n        also be omitted from the dotted name reference:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include('myapp.myconfig')\n\n        Included configuration statements will be overridden by local\n        configuration statements if an included callable causes a\n        configuration conflict by registering something with the same\n        configuration parameters.\n\n        If the ``route_prefix`` is supplied, it must be a string.  Any calls\n        to :meth:`pyramid.config.Configurator.add_route` within the included\n        callable will have their pattern prefixed with the value of\n        ``route_prefix``. This can be used to help mount a set of routes at a\n        different location than the included callable's author intended, while\n        still maintaining the same route names.  For example:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def included(config):\n               config.add_route('show_users', '/show')\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include(included, route_prefix='/users')\n\n        In the above configuration, the ``show_users`` route will have an\n        effective route pattern of ``/users/show``, instead of ``/show``\n        because the ``route_prefix`` argument will be prepended to the\n        pattern.\n\n        .. versionadded:: 1.2\n           The ``route_prefix`` parameter.\n\n        .. versionchanged:: 1.9\n           The included function is wrapped with a call to\n           :meth:`pyramid.config.Configurator.begin` and\n           :meth:`pyramid.config.Configurator.end` while it is executed.\n\n        \"\"\"\n        # \"\"\" <-- emacs\n\n        action_state = self.action_state\n\n        if route_prefix is None:\n            route_prefix = ''\n\n        old_route_prefix = self.route_prefix\n        if old_route_prefix is None:\n            old_route_prefix = ''\n\n        route_prefix = '%s/%s' % (\n            old_route_prefix.rstrip('/'),\n            route_prefix.lstrip('/')\n            )\n        route_prefix = route_prefix.strip('/')\n        if not route_prefix:\n            route_prefix = None\n\n        c = self.maybe_dotted(callable)\n        module = self.inspect.getmodule(c)\n        if module is c:\n            try:\n                c = getattr(module, 'includeme')\n            except AttributeError:\n                raise ConfigurationError(\n                    \"module %r has no attribute 'includeme'\" % (module.__name__)\n                    )\n                                                       \n        spec = module.__name__ + ':' + c.__name__\n        sourcefile = self.inspect.getsourcefile(c)\n\n        if sourcefile is None:\n            raise ConfigurationError(\n                'No source file for module %r (.py file must exist, '\n                'refusing to use orphan .pyc or .pyo file).' % module.__name__)\n            \n\n        if action_state.processSpec(spec):\n            configurator = self.__class__(\n                registry=self.registry,\n                package=package_of(module),\n                root_package=self.root_package,\n                autocommit=self.autocommit,\n                route_prefix=route_prefix,\n                )\n            configurator.basepath = os.path.dirname(sourcefile)\n            configurator.includepath = self.includepath + (spec,)\n            self.begin()\n            try:\n                c(configurator)\n            finally:\n                self.end()\n\n    def add_directive(self, name, directive, action_wrap=True):\n        \"\"\"\n        Add a directive method to the configurator.\n\n        .. warning:: This method is typically only used by :app:`Pyramid`\n           framework extension authors, not by :app:`Pyramid` application\n           developers.\n\n        Framework extenders can add directive methods to a configurator by\n        instructing their users to call ``config.add_directive('somename',\n        'some.callable')``.  This will make ``some.callable`` accessible as\n        ``config.somename``.  ``some.callable`` should be a function which\n        accepts ``config`` as a first argument, and arbitrary positional and\n        keyword arguments following.  It should use config.action as\n        necessary to perform actions.  Directive methods can then be invoked\n        like 'built-in' directives such as ``add_view``, ``add_route``, etc.\n\n        The ``action_wrap`` argument should be ``True`` for directives which\n        perform ``config.action`` with potentially conflicting\n        discriminators.  ``action_wrap`` will cause the directive to be\n        wrapped in a decorator which provides more accurate conflict\n        cause information.\n\n        ``add_directive`` does not participate in conflict detection, and\n        later calls to ``add_directive`` will override earlier calls.\n        \"\"\"\n        c = self.maybe_dotted(directive)\n        if not hasattr(self.registry, '_directives'):\n            self.registry._directives = {}\n        self.registry._directives[name] = (c, action_wrap)\n\n    def __getattr__(self, name):\n        # allow directive extension names to work\n        directives = getattr(self.registry, '_directives', {})\n        c = directives.get(name)\n        if c is None:\n            raise AttributeError(name)\n        c, action_wrap = c\n        if action_wrap:\n            c = action_method(c)\n        # Create a bound method (works on both Py2 and Py3)\n        # http://stackoverflow.com/a/1015405/209039\n        m = c.__get__(self, self.__class__)\n        return m\n\n    def with_package(self, package):\n        \"\"\" Return a new Configurator instance with the same registry\n        as this configurator. ``package`` may be an actual Python package\n        object or a :term:`dotted Python name` representing a package.\"\"\"\n        configurator = self.__class__(\n            registry=self.registry,\n            package=package,\n            root_package=self.root_package,\n            autocommit=self.autocommit,\n            route_prefix=self.route_prefix,\n            introspection=self.introspection,\n            )\n        configurator.basepath = self.basepath\n        configurator.includepath = self.includepath\n        configurator.info = self.info\n        return configurator\n\n    def maybe_dotted(self, dotted):\n        \"\"\" Resolve the :term:`dotted Python name` ``dotted`` to a\n        global Python object.  If ``dotted`` is not a string, return\n        it without attempting to do any name resolution.  If\n        ``dotted`` is a relative dotted name (e.g. ``.foo.bar``,\n        consider it relative to the ``package`` argument supplied to\n        this Configurator's constructor.\"\"\"\n        return self.name_resolver.maybe_resolve(dotted)\n\n    def absolute_asset_spec(self, relative_spec):\n        \"\"\" Resolve the potentially relative :term:`asset\n        specification` string passed as ``relative_spec`` into an\n        absolute asset specification string and return the string.\n        Use the ``package`` of this configurator as the package to\n        which the asset specification will be considered relative\n        when generating an absolute asset specification.  If the\n        provided ``relative_spec`` argument is already absolute, or if\n        the ``relative_spec`` is not a string, it is simply returned.\"\"\"\n        if not isinstance(relative_spec, string_types):\n            return relative_spec\n        return self._make_spec(relative_spec)\n\n    absolute_resource_spec = absolute_asset_spec # b/w compat forever\n\n    def begin(self, request=_marker):\n        \"\"\" Indicate that application or test configuration has begun.\n        This pushes a dictionary containing the :term:`application\n        registry` implied by ``registry`` attribute of this\n        configurator and the :term:`request` implied by the\n        ``request`` argument onto the :term:`thread local` stack\n        consulted by various :mod:`pyramid.threadlocal` API\n        functions.\n\n        If ``request`` is not specified and the registry owned by the\n        configurator is already pushed as the current threadlocal registry\n        then this method will keep the current threadlocal request unchanged.\n\n        .. versionchanged:: 1.8\n           The current threadlocal request is propagated if the current\n           threadlocal registry remains unchanged.\n\n        \"\"\"\n        if request is _marker:\n            current = self.manager.get()\n            if current['registry'] == self.registry:\n                request = current['request']\n            else:\n                request = None\n        self.manager.push({'registry':self.registry, 'request':request})\n\n    def end(self):\n        \"\"\" Indicate that application or test configuration has ended.\n        This pops the last value pushed onto the :term:`thread local`\n        stack (usually by the ``begin`` method) and returns that\n        value.\n        \"\"\"\n        return self.manager.pop()\n\n    # this is *not* an action method (uses caller_package)\n    def scan(self, package=None, categories=None, onerror=None, ignore=None,\n             **kw):\n        \"\"\"Scan a Python package and any of its subpackages for objects\n        marked with :term:`configuration decoration` such as\n        :class:`pyramid.view.view_config`.  Any decorated object found will\n        influence the current configuration state.\n\n        The ``package`` argument should be a Python :term:`package` or module\n        object (or a :term:`dotted Python name` which refers to such a\n        package or module).  If ``package`` is ``None``, the package of the\n        *caller* is used.\n\n        The ``categories`` argument, if provided, should be the\n        :term:`Venusian` 'scan categories' to use during scanning.  Providing\n        this argument is not often necessary; specifying scan categories is\n        an extremely advanced usage.  By default, ``categories`` is ``None``\n        which will execute *all* Venusian decorator callbacks including\n        :app:`Pyramid`-related decorators such as\n        :class:`pyramid.view.view_config`.  See the :term:`Venusian`\n        documentation for more information about limiting a scan by using an\n        explicit set of categories.\n\n        The ``onerror`` argument, if provided, should be a Venusian\n        ``onerror`` callback function.  The onerror function is passed to\n        :meth:`venusian.Scanner.scan` to influence error behavior when an\n        exception is raised during the scanning process.  See the\n        :term:`Venusian` documentation for more information about ``onerror``\n        callbacks.\n\n        The ``ignore`` argument, if provided, should be a Venusian ``ignore``\n        value.  Providing an ``ignore`` argument allows the scan to ignore\n        particular modules, packages, or global objects during a scan.\n        ``ignore`` can be a string or a callable, or a list containing\n        strings or callables.  The simplest usage of ``ignore`` is to provide\n        a module or package by providing a full path to its dotted name.  For\n        example: ``config.scan(ignore='my.module.subpackage')`` would ignore\n        the ``my.module.subpackage`` package during a scan, which would\n        prevent the subpackage and any of its submodules from being imported\n        and scanned.  See the :term:`Venusian` documentation for more\n        information about the ``ignore`` argument.\n\n        To perform a ``scan``, Pyramid creates a Venusian ``Scanner`` object.\n        The ``kw`` argument represents a set of keyword arguments to pass to\n        the Venusian ``Scanner`` object's constructor.  See the\n        :term:`venusian` documentation (its ``Scanner`` class) for more\n        information about the constructor.  By default, the only keyword\n        arguments passed to the Scanner constructor are ``{'config':self}``\n        where ``self`` is this configurator object.  This services the\n        requirement of all built-in Pyramid decorators, but extension systems\n        may require additional arguments.  Providing this argument is not\n        often necessary; it's an advanced usage.\n\n        .. versionadded:: 1.1\n           The ``**kw`` argument.\n\n        .. versionadded:: 1.3\n           The ``ignore`` argument.\n\n        \"\"\"\n        package = self.maybe_dotted(package)\n        if package is None: # pragma: no cover\n            package = caller_package()\n\n        ctorkw = {'config': self}\n        ctorkw.update(kw)\n\n        scanner = self.venusian.Scanner(**ctorkw)\n\n        scanner.scan(package, categories=categories, onerror=onerror,\n                     ignore=ignore)\n\n    def make_wsgi_app(self):\n        \"\"\" Commits any pending configuration statements, sends a\n        :class:`pyramid.events.ApplicationCreated` event to all listeners,\n        adds this configuration's registry to\n        :attr:`pyramid.config.global_registries`, and returns a\n        :app:`Pyramid` WSGI application representing the committed\n        configuration state.\"\"\"\n        self.commit()\n        app = Router(self.registry)\n\n        # Allow tools like \"pshell development.ini\" to find the 'last'\n        # registry configured.\n        global_registries.add(self.registry)\n\n        # Push the registry onto the stack in case any code that depends on\n        # the registry threadlocal APIs used in listeners subscribed to the\n        # IApplicationCreated event.\n        self.begin()\n        try:\n            self.registry.notify(ApplicationCreated(app))\n        finally:\n            self.end()\n\n        return app",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 95,
                            "end_lineno": 1031,
                            "parent": null
                        },
                        {
                            "file_name": "pyramid/config/__init__.py",
                            "type": "method",
                            "name": "Configurator.include",
                            "content": "class Configurator(\n    TestingConfiguratorMixin,\n    TweensConfiguratorMixin,\n    SecurityConfiguratorMixin,\n    ViewsConfiguratorMixin,\n    RoutesConfiguratorMixin,\n    ZCAConfiguratorMixin,\n    I18NConfiguratorMixin,\n    RenderingConfiguratorMixin,\n    AssetsConfiguratorMixin,\n    SettingsConfiguratorMixin,\n    FactoriesConfiguratorMixin,\n    AdaptersConfiguratorMixin,\n    ):\n    \"\"\"\n    A Configurator is used to configure a :app:`Pyramid`\n    :term:`application registry`.\n\n    If the ``registry`` argument is not ``None``, it must\n    be an instance of the :class:`pyramid.registry.Registry` class\n    representing the registry to configure.  If ``registry`` is ``None``, the\n    configurator will create a :class:`pyramid.registry.Registry` instance\n    itself; it will also perform some default configuration that would not\n    otherwise be done.  After its construction, the configurator may be used\n    to add further configuration to the registry.\n\n    .. warning:: If ``registry`` is assigned the above-mentioned class\n       instance, all other constructor arguments are ignored,\n       with the exception of ``package``.\n\n    If the ``package`` argument is passed, it must be a reference to a Python\n    :term:`package` (e.g. ``sys.modules['thepackage']``) or a :term:`dotted\n    Python name` to the same.  This value is used as a basis to convert\n    relative paths passed to various configuration methods, such as methods\n    which accept a ``renderer`` argument, into absolute paths.  If ``None``\n    is passed (the default), the package is assumed to be the Python package\n    in which the *caller* of the ``Configurator`` constructor lives.\n\n    If the ``root_package`` is passed, it will propagate through the\n    configuration hierarchy as a way for included packages to locate\n    resources relative to the package in which the main ``Configurator`` was\n    created. If ``None`` is passed (the default), the ``root_package`` will\n    be derived from the ``package`` argument. The ``package`` attribute is\n    always pointing at the package being included when using :meth:`.include`,\n    whereas the ``root_package`` does not change.\n\n    If the ``settings`` argument is passed, it should be a Python dictionary\n    representing the :term:`deployment settings` for this application.  These\n    are later retrievable using the\n    :attr:`pyramid.registry.Registry.settings` attribute (aka\n    ``request.registry.settings``).\n\n    If the ``root_factory`` argument is passed, it should be an object\n    representing the default :term:`root factory` for your application or a\n    :term:`dotted Python name` to the same.  If it is ``None``, a default\n    root factory will be used.\n\n    If ``authentication_policy`` is passed, it should be an instance\n    of an :term:`authentication policy` or a :term:`dotted Python\n    name` to the same.\n\n    If ``authorization_policy`` is passed, it should be an instance of\n    an :term:`authorization policy` or a :term:`dotted Python name` to\n    the same.\n\n    .. note:: A ``ConfigurationError`` will be raised when an\n       authorization policy is supplied without also supplying an\n       authentication policy (authorization requires authentication).\n\n    If ``renderers`` is ``None`` (the default), a default set of\n    :term:`renderer` factories is used. Else, it should be a list of\n    tuples representing a set of renderer factories which should be\n    configured into this application, and each tuple representing a set of\n    positional values that should be passed to\n    :meth:`pyramid.config.Configurator.add_renderer`.\n\n    If ``debug_logger`` is not passed, a default debug logger that logs to a\n    logger will be used (the logger name will be the package name of the\n    *caller* of this configurator).  If it is passed, it should be an\n    instance of the :class:`logging.Logger` (PEP 282) standard library class\n    or a Python logger name.  The debug logger is used by :app:`Pyramid`\n    itself to log warnings and authorization debugging information.\n\n    If ``locale_negotiator`` is passed, it should be a :term:`locale\n    negotiator` implementation or a :term:`dotted Python name` to\n    same.  See :ref:`custom_locale_negotiator`.\n\n    If ``request_factory`` is passed, it should be a :term:`request\n    factory` implementation or a :term:`dotted Python name` to the same.\n    See :ref:`changing_the_request_factory`.  By default it is ``None``,\n    which means use the default request factory.\n\n    If ``response_factory`` is passed, it should be a :term:`response\n    factory` implementation or a :term:`dotted Python name` to the same.\n    See :ref:`changing_the_response_factory`.  By default it is ``None``,\n    which means use the default response factory.\n\n    If ``default_permission`` is passed, it should be a\n    :term:`permission` string to be used as the default permission for\n    all view configuration registrations performed against this\n    Configurator.  An example of a permission string:``'view'``.\n    Adding a default permission makes it unnecessary to protect each\n    view configuration with an explicit permission, unless your\n    application policy requires some exception for a particular view.\n    By default, ``default_permission`` is ``None``, meaning that view\n    configurations which do not explicitly declare a permission will\n    always be executable by entirely anonymous users (any\n    authorization policy in effect is ignored).\n\n    .. seealso::\n\n        See also :ref:`setting_a_default_permission`.\n\n    If ``session_factory`` is passed, it should be an object which\n    implements the :term:`session factory` interface.  If a nondefault\n    value is passed, the ``session_factory`` will be used to create a\n    session object when ``request.session`` is accessed.  Note that\n    the same outcome can be achieved by calling\n    :meth:`pyramid.config.Configurator.set_session_factory`.  By\n    default, this argument is ``None``, indicating that no session\n    factory will be configured (and thus accessing ``request.session``\n    will throw an error) unless ``set_session_factory`` is called later\n    during configuration.\n\n    If ``autocommit`` is ``True``, every method called on the configurator\n    will cause an immediate action, and no configuration conflict detection\n    will be used. If ``autocommit`` is ``False``, most methods of the\n    configurator will defer their action until\n    :meth:`pyramid.config.Configurator.commit` is called.  When\n    :meth:`pyramid.config.Configurator.commit` is called, the actions implied\n    by the called methods will be checked for configuration conflicts unless\n    ``autocommit`` is ``True``.  If a conflict is detected, a\n    ``ConfigurationConflictError`` will be raised.  Calling\n    :meth:`pyramid.config.Configurator.make_wsgi_app` always implies a final\n    commit.\n\n    If ``default_view_mapper`` is passed, it will be used as the default\n    :term:`view mapper` factory for view configurations that don't otherwise\n    specify one (see :class:`pyramid.interfaces.IViewMapperFactory`).  If\n    ``default_view_mapper`` is not passed, a superdefault view mapper will be\n    used.\n\n    If ``exceptionresponse_view`` is passed, it must be a :term:`view\n    callable` or ``None``.  If it is a view callable, it will be used as an\n    exception view callable when an :term:`exception response` is raised. If\n    ``exceptionresponse_view`` is ``None``, no exception response view will\n    be registered, and all raised exception responses will be bubbled up to\n    Pyramid's caller.  By\n    default, the ``pyramid.httpexceptions.default_exceptionresponse_view``\n    function is used as the ``exceptionresponse_view``.\n\n    If ``route_prefix`` is passed, all routes added with\n    :meth:`pyramid.config.Configurator.add_route` will have the specified path\n    prepended to their pattern.\n\n    If ``introspection`` is passed, it must be a boolean value.  If it's\n    ``True``, introspection values during actions will be kept for use\n    for tools like the debug toolbar.  If it's ``False``, introspection\n    values provided by registrations will be ignored.  By default, it is\n    ``True``.\n\n    .. versionadded:: 1.1\n       The ``exceptionresponse_view`` argument.\n\n    .. versionadded:: 1.2\n       The ``route_prefix`` argument.\n\n    .. versionadded:: 1.3\n       The ``introspection`` argument.\n\n    .. versionadded:: 1.6\n       The ``root_package`` argument.\n       The ``response_factory`` argument.\n    \"\"\"\n    manager = manager # for testing injection\n    venusian = venusian # for testing injection\n    _ainfo = None\n    basepath = None\n    includepath = ()\n    info = ''\n    object_description = staticmethod(object_description)\n    introspectable = Introspectable\n    inspect = inspect\n\n    def __init__(self,\n                 registry=None,\n                 package=None,\n                 settings=None,\n                 root_factory=None,\n                 authentication_policy=None,\n                 authorization_policy=None,\n                 renderers=None,\n                 debug_logger=None,\n                 locale_negotiator=None,\n                 request_factory=None,\n                 response_factory=None,\n                 default_permission=None,\n                 session_factory=None,\n                 default_view_mapper=None,\n                 autocommit=False,\n                 exceptionresponse_view=default_exceptionresponse_view,\n                 route_prefix=None,\n                 introspection=True,\n                 root_package=None,\n                 ):\n        if package is None:\n            package = caller_package()\n        if root_package is None:\n            root_package = package\n        name_resolver = DottedNameResolver(package)\n        self.name_resolver = name_resolver\n        self.package_name = name_resolver.get_package_name()\n        self.package = name_resolver.get_package()\n        self.root_package = root_package\n        self.registry = registry\n        self.autocommit = autocommit\n        self.route_prefix = route_prefix\n        self.introspection = introspection\n        if registry is None:\n            registry = Registry(self.package_name)\n            self.registry = registry\n            self.setup_registry(\n                settings=settings,\n                root_factory=root_factory,\n                authentication_policy=authentication_policy,\n                authorization_policy=authorization_policy,\n                renderers=renderers,\n                debug_logger=debug_logger,\n                locale_negotiator=locale_negotiator,\n                request_factory=request_factory,\n                response_factory=response_factory,\n                default_permission=default_permission,\n                session_factory=session_factory,\n                default_view_mapper=default_view_mapper,\n                exceptionresponse_view=exceptionresponse_view,\n                )\n\n    def setup_registry(self,\n                       settings=None,\n                       root_factory=None,\n                       authentication_policy=None,\n                       authorization_policy=None,\n                       renderers=None,\n                       debug_logger=None,\n                       locale_negotiator=None,\n                       request_factory=None,\n                       response_factory=None,\n                       default_permission=None,\n                       session_factory=None,\n                       default_view_mapper=None,\n                       exceptionresponse_view=default_exceptionresponse_view,\n                       ):\n        \"\"\" When you pass a non-``None`` ``registry`` argument to the\n        :term:`Configurator` constructor, no initial setup is performed\n        against the registry.  This is because the registry you pass in may\n        have already been initialized for use under :app:`Pyramid` via a\n        different configurator.  However, in some circumstances (such as when\n        you want to use a global registry instead of a registry created as a\n        result of the Configurator constructor), or when you want to reset\n        the initial setup of a registry, you *do* want to explicitly\n        initialize the registry associated with a Configurator for use under\n        :app:`Pyramid`.  Use ``setup_registry`` to do this initialization.\n\n        ``setup_registry`` configures settings, a root factory, security\n        policies, renderers, a debug logger, a locale negotiator, and various\n        other settings using the configurator's current registry, as per the\n        descriptions in the Configurator constructor.\"\"\"\n\n        registry = self.registry\n\n        self._fix_registry()\n\n        self._set_settings(settings)\n\n        if isinstance(debug_logger, string_types):\n            debug_logger = logging.getLogger(debug_logger)\n\n        if debug_logger is None:\n            debug_logger = logging.getLogger(self.package_name)\n\n        registry.registerUtility(debug_logger, IDebugLogger)\n\n        self.add_default_response_adapters()\n        self.add_default_renderers()\n        self.add_default_view_predicates()\n        self.add_default_view_derivers()\n        self.add_default_route_predicates()\n        self.add_default_tweens()\n\n        if exceptionresponse_view is not None:\n            exceptionresponse_view = self.maybe_dotted(exceptionresponse_view)\n            self.add_view(exceptionresponse_view, context=IExceptionResponse)\n            self.add_view(exceptionresponse_view,context=WebobWSGIHTTPException)\n\n        # commit below because:\n        #\n        # - the default exceptionresponse_view requires the superdefault view\n        #   mapper, so we need to configure it before adding default_view_mapper\n        #\n        # - superdefault renderers should be overrideable without requiring\n        #   the user to commit before calling config.add_renderer\n\n        self.commit()\n\n        # self.commit() should not be called within this method after this\n        # point because the following registrations should be treated as\n        # analogues of methods called by the user after configurator\n        # construction.  Rationale: user-supplied implementations should be\n        # preferred rather than add-on author implementations with the help of\n        # automatic conflict resolution.\n\n        if authentication_policy and not authorization_policy:\n            authorization_policy = ACLAuthorizationPolicy() # default\n\n        if authorization_policy:\n            self.set_authorization_policy(authorization_policy)\n\n        if authentication_policy:\n            self.set_authentication_policy(authentication_policy)\n\n        if default_view_mapper is not None:\n            self.set_view_mapper(default_view_mapper)\n\n        if renderers:\n            for name, renderer in renderers:\n                self.add_renderer(name, renderer)\n\n        if root_factory is not None:\n            self.set_root_factory(root_factory)\n\n        if locale_negotiator:\n            self.set_locale_negotiator(locale_negotiator)\n\n        if request_factory:\n            self.set_request_factory(request_factory)\n\n        if response_factory:\n            self.set_response_factory(response_factory)\n\n        if default_permission:\n            self.set_default_permission(default_permission)\n\n        if session_factory is not None:\n            self.set_session_factory(session_factory)\n\n        tweens = aslist(registry.settings.get('pyramid.tweens', []))\n        for factory in tweens:\n            self._add_tween(factory, explicit=True)\n\n        includes = aslist(registry.settings.get('pyramid.includes', []))\n        for inc in includes:\n            self.include(inc)\n\n    def _make_spec(self, path_or_spec):\n        package, filename = resolve_asset_spec(path_or_spec, self.package_name)\n        if package is None:\n            return filename # absolute filename\n        return '%s:%s' % (package, filename)\n\n    def _fix_registry(self):\n        \"\"\" Fix up a ZCA component registry that is not a\n        pyramid.registry.Registry by adding analogues of ``has_listeners``,\n        ``notify``, ``queryAdapterOrSelf``, and ``registerSelfAdapter``\n        through monkey-patching.\"\"\"\n\n        _registry = self.registry\n\n        if not hasattr(_registry, 'notify'):\n            def notify(*events):\n                [ _ for _ in _registry.subscribers(events, None) ]\n            _registry.notify = notify\n\n        if not hasattr(_registry, 'has_listeners'):\n            _registry.has_listeners = True\n\n        if not hasattr(_registry, 'queryAdapterOrSelf'):\n            def queryAdapterOrSelf(object, interface, default=None):\n                if not interface.providedBy(object):\n                    return _registry.queryAdapter(object, interface,\n                                                  default=default)\n                return object\n            _registry.queryAdapterOrSelf = queryAdapterOrSelf\n\n        if not hasattr(_registry, 'registerSelfAdapter'):\n            def registerSelfAdapter(required=None, provided=None,\n                                    name=empty, info=empty, event=True):\n                return _registry.registerAdapter(lambda x: x,\n                                                 required=required,\n                                                 provided=provided, name=name,\n                                                 info=info, event=event)\n            _registry.registerSelfAdapter = registerSelfAdapter\n\n        if not hasattr(_registry, '_lock'):\n            _registry._lock = threading.Lock()\n\n        if not hasattr(_registry, '_clear_view_lookup_cache'):\n            def _clear_view_lookup_cache():\n                _registry._view_lookup_cache = {}\n            _registry._clear_view_lookup_cache = _clear_view_lookup_cache\n\n\n    # API\n\n    def _get_introspector(self):\n        introspector = getattr(self.registry, 'introspector', _marker)\n        if introspector is _marker:\n            introspector = Introspector()\n            self._set_introspector(introspector)\n        return introspector\n\n    def _set_introspector(self, introspector):\n        self.registry.introspector = introspector\n\n    def _del_introspector(self):\n        del self.registry.introspector\n\n    introspector = property(\n        _get_introspector, _set_introspector, _del_introspector\n        )\n\n    def get_predlist(self, name):\n        predlist = self.registry.queryUtility(IPredicateList, name=name)\n        if predlist is None:\n            predlist = PredicateList()\n            self.registry.registerUtility(predlist, IPredicateList, name=name)\n        return predlist\n\n\n    def _add_predicate(self, type, name, factory, weighs_more_than=None,\n                       weighs_less_than=None):\n        factory = self.maybe_dotted(factory)\n        discriminator = ('%s option' % type, name)\n        intr = self.introspectable(\n            '%s predicates' % type,\n            discriminator,\n            '%s predicate named %s' % (type, name),\n            '%s predicate' % type)\n        intr['name'] = name\n        intr['factory'] = factory\n        intr['weighs_more_than'] = weighs_more_than\n        intr['weighs_less_than'] = weighs_less_than\n        def register():\n            predlist = self.get_predlist(type)\n            predlist.add(name, factory, weighs_more_than=weighs_more_than,\n                         weighs_less_than=weighs_less_than)\n        self.action(discriminator, register, introspectables=(intr,),\n                    order=PHASE1_CONFIG) # must be registered early\n\n    @property\n    def action_info(self):\n        info = self.info # usually a ZCML action (ParserInfo) if self.info\n        if not info:\n            # Try to provide more accurate info for conflict reports\n            if self._ainfo:\n                info = self._ainfo[0]\n            else:\n                info = ActionInfo(None, 0, '', '')\n        return info\n\n    def action(self, discriminator, callable=None, args=(), kw=None, order=0,\n               introspectables=(), **extra):\n        \"\"\" Register an action which will be executed when\n        :meth:`pyramid.config.Configurator.commit` is called (or executed\n        immediately if ``autocommit`` is ``True``).\n\n        .. warning:: This method is typically only used by :app:`Pyramid`\n           framework extension authors, not by :app:`Pyramid` application\n           developers.\n\n        The ``discriminator`` uniquely identifies the action.  It must be\n        given, but it can be ``None``, to indicate that the action never\n        conflicts.  It must be a hashable value.\n\n        The ``callable`` is a callable object which performs the task\n        associated with the action when the action is executed.  It is\n        optional.\n\n        ``args`` and ``kw`` are tuple and dict objects respectively, which\n        are passed to ``callable`` when this action is executed.  Both are\n        optional.\n\n        ``order`` is a grouping mechanism; an action with a lower order will\n        be executed before an action with a higher order (has no effect when\n        autocommit is ``True``).\n\n        ``introspectables`` is a sequence of :term:`introspectable` objects\n        (or the empty sequence if no introspectable objects are associated\n        with this action).  If this configurator's ``introspection``\n        attribute is ``False``, these introspectables will be ignored.\n\n        ``extra`` provides a facility for inserting extra keys and values\n        into an action dictionary.\n        \"\"\"\n        # catch nonhashable discriminators here; most unit tests use\n        # autocommit=False, which won't catch unhashable discriminators\n        assert hash(discriminator) \n\n        if kw is None:\n            kw = {}\n\n        autocommit = self.autocommit\n        action_info = self.action_info\n\n        if not self.introspection:\n            # if we're not introspecting, ignore any introspectables passed\n            # to us\n            introspectables = ()\n\n        if autocommit:\n            # callables can depend on the side effects of resolving a\n            # deferred discriminator\n            self.begin()\n            try:\n                undefer(discriminator)\n                if callable is not None:\n                    callable(*args, **kw)\n                for introspectable in introspectables:\n                    introspectable.register(self.introspector, action_info)\n            finally:\n                self.end()\n\n        else:\n            action = extra\n            action.update(\n                dict(\n                    discriminator=discriminator,\n                    callable=callable,\n                    args=args,\n                    kw=kw,\n                    order=order,\n                    info=action_info,\n                    includepath=self.includepath,\n                    introspectables=introspectables,\n                    )\n                )\n            self.action_state.action(**action)\n\n    def _get_action_state(self):\n        registry = self.registry\n        try:\n            state = registry.action_state\n        except AttributeError:\n            state = ActionState()\n            registry.action_state = state\n        return state\n\n    def _set_action_state(self, state):\n        self.registry.action_state = state\n\n    action_state = property(_get_action_state, _set_action_state)\n\n    _ctx = action_state # bw compat\n\n    def commit(self):\n        \"\"\" Commit any pending configuration actions. If a configuration\n        conflict is detected in the pending configuration actions, this method\n        will raise a :exc:`ConfigurationConflictError`; within the traceback\n        of this error will be information about the source of the conflict,\n        usually including file names and line numbers of the cause of the\n        configuration conflicts.\"\"\"\n        self.begin()\n        try:\n            self.action_state.execute_actions(introspector=self.introspector)\n        finally:\n            self.end()\n        self.action_state = ActionState() # old actions have been processed\n\n    def include(self, callable, route_prefix=None):\n        \"\"\"Include a configuration callable, to support imperative\n        application extensibility.\n\n        .. warning:: In versions of :app:`Pyramid` prior to 1.2, this\n            function accepted ``*callables``, but this has been changed\n            to support only a single callable.\n\n        A configuration callable should be a callable that accepts a single\n        argument named ``config``, which will be an instance of a\n        :term:`Configurator`.  However, be warned that it will not be the same\n        configurator instance on which you call this method.  The\n        code which runs as a result of calling the callable should invoke\n        methods on the configurator passed to it which add configuration\n        state.  The return value of a callable will be ignored.\n\n        Values allowed to be presented via the ``callable`` argument to\n        this method: any callable Python object or any :term:`dotted Python\n        name` which resolves to a callable Python object.  It may also be a\n        Python :term:`module`, in which case, the module will be searched for\n        a callable named ``includeme``, which will be treated as the\n        configuration callable.\n\n        For example, if the ``includeme`` function below lives in a module\n        named ``myapp.myconfig``:\n\n        .. code-block:: python\n           :linenos:\n\n           # myapp.myconfig module\n\n           def my_view(request):\n               from pyramid.response import Response\n               return Response('OK')\n\n           def includeme(config):\n               config.add_view(my_view)\n\n        You might cause it to be included within your Pyramid application like\n        so:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include('myapp.myconfig.includeme')\n\n        Because the function is named ``includeme``, the function name can\n        also be omitted from the dotted name reference:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include('myapp.myconfig')\n\n        Included configuration statements will be overridden by local\n        configuration statements if an included callable causes a\n        configuration conflict by registering something with the same\n        configuration parameters.\n\n        If the ``route_prefix`` is supplied, it must be a string.  Any calls\n        to :meth:`pyramid.config.Configurator.add_route` within the included\n        callable will have their pattern prefixed with the value of\n        ``route_prefix``. This can be used to help mount a set of routes at a\n        different location than the included callable's author intended, while\n        still maintaining the same route names.  For example:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def included(config):\n               config.add_route('show_users', '/show')\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include(included, route_prefix='/users')\n\n        In the above configuration, the ``show_users`` route will have an\n        effective route pattern of ``/users/show``, instead of ``/show``\n        because the ``route_prefix`` argument will be prepended to the\n        pattern.\n\n        .. versionadded:: 1.2\n           The ``route_prefix`` parameter.\n\n        .. versionchanged:: 1.9\n           The included function is wrapped with a call to\n           :meth:`pyramid.config.Configurator.begin` and\n           :meth:`pyramid.config.Configurator.end` while it is executed.\n\n        \"\"\"\n        # \"\"\" <-- emacs\n\n        action_state = self.action_state\n\n        if route_prefix is None:\n            route_prefix = ''\n\n        old_route_prefix = self.route_prefix\n        if old_route_prefix is None:\n            old_route_prefix = ''\n\n        route_prefix = '%s/%s' % (\n            old_route_prefix.rstrip('/'),\n            route_prefix.lstrip('/')\n            )\n        route_prefix = route_prefix.strip('/')\n        if not route_prefix:\n            route_prefix = None\n\n        c = self.maybe_dotted(callable)\n        module = self.inspect.getmodule(c)\n        if module is c:\n            try:\n                c = getattr(module, 'includeme')\n            except AttributeError:\n                raise ConfigurationError(\n                    \"module %r has no attribute 'includeme'\" % (module.__name__)\n                    )\n                                                       \n        spec = module.__name__ + ':' + c.__name__\n        sourcefile = self.inspect.getsourcefile(c)\n\n        if sourcefile is None:\n            raise ConfigurationError(\n                'No source file for module %r (.py file must exist, '\n                'refusing to use orphan .pyc or .pyo file).' % module.__name__)\n            \n\n        if action_state.processSpec(spec):\n            configurator = self.__class__(\n                registry=self.registry,\n                package=package_of(module),\n                root_package=self.root_package,\n                autocommit=self.autocommit,\n                route_prefix=route_prefix,\n                )\n            configurator.basepath = os.path.dirname(sourcefile)\n            configurator.includepath = self.includepath + (spec,)\n            self.begin()\n            try:\n                c(configurator)\n            finally:\n                self.end()\n\n    def add_directive(self, name, directive, action_wrap=True):\n        \"\"\"\n        Add a directive method to the configurator.\n\n        .. warning:: This method is typically only used by :app:`Pyramid`\n           framework extension authors, not by :app:`Pyramid` application\n           developers.\n\n        Framework extenders can add directive methods to a configurator by\n        instructing their users to call ``config.add_directive('somename',\n        'some.callable')``.  This will make ``some.callable`` accessible as\n        ``config.somename``.  ``some.callable`` should be a function which\n        accepts ``config`` as a first argument, and arbitrary positional and\n        keyword arguments following.  It should use config.action as\n        necessary to perform actions.  Directive methods can then be invoked\n        like 'built-in' directives such as ``add_view``, ``add_route``, etc.\n\n        The ``action_wrap`` argument should be ``True`` for directives which\n        perform ``config.action`` with potentially conflicting\n        discriminators.  ``action_wrap`` will cause the directive to be\n        wrapped in a decorator which provides more accurate conflict\n        cause information.\n\n        ``add_directive`` does not participate in conflict detection, and\n        later calls to ``add_directive`` will override earlier calls.\n        \"\"\"\n        c = self.maybe_dotted(directive)\n        if not hasattr(self.registry, '_directives'):\n            self.registry._directives = {}\n        self.registry._directives[name] = (c, action_wrap)\n\n    def __getattr__(self, name):\n        # allow directive extension names to work\n        directives = getattr(self.registry, '_directives', {})\n        c = directives.get(name)\n        if c is None:\n            raise AttributeError(name)\n        c, action_wrap = c\n        if action_wrap:\n            c = action_method(c)\n        # Create a bound method (works on both Py2 and Py3)\n        # http://stackoverflow.com/a/1015405/209039\n        m = c.__get__(self, self.__class__)\n        return m\n\n    def with_package(self, package):\n        \"\"\" Return a new Configurator instance with the same registry\n        as this configurator. ``package`` may be an actual Python package\n        object or a :term:`dotted Python name` representing a package.\"\"\"\n        configurator = self.__class__(\n            registry=self.registry,\n            package=package,\n            root_package=self.root_package,\n            autocommit=self.autocommit,\n            route_prefix=self.route_prefix,\n            introspection=self.introspection,\n            )\n        configurator.basepath = self.basepath\n        configurator.includepath = self.includepath\n        configurator.info = self.info\n        return configurator\n\n    def maybe_dotted(self, dotted):\n        \"\"\" Resolve the :term:`dotted Python name` ``dotted`` to a\n        global Python object.  If ``dotted`` is not a string, return\n        it without attempting to do any name resolution.  If\n        ``dotted`` is a relative dotted name (e.g. ``.foo.bar``,\n        consider it relative to the ``package`` argument supplied to\n        this Configurator's constructor.\"\"\"\n        return self.name_resolver.maybe_resolve(dotted)\n\n    def absolute_asset_spec(self, relative_spec):\n        \"\"\" Resolve the potentially relative :term:`asset\n        specification` string passed as ``relative_spec`` into an\n        absolute asset specification string and return the string.\n        Use the ``package`` of this configurator as the package to\n        which the asset specification will be considered relative\n        when generating an absolute asset specification.  If the\n        provided ``relative_spec`` argument is already absolute, or if\n        the ``relative_spec`` is not a string, it is simply returned.\"\"\"\n        if not isinstance(relative_spec, string_types):\n            return relative_spec\n        return self._make_spec(relative_spec)\n\n    absolute_resource_spec = absolute_asset_spec # b/w compat forever\n\n    def begin(self, request=_marker):\n        \"\"\" Indicate that application or test configuration has begun.\n        This pushes a dictionary containing the :term:`application\n        registry` implied by ``registry`` attribute of this\n        configurator and the :term:`request` implied by the\n        ``request`` argument onto the :term:`thread local` stack\n        consulted by various :mod:`pyramid.threadlocal` API\n        functions.\n\n        If ``request`` is not specified and the registry owned by the\n        configurator is already pushed as the current threadlocal registry\n        then this method will keep the current threadlocal request unchanged.\n\n        .. versionchanged:: 1.8\n           The current threadlocal request is propagated if the current\n           threadlocal registry remains unchanged.\n\n        \"\"\"\n        if request is _marker:\n            current = self.manager.get()\n            if current['registry'] == self.registry:\n                request = current['request']\n            else:\n                request = None\n        self.manager.push({'registry':self.registry, 'request':request})\n\n    def end(self):\n        \"\"\" Indicate that application or test configuration has ended.\n        This pops the last value pushed onto the :term:`thread local`\n        stack (usually by the ``begin`` method) and returns that\n        value.\n        \"\"\"\n        return self.manager.pop()\n\n    # this is *not* an action method (uses caller_package)\n    def scan(self, package=None, categories=None, onerror=None, ignore=None,\n             **kw):\n        \"\"\"Scan a Python package and any of its subpackages for objects\n        marked with :term:`configuration decoration` such as\n        :class:`pyramid.view.view_config`.  Any decorated object found will\n        influence the current configuration state.\n\n        The ``package`` argument should be a Python :term:`package` or module\n        object (or a :term:`dotted Python name` which refers to such a\n        package or module).  If ``package`` is ``None``, the package of the\n        *caller* is used.\n\n        The ``categories`` argument, if provided, should be the\n        :term:`Venusian` 'scan categories' to use during scanning.  Providing\n        this argument is not often necessary; specifying scan categories is\n        an extremely advanced usage.  By default, ``categories`` is ``None``\n        which will execute *all* Venusian decorator callbacks including\n        :app:`Pyramid`-related decorators such as\n        :class:`pyramid.view.view_config`.  See the :term:`Venusian`\n        documentation for more information about limiting a scan by using an\n        explicit set of categories.\n\n        The ``onerror`` argument, if provided, should be a Venusian\n        ``onerror`` callback function.  The onerror function is passed to\n        :meth:`venusian.Scanner.scan` to influence error behavior when an\n        exception is raised during the scanning process.  See the\n        :term:`Venusian` documentation for more information about ``onerror``\n        callbacks.\n\n        The ``ignore`` argument, if provided, should be a Venusian ``ignore``\n        value.  Providing an ``ignore`` argument allows the scan to ignore\n        particular modules, packages, or global objects during a scan.\n        ``ignore`` can be a string or a callable, or a list containing\n        strings or callables.  The simplest usage of ``ignore`` is to provide\n        a module or package by providing a full path to its dotted name.  For\n        example: ``config.scan(ignore='my.module.subpackage')`` would ignore\n        the ``my.module.subpackage`` package during a scan, which would\n        prevent the subpackage and any of its submodules from being imported\n        and scanned.  See the :term:`Venusian` documentation for more\n        information about the ``ignore`` argument.\n\n        To perform a ``scan``, Pyramid creates a Venusian ``Scanner`` object.\n        The ``kw`` argument represents a set of keyword arguments to pass to\n        the Venusian ``Scanner`` object's constructor.  See the\n        :term:`venusian` documentation (its ``Scanner`` class) for more\n        information about the constructor.  By default, the only keyword\n        arguments passed to the Scanner constructor are ``{'config':self}``\n        where ``self`` is this configurator object.  This services the\n        requirement of all built-in Pyramid decorators, but extension systems\n        may require additional arguments.  Providing this argument is not\n        often necessary; it's an advanced usage.\n\n        .. versionadded:: 1.1\n           The ``**kw`` argument.\n\n        .. versionadded:: 1.3\n           The ``ignore`` argument.\n\n        \"\"\"\n        package = self.maybe_dotted(package)\n        if package is None: # pragma: no cover\n            package = caller_package()\n\n        ctorkw = {'config': self}\n        ctorkw.update(kw)\n\n        scanner = self.venusian.Scanner(**ctorkw)\n\n        scanner.scan(package, categories=categories, onerror=onerror,\n                     ignore=ignore)\n\n    def make_wsgi_app(self):\n        \"\"\" Commits any pending configuration statements, sends a\n        :class:`pyramid.events.ApplicationCreated` event to all listeners,\n        adds this configuration's registry to\n        :attr:`pyramid.config.global_registries`, and returns a\n        :app:`Pyramid` WSGI application representing the committed\n        configuration state.\"\"\"\n        self.commit()\n        app = Router(self.registry)\n\n        # Allow tools like \"pshell development.ini\" to find the 'last'\n        # registry configured.\n        global_registries.add(self.registry)\n\n        # Push the registry onto the stack in case any code that depends on\n        # the registry threadlocal APIs used in listeners subscribed to the\n        # IApplicationCreated event.\n        self.begin()\n        try:\n            self.registry.notify(ApplicationCreated(app))\n        finally:\n            self.end()\n\n        return app",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 662,
                            "end_lineno": 814,
                            "parent": {
                                "file_name": "pyramid/config/__init__.py",
                                "type": "class",
                                "name": "Configurator",
                                "content": "class Configurator(\n    TestingConfiguratorMixin,\n    TweensConfiguratorMixin,\n    SecurityConfiguratorMixin,\n    ViewsConfiguratorMixin,\n    RoutesConfiguratorMixin,\n    ZCAConfiguratorMixin,\n    I18NConfiguratorMixin,\n    RenderingConfiguratorMixin,\n    AssetsConfiguratorMixin,\n    SettingsConfiguratorMixin,\n    FactoriesConfiguratorMixin,\n    AdaptersConfiguratorMixin,\n    ):\n    \"\"\"\n    A Configurator is used to configure a :app:`Pyramid`\n    :term:`application registry`.\n\n    If the ``registry`` argument is not ``None``, it must\n    be an instance of the :class:`pyramid.registry.Registry` class\n    representing the registry to configure.  If ``registry`` is ``None``, the\n    configurator will create a :class:`pyramid.registry.Registry` instance\n    itself; it will also perform some default configuration that would not\n    otherwise be done.  After its construction, the configurator may be used\n    to add further configuration to the registry.\n\n    .. warning:: If ``registry`` is assigned the above-mentioned class\n       instance, all other constructor arguments are ignored,\n       with the exception of ``package``.\n\n    If the ``package`` argument is passed, it must be a reference to a Python\n    :term:`package` (e.g. ``sys.modules['thepackage']``) or a :term:`dotted\n    Python name` to the same.  This value is used as a basis to convert\n    relative paths passed to various configuration methods, such as methods\n    which accept a ``renderer`` argument, into absolute paths.  If ``None``\n    is passed (the default), the package is assumed to be the Python package\n    in which the *caller* of the ``Configurator`` constructor lives.\n\n    If the ``root_package`` is passed, it will propagate through the\n    configuration hierarchy as a way for included packages to locate\n    resources relative to the package in which the main ``Configurator`` was\n    created. If ``None`` is passed (the default), the ``root_package`` will\n    be derived from the ``package`` argument. The ``package`` attribute is\n    always pointing at the package being included when using :meth:`.include`,\n    whereas the ``root_package`` does not change.\n\n    If the ``settings`` argument is passed, it should be a Python dictionary\n    representing the :term:`deployment settings` for this application.  These\n    are later retrievable using the\n    :attr:`pyramid.registry.Registry.settings` attribute (aka\n    ``request.registry.settings``).\n\n    If the ``root_factory`` argument is passed, it should be an object\n    representing the default :term:`root factory` for your application or a\n    :term:`dotted Python name` to the same.  If it is ``None``, a default\n    root factory will be used.\n\n    If ``authentication_policy`` is passed, it should be an instance\n    of an :term:`authentication policy` or a :term:`dotted Python\n    name` to the same.\n\n    If ``authorization_policy`` is passed, it should be an instance of\n    an :term:`authorization policy` or a :term:`dotted Python name` to\n    the same.\n\n    .. note:: A ``ConfigurationError`` will be raised when an\n       authorization policy is supplied without also supplying an\n       authentication policy (authorization requires authentication).\n\n    If ``renderers`` is ``None`` (the default), a default set of\n    :term:`renderer` factories is used. Else, it should be a list of\n    tuples representing a set of renderer factories which should be\n    configured into this application, and each tuple representing a set of\n    positional values that should be passed to\n    :meth:`pyramid.config.Configurator.add_renderer`.\n\n    If ``debug_logger`` is not passed, a default debug logger that logs to a\n    logger will be used (the logger name will be the package name of the\n    *caller* of this configurator).  If it is passed, it should be an\n    instance of the :class:`logging.Logger` (PEP 282) standard library class\n    or a Python logger name.  The debug logger is used by :app:`Pyramid`\n    itself to log warnings and authorization debugging information.\n\n    If ``locale_negotiator`` is passed, it should be a :term:`locale\n    negotiator` implementation or a :term:`dotted Python name` to\n    same.  See :ref:`custom_locale_negotiator`.\n\n    If ``request_factory`` is passed, it should be a :term:`request\n    factory` implementation or a :term:`dotted Python name` to the same.\n    See :ref:`changing_the_request_factory`.  By default it is ``None``,\n    which means use the default request factory.\n\n    If ``response_factory`` is passed, it should be a :term:`response\n    factory` implementation or a :term:`dotted Python name` to the same.\n    See :ref:`changing_the_response_factory`.  By default it is ``None``,\n    which means use the default response factory.\n\n    If ``default_permission`` is passed, it should be a\n    :term:`permission` string to be used as the default permission for\n    all view configuration registrations performed against this\n    Configurator.  An example of a permission string:``'view'``.\n    Adding a default permission makes it unnecessary to protect each\n    view configuration with an explicit permission, unless your\n    application policy requires some exception for a particular view.\n    By default, ``default_permission`` is ``None``, meaning that view\n    configurations which do not explicitly declare a permission will\n    always be executable by entirely anonymous users (any\n    authorization policy in effect is ignored).\n\n    .. seealso::\n\n        See also :ref:`setting_a_default_permission`.\n\n    If ``session_factory`` is passed, it should be an object which\n    implements the :term:`session factory` interface.  If a nondefault\n    value is passed, the ``session_factory`` will be used to create a\n    session object when ``request.session`` is accessed.  Note that\n    the same outcome can be achieved by calling\n    :meth:`pyramid.config.Configurator.set_session_factory`.  By\n    default, this argument is ``None``, indicating that no session\n    factory will be configured (and thus accessing ``request.session``\n    will throw an error) unless ``set_session_factory`` is called later\n    during configuration.\n\n    If ``autocommit`` is ``True``, every method called on the configurator\n    will cause an immediate action, and no configuration conflict detection\n    will be used. If ``autocommit`` is ``False``, most methods of the\n    configurator will defer their action until\n    :meth:`pyramid.config.Configurator.commit` is called.  When\n    :meth:`pyramid.config.Configurator.commit` is called, the actions implied\n    by the called methods will be checked for configuration conflicts unless\n    ``autocommit`` is ``True``.  If a conflict is detected, a\n    ``ConfigurationConflictError`` will be raised.  Calling\n    :meth:`pyramid.config.Configurator.make_wsgi_app` always implies a final\n    commit.\n\n    If ``default_view_mapper`` is passed, it will be used as the default\n    :term:`view mapper` factory for view configurations that don't otherwise\n    specify one (see :class:`pyramid.interfaces.IViewMapperFactory`).  If\n    ``default_view_mapper`` is not passed, a superdefault view mapper will be\n    used.\n\n    If ``exceptionresponse_view`` is passed, it must be a :term:`view\n    callable` or ``None``.  If it is a view callable, it will be used as an\n    exception view callable when an :term:`exception response` is raised. If\n    ``exceptionresponse_view`` is ``None``, no exception response view will\n    be registered, and all raised exception responses will be bubbled up to\n    Pyramid's caller.  By\n    default, the ``pyramid.httpexceptions.default_exceptionresponse_view``\n    function is used as the ``exceptionresponse_view``.\n\n    If ``route_prefix`` is passed, all routes added with\n    :meth:`pyramid.config.Configurator.add_route` will have the specified path\n    prepended to their pattern.\n\n    If ``introspection`` is passed, it must be a boolean value.  If it's\n    ``True``, introspection values during actions will be kept for use\n    for tools like the debug toolbar.  If it's ``False``, introspection\n    values provided by registrations will be ignored.  By default, it is\n    ``True``.\n\n    .. versionadded:: 1.1\n       The ``exceptionresponse_view`` argument.\n\n    .. versionadded:: 1.2\n       The ``route_prefix`` argument.\n\n    .. versionadded:: 1.3\n       The ``introspection`` argument.\n\n    .. versionadded:: 1.6\n       The ``root_package`` argument.\n       The ``response_factory`` argument.\n    \"\"\"\n    manager = manager # for testing injection\n    venusian = venusian # for testing injection\n    _ainfo = None\n    basepath = None\n    includepath = ()\n    info = ''\n    object_description = staticmethod(object_description)\n    introspectable = Introspectable\n    inspect = inspect\n\n    def __init__(self,\n                 registry=None,\n                 package=None,\n                 settings=None,\n                 root_factory=None,\n                 authentication_policy=None,\n                 authorization_policy=None,\n                 renderers=None,\n                 debug_logger=None,\n                 locale_negotiator=None,\n                 request_factory=None,\n                 response_factory=None,\n                 default_permission=None,\n                 session_factory=None,\n                 default_view_mapper=None,\n                 autocommit=False,\n                 exceptionresponse_view=default_exceptionresponse_view,\n                 route_prefix=None,\n                 introspection=True,\n                 root_package=None,\n                 ):\n        if package is None:\n            package = caller_package()\n        if root_package is None:\n            root_package = package\n        name_resolver = DottedNameResolver(package)\n        self.name_resolver = name_resolver\n        self.package_name = name_resolver.get_package_name()\n        self.package = name_resolver.get_package()\n        self.root_package = root_package\n        self.registry = registry\n        self.autocommit = autocommit\n        self.route_prefix = route_prefix\n        self.introspection = introspection\n        if registry is None:\n            registry = Registry(self.package_name)\n            self.registry = registry\n            self.setup_registry(\n                settings=settings,\n                root_factory=root_factory,\n                authentication_policy=authentication_policy,\n                authorization_policy=authorization_policy,\n                renderers=renderers,\n                debug_logger=debug_logger,\n                locale_negotiator=locale_negotiator,\n                request_factory=request_factory,\n                response_factory=response_factory,\n                default_permission=default_permission,\n                session_factory=session_factory,\n                default_view_mapper=default_view_mapper,\n                exceptionresponse_view=exceptionresponse_view,\n                )\n\n    def setup_registry(self,\n                       settings=None,\n                       root_factory=None,\n                       authentication_policy=None,\n                       authorization_policy=None,\n                       renderers=None,\n                       debug_logger=None,\n                       locale_negotiator=None,\n                       request_factory=None,\n                       response_factory=None,\n                       default_permission=None,\n                       session_factory=None,\n                       default_view_mapper=None,\n                       exceptionresponse_view=default_exceptionresponse_view,\n                       ):\n        \"\"\" When you pass a non-``None`` ``registry`` argument to the\n        :term:`Configurator` constructor, no initial setup is performed\n        against the registry.  This is because the registry you pass in may\n        have already been initialized for use under :app:`Pyramid` via a\n        different configurator.  However, in some circumstances (such as when\n        you want to use a global registry instead of a registry created as a\n        result of the Configurator constructor), or when you want to reset\n        the initial setup of a registry, you *do* want to explicitly\n        initialize the registry associated with a Configurator for use under\n        :app:`Pyramid`.  Use ``setup_registry`` to do this initialization.\n\n        ``setup_registry`` configures settings, a root factory, security\n        policies, renderers, a debug logger, a locale negotiator, and various\n        other settings using the configurator's current registry, as per the\n        descriptions in the Configurator constructor.\"\"\"\n\n        registry = self.registry\n\n        self._fix_registry()\n\n        self._set_settings(settings)\n\n        if isinstance(debug_logger, string_types):\n            debug_logger = logging.getLogger(debug_logger)\n\n        if debug_logger is None:\n            debug_logger = logging.getLogger(self.package_name)\n\n        registry.registerUtility(debug_logger, IDebugLogger)\n\n        self.add_default_response_adapters()\n        self.add_default_renderers()\n        self.add_default_view_predicates()\n        self.add_default_view_derivers()\n        self.add_default_route_predicates()\n        self.add_default_tweens()\n\n        if exceptionresponse_view is not None:\n            exceptionresponse_view = self.maybe_dotted(exceptionresponse_view)\n            self.add_view(exceptionresponse_view, context=IExceptionResponse)\n            self.add_view(exceptionresponse_view,context=WebobWSGIHTTPException)\n\n        # commit below because:\n        #\n        # - the default exceptionresponse_view requires the superdefault view\n        #   mapper, so we need to configure it before adding default_view_mapper\n        #\n        # - superdefault renderers should be overrideable without requiring\n        #   the user to commit before calling config.add_renderer\n\n        self.commit()\n\n        # self.commit() should not be called within this method after this\n        # point because the following registrations should be treated as\n        # analogues of methods called by the user after configurator\n        # construction.  Rationale: user-supplied implementations should be\n        # preferred rather than add-on author implementations with the help of\n        # automatic conflict resolution.\n\n        if authentication_policy and not authorization_policy:\n            authorization_policy = ACLAuthorizationPolicy() # default\n\n        if authorization_policy:\n            self.set_authorization_policy(authorization_policy)\n\n        if authentication_policy:\n            self.set_authentication_policy(authentication_policy)\n\n        if default_view_mapper is not None:\n            self.set_view_mapper(default_view_mapper)\n\n        if renderers:\n            for name, renderer in renderers:\n                self.add_renderer(name, renderer)\n\n        if root_factory is not None:\n            self.set_root_factory(root_factory)\n\n        if locale_negotiator:\n            self.set_locale_negotiator(locale_negotiator)\n\n        if request_factory:\n            self.set_request_factory(request_factory)\n\n        if response_factory:\n            self.set_response_factory(response_factory)\n\n        if default_permission:\n            self.set_default_permission(default_permission)\n\n        if session_factory is not None:\n            self.set_session_factory(session_factory)\n\n        tweens = aslist(registry.settings.get('pyramid.tweens', []))\n        for factory in tweens:\n            self._add_tween(factory, explicit=True)\n\n        includes = aslist(registry.settings.get('pyramid.includes', []))\n        for inc in includes:\n            self.include(inc)\n\n    def _make_spec(self, path_or_spec):\n        package, filename = resolve_asset_spec(path_or_spec, self.package_name)\n        if package is None:\n            return filename # absolute filename\n        return '%s:%s' % (package, filename)\n\n    def _fix_registry(self):\n        \"\"\" Fix up a ZCA component registry that is not a\n        pyramid.registry.Registry by adding analogues of ``has_listeners``,\n        ``notify``, ``queryAdapterOrSelf``, and ``registerSelfAdapter``\n        through monkey-patching.\"\"\"\n\n        _registry = self.registry\n\n        if not hasattr(_registry, 'notify'):\n            def notify(*events):\n                [ _ for _ in _registry.subscribers(events, None) ]\n            _registry.notify = notify\n\n        if not hasattr(_registry, 'has_listeners'):\n            _registry.has_listeners = True\n\n        if not hasattr(_registry, 'queryAdapterOrSelf'):\n            def queryAdapterOrSelf(object, interface, default=None):\n                if not interface.providedBy(object):\n                    return _registry.queryAdapter(object, interface,\n                                                  default=default)\n                return object\n            _registry.queryAdapterOrSelf = queryAdapterOrSelf\n\n        if not hasattr(_registry, 'registerSelfAdapter'):\n            def registerSelfAdapter(required=None, provided=None,\n                                    name=empty, info=empty, event=True):\n                return _registry.registerAdapter(lambda x: x,\n                                                 required=required,\n                                                 provided=provided, name=name,\n                                                 info=info, event=event)\n            _registry.registerSelfAdapter = registerSelfAdapter\n\n        if not hasattr(_registry, '_lock'):\n            _registry._lock = threading.Lock()\n\n        if not hasattr(_registry, '_clear_view_lookup_cache'):\n            def _clear_view_lookup_cache():\n                _registry._view_lookup_cache = {}\n            _registry._clear_view_lookup_cache = _clear_view_lookup_cache\n\n\n    # API\n\n    def _get_introspector(self):\n        introspector = getattr(self.registry, 'introspector', _marker)\n        if introspector is _marker:\n            introspector = Introspector()\n            self._set_introspector(introspector)\n        return introspector\n\n    def _set_introspector(self, introspector):\n        self.registry.introspector = introspector\n\n    def _del_introspector(self):\n        del self.registry.introspector\n\n    introspector = property(\n        _get_introspector, _set_introspector, _del_introspector\n        )\n\n    def get_predlist(self, name):\n        predlist = self.registry.queryUtility(IPredicateList, name=name)\n        if predlist is None:\n            predlist = PredicateList()\n            self.registry.registerUtility(predlist, IPredicateList, name=name)\n        return predlist\n\n\n    def _add_predicate(self, type, name, factory, weighs_more_than=None,\n                       weighs_less_than=None):\n        factory = self.maybe_dotted(factory)\n        discriminator = ('%s option' % type, name)\n        intr = self.introspectable(\n            '%s predicates' % type,\n            discriminator,\n            '%s predicate named %s' % (type, name),\n            '%s predicate' % type)\n        intr['name'] = name\n        intr['factory'] = factory\n        intr['weighs_more_than'] = weighs_more_than\n        intr['weighs_less_than'] = weighs_less_than\n        def register():\n            predlist = self.get_predlist(type)\n            predlist.add(name, factory, weighs_more_than=weighs_more_than,\n                         weighs_less_than=weighs_less_than)\n        self.action(discriminator, register, introspectables=(intr,),\n                    order=PHASE1_CONFIG) # must be registered early\n\n    @property\n    def action_info(self):\n        info = self.info # usually a ZCML action (ParserInfo) if self.info\n        if not info:\n            # Try to provide more accurate info for conflict reports\n            if self._ainfo:\n                info = self._ainfo[0]\n            else:\n                info = ActionInfo(None, 0, '', '')\n        return info\n\n    def action(self, discriminator, callable=None, args=(), kw=None, order=0,\n               introspectables=(), **extra):\n        \"\"\" Register an action which will be executed when\n        :meth:`pyramid.config.Configurator.commit` is called (or executed\n        immediately if ``autocommit`` is ``True``).\n\n        .. warning:: This method is typically only used by :app:`Pyramid`\n           framework extension authors, not by :app:`Pyramid` application\n           developers.\n\n        The ``discriminator`` uniquely identifies the action.  It must be\n        given, but it can be ``None``, to indicate that the action never\n        conflicts.  It must be a hashable value.\n\n        The ``callable`` is a callable object which performs the task\n        associated with the action when the action is executed.  It is\n        optional.\n\n        ``args`` and ``kw`` are tuple and dict objects respectively, which\n        are passed to ``callable`` when this action is executed.  Both are\n        optional.\n\n        ``order`` is a grouping mechanism; an action with a lower order will\n        be executed before an action with a higher order (has no effect when\n        autocommit is ``True``).\n\n        ``introspectables`` is a sequence of :term:`introspectable` objects\n        (or the empty sequence if no introspectable objects are associated\n        with this action).  If this configurator's ``introspection``\n        attribute is ``False``, these introspectables will be ignored.\n\n        ``extra`` provides a facility for inserting extra keys and values\n        into an action dictionary.\n        \"\"\"\n        # catch nonhashable discriminators here; most unit tests use\n        # autocommit=False, which won't catch unhashable discriminators\n        assert hash(discriminator) \n\n        if kw is None:\n            kw = {}\n\n        autocommit = self.autocommit\n        action_info = self.action_info\n\n        if not self.introspection:\n            # if we're not introspecting, ignore any introspectables passed\n            # to us\n            introspectables = ()\n\n        if autocommit:\n            # callables can depend on the side effects of resolving a\n            # deferred discriminator\n            self.begin()\n            try:\n                undefer(discriminator)\n                if callable is not None:\n                    callable(*args, **kw)\n                for introspectable in introspectables:\n                    introspectable.register(self.introspector, action_info)\n            finally:\n                self.end()\n\n        else:\n            action = extra\n            action.update(\n                dict(\n                    discriminator=discriminator,\n                    callable=callable,\n                    args=args,\n                    kw=kw,\n                    order=order,\n                    info=action_info,\n                    includepath=self.includepath,\n                    introspectables=introspectables,\n                    )\n                )\n            self.action_state.action(**action)\n\n    def _get_action_state(self):\n        registry = self.registry\n        try:\n            state = registry.action_state\n        except AttributeError:\n            state = ActionState()\n            registry.action_state = state\n        return state\n\n    def _set_action_state(self, state):\n        self.registry.action_state = state\n\n    action_state = property(_get_action_state, _set_action_state)\n\n    _ctx = action_state # bw compat\n\n    def commit(self):\n        \"\"\" Commit any pending configuration actions. If a configuration\n        conflict is detected in the pending configuration actions, this method\n        will raise a :exc:`ConfigurationConflictError`; within the traceback\n        of this error will be information about the source of the conflict,\n        usually including file names and line numbers of the cause of the\n        configuration conflicts.\"\"\"\n        self.begin()\n        try:\n            self.action_state.execute_actions(introspector=self.introspector)\n        finally:\n            self.end()\n        self.action_state = ActionState() # old actions have been processed\n\n    def include(self, callable, route_prefix=None):\n        \"\"\"Include a configuration callable, to support imperative\n        application extensibility.\n\n        .. warning:: In versions of :app:`Pyramid` prior to 1.2, this\n            function accepted ``*callables``, but this has been changed\n            to support only a single callable.\n\n        A configuration callable should be a callable that accepts a single\n        argument named ``config``, which will be an instance of a\n        :term:`Configurator`.  However, be warned that it will not be the same\n        configurator instance on which you call this method.  The\n        code which runs as a result of calling the callable should invoke\n        methods on the configurator passed to it which add configuration\n        state.  The return value of a callable will be ignored.\n\n        Values allowed to be presented via the ``callable`` argument to\n        this method: any callable Python object or any :term:`dotted Python\n        name` which resolves to a callable Python object.  It may also be a\n        Python :term:`module`, in which case, the module will be searched for\n        a callable named ``includeme``, which will be treated as the\n        configuration callable.\n\n        For example, if the ``includeme`` function below lives in a module\n        named ``myapp.myconfig``:\n\n        .. code-block:: python\n           :linenos:\n\n           # myapp.myconfig module\n\n           def my_view(request):\n               from pyramid.response import Response\n               return Response('OK')\n\n           def includeme(config):\n               config.add_view(my_view)\n\n        You might cause it to be included within your Pyramid application like\n        so:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include('myapp.myconfig.includeme')\n\n        Because the function is named ``includeme``, the function name can\n        also be omitted from the dotted name reference:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include('myapp.myconfig')\n\n        Included configuration statements will be overridden by local\n        configuration statements if an included callable causes a\n        configuration conflict by registering something with the same\n        configuration parameters.\n\n        If the ``route_prefix`` is supplied, it must be a string.  Any calls\n        to :meth:`pyramid.config.Configurator.add_route` within the included\n        callable will have their pattern prefixed with the value of\n        ``route_prefix``. This can be used to help mount a set of routes at a\n        different location than the included callable's author intended, while\n        still maintaining the same route names.  For example:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def included(config):\n               config.add_route('show_users', '/show')\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include(included, route_prefix='/users')\n\n        In the above configuration, the ``show_users`` route will have an\n        effective route pattern of ``/users/show``, instead of ``/show``\n        because the ``route_prefix`` argument will be prepended to the\n        pattern.\n\n        .. versionadded:: 1.2\n           The ``route_prefix`` parameter.\n\n        .. versionchanged:: 1.9\n           The included function is wrapped with a call to\n           :meth:`pyramid.config.Configurator.begin` and\n           :meth:`pyramid.config.Configurator.end` while it is executed.\n\n        \"\"\"\n        # \"\"\" <-- emacs\n\n        action_state = self.action_state\n\n        if route_prefix is None:\n            route_prefix = ''\n\n        old_route_prefix = self.route_prefix\n        if old_route_prefix is None:\n            old_route_prefix = ''\n\n        route_prefix = '%s/%s' % (\n            old_route_prefix.rstrip('/'),\n            route_prefix.lstrip('/')\n            )\n        route_prefix = route_prefix.strip('/')\n        if not route_prefix:\n            route_prefix = None\n\n        c = self.maybe_dotted(callable)\n        module = self.inspect.getmodule(c)\n        if module is c:\n            try:\n                c = getattr(module, 'includeme')\n            except AttributeError:\n                raise ConfigurationError(\n                    \"module %r has no attribute 'includeme'\" % (module.__name__)\n                    )\n                                                       \n        spec = module.__name__ + ':' + c.__name__\n        sourcefile = self.inspect.getsourcefile(c)\n\n        if sourcefile is None:\n            raise ConfigurationError(\n                'No source file for module %r (.py file must exist, '\n                'refusing to use orphan .pyc or .pyo file).' % module.__name__)\n            \n\n        if action_state.processSpec(spec):\n            configurator = self.__class__(\n                registry=self.registry,\n                package=package_of(module),\n                root_package=self.root_package,\n                autocommit=self.autocommit,\n                route_prefix=route_prefix,\n                )\n            configurator.basepath = os.path.dirname(sourcefile)\n            configurator.includepath = self.includepath + (spec,)\n            self.begin()\n            try:\n                c(configurator)\n            finally:\n                self.end()\n\n    def add_directive(self, name, directive, action_wrap=True):\n        \"\"\"\n        Add a directive method to the configurator.\n\n        .. warning:: This method is typically only used by :app:`Pyramid`\n           framework extension authors, not by :app:`Pyramid` application\n           developers.\n\n        Framework extenders can add directive methods to a configurator by\n        instructing their users to call ``config.add_directive('somename',\n        'some.callable')``.  This will make ``some.callable`` accessible as\n        ``config.somename``.  ``some.callable`` should be a function which\n        accepts ``config`` as a first argument, and arbitrary positional and\n        keyword arguments following.  It should use config.action as\n        necessary to perform actions.  Directive methods can then be invoked\n        like 'built-in' directives such as ``add_view``, ``add_route``, etc.\n\n        The ``action_wrap`` argument should be ``True`` for directives which\n        perform ``config.action`` with potentially conflicting\n        discriminators.  ``action_wrap`` will cause the directive to be\n        wrapped in a decorator which provides more accurate conflict\n        cause information.\n\n        ``add_directive`` does not participate in conflict detection, and\n        later calls to ``add_directive`` will override earlier calls.\n        \"\"\"\n        c = self.maybe_dotted(directive)\n        if not hasattr(self.registry, '_directives'):\n            self.registry._directives = {}\n        self.registry._directives[name] = (c, action_wrap)\n\n    def __getattr__(self, name):\n        # allow directive extension names to work\n        directives = getattr(self.registry, '_directives', {})\n        c = directives.get(name)\n        if c is None:\n            raise AttributeError(name)\n        c, action_wrap = c\n        if action_wrap:\n            c = action_method(c)\n        # Create a bound method (works on both Py2 and Py3)\n        # http://stackoverflow.com/a/1015405/209039\n        m = c.__get__(self, self.__class__)\n        return m\n\n    def with_package(self, package):\n        \"\"\" Return a new Configurator instance with the same registry\n        as this configurator. ``package`` may be an actual Python package\n        object or a :term:`dotted Python name` representing a package.\"\"\"\n        configurator = self.__class__(\n            registry=self.registry,\n            package=package,\n            root_package=self.root_package,\n            autocommit=self.autocommit,\n            route_prefix=self.route_prefix,\n            introspection=self.introspection,\n            )\n        configurator.basepath = self.basepath\n        configurator.includepath = self.includepath\n        configurator.info = self.info\n        return configurator\n\n    def maybe_dotted(self, dotted):\n        \"\"\" Resolve the :term:`dotted Python name` ``dotted`` to a\n        global Python object.  If ``dotted`` is not a string, return\n        it without attempting to do any name resolution.  If\n        ``dotted`` is a relative dotted name (e.g. ``.foo.bar``,\n        consider it relative to the ``package`` argument supplied to\n        this Configurator's constructor.\"\"\"\n        return self.name_resolver.maybe_resolve(dotted)\n\n    def absolute_asset_spec(self, relative_spec):\n        \"\"\" Resolve the potentially relative :term:`asset\n        specification` string passed as ``relative_spec`` into an\n        absolute asset specification string and return the string.\n        Use the ``package`` of this configurator as the package to\n        which the asset specification will be considered relative\n        when generating an absolute asset specification.  If the\n        provided ``relative_spec`` argument is already absolute, or if\n        the ``relative_spec`` is not a string, it is simply returned.\"\"\"\n        if not isinstance(relative_spec, string_types):\n            return relative_spec\n        return self._make_spec(relative_spec)\n\n    absolute_resource_spec = absolute_asset_spec # b/w compat forever\n\n    def begin(self, request=_marker):\n        \"\"\" Indicate that application or test configuration has begun.\n        This pushes a dictionary containing the :term:`application\n        registry` implied by ``registry`` attribute of this\n        configurator and the :term:`request` implied by the\n        ``request`` argument onto the :term:`thread local` stack\n        consulted by various :mod:`pyramid.threadlocal` API\n        functions.\n\n        If ``request`` is not specified and the registry owned by the\n        configurator is already pushed as the current threadlocal registry\n        then this method will keep the current threadlocal request unchanged.\n\n        .. versionchanged:: 1.8\n           The current threadlocal request is propagated if the current\n           threadlocal registry remains unchanged.\n\n        \"\"\"\n        if request is _marker:\n            current = self.manager.get()\n            if current['registry'] == self.registry:\n                request = current['request']\n            else:\n                request = None\n        self.manager.push({'registry':self.registry, 'request':request})\n\n    def end(self):\n        \"\"\" Indicate that application or test configuration has ended.\n        This pops the last value pushed onto the :term:`thread local`\n        stack (usually by the ``begin`` method) and returns that\n        value.\n        \"\"\"\n        return self.manager.pop()\n\n    # this is *not* an action method (uses caller_package)\n    def scan(self, package=None, categories=None, onerror=None, ignore=None,\n             **kw):\n        \"\"\"Scan a Python package and any of its subpackages for objects\n        marked with :term:`configuration decoration` such as\n        :class:`pyramid.view.view_config`.  Any decorated object found will\n        influence the current configuration state.\n\n        The ``package`` argument should be a Python :term:`package` or module\n        object (or a :term:`dotted Python name` which refers to such a\n        package or module).  If ``package`` is ``None``, the package of the\n        *caller* is used.\n\n        The ``categories`` argument, if provided, should be the\n        :term:`Venusian` 'scan categories' to use during scanning.  Providing\n        this argument is not often necessary; specifying scan categories is\n        an extremely advanced usage.  By default, ``categories`` is ``None``\n        which will execute *all* Venusian decorator callbacks including\n        :app:`Pyramid`-related decorators such as\n        :class:`pyramid.view.view_config`.  See the :term:`Venusian`\n        documentation for more information about limiting a scan by using an\n        explicit set of categories.\n\n        The ``onerror`` argument, if provided, should be a Venusian\n        ``onerror`` callback function.  The onerror function is passed to\n        :meth:`venusian.Scanner.scan` to influence error behavior when an\n        exception is raised during the scanning process.  See the\n        :term:`Venusian` documentation for more information about ``onerror``\n        callbacks.\n\n        The ``ignore`` argument, if provided, should be a Venusian ``ignore``\n        value.  Providing an ``ignore`` argument allows the scan to ignore\n        particular modules, packages, or global objects during a scan.\n        ``ignore`` can be a string or a callable, or a list containing\n        strings or callables.  The simplest usage of ``ignore`` is to provide\n        a module or package by providing a full path to its dotted name.  For\n        example: ``config.scan(ignore='my.module.subpackage')`` would ignore\n        the ``my.module.subpackage`` package during a scan, which would\n        prevent the subpackage and any of its submodules from being imported\n        and scanned.  See the :term:`Venusian` documentation for more\n        information about the ``ignore`` argument.\n\n        To perform a ``scan``, Pyramid creates a Venusian ``Scanner`` object.\n        The ``kw`` argument represents a set of keyword arguments to pass to\n        the Venusian ``Scanner`` object's constructor.  See the\n        :term:`venusian` documentation (its ``Scanner`` class) for more\n        information about the constructor.  By default, the only keyword\n        arguments passed to the Scanner constructor are ``{'config':self}``\n        where ``self`` is this configurator object.  This services the\n        requirement of all built-in Pyramid decorators, but extension systems\n        may require additional arguments.  Providing this argument is not\n        often necessary; it's an advanced usage.\n\n        .. versionadded:: 1.1\n           The ``**kw`` argument.\n\n        .. versionadded:: 1.3\n           The ``ignore`` argument.\n\n        \"\"\"\n        package = self.maybe_dotted(package)\n        if package is None: # pragma: no cover\n            package = caller_package()\n\n        ctorkw = {'config': self}\n        ctorkw.update(kw)\n\n        scanner = self.venusian.Scanner(**ctorkw)\n\n        scanner.scan(package, categories=categories, onerror=onerror,\n                     ignore=ignore)\n\n    def make_wsgi_app(self):\n        \"\"\" Commits any pending configuration statements, sends a\n        :class:`pyramid.events.ApplicationCreated` event to all listeners,\n        adds this configuration's registry to\n        :attr:`pyramid.config.global_registries`, and returns a\n        :app:`Pyramid` WSGI application representing the committed\n        configuration state.\"\"\"\n        self.commit()\n        app = Router(self.registry)\n\n        # Allow tools like \"pshell development.ini\" to find the 'last'\n        # registry configured.\n        global_registries.add(self.registry)\n\n        # Push the registry onto the stack in case any code that depends on\n        # the registry threadlocal APIs used in listeners subscribed to the\n        # IApplicationCreated event.\n        self.begin()\n        try:\n            self.registry.notify(ApplicationCreated(app))\n        finally:\n            self.end()\n\n        return app",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 95,
                                "end_lineno": 1031,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 802,
                            "length": 7
                        },
                        "new_range": {
                            "start": 807,
                            "length": 11
                        },
                        "section": "class Configurator("
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "                )",
                                "type": "context"
                            },
                            {
                                "content": "            configurator.basepath = os.path.dirname(sourcefile)",
                                "type": "context"
                            },
                            {
                                "content": "            configurator.includepath = self.includepath + (spec,)",
                                "type": "context"
                            },
                            {
                                "content": "            c(configurator)",
                                "type": "deleted"
                            },
                            {
                                "content": "            self.begin()",
                                "type": "added"
                            },
                            {
                                "content": "            try:",
                                "type": "added"
                            },
                            {
                                "content": "                c(configurator)",
                                "type": "added"
                            },
                            {
                                "content": "            finally:",
                                "type": "added"
                            },
                            {
                                "content": "                self.end()",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def add_directive(self, name, directive, action_wrap=True):",
                                "type": "context"
                            },
                            {
                                "content": "        \"\"\"",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "pyramid/config/__init__.py",
                            "type": "class",
                            "name": "Configurator",
                            "content": "class Configurator(\n    TestingConfiguratorMixin,\n    TweensConfiguratorMixin,\n    SecurityConfiguratorMixin,\n    ViewsConfiguratorMixin,\n    RoutesConfiguratorMixin,\n    ZCAConfiguratorMixin,\n    I18NConfiguratorMixin,\n    RenderingConfiguratorMixin,\n    AssetsConfiguratorMixin,\n    SettingsConfiguratorMixin,\n    FactoriesConfiguratorMixin,\n    AdaptersConfiguratorMixin,\n    ):\n    \"\"\"\n    A Configurator is used to configure a :app:`Pyramid`\n    :term:`application registry`.\n\n    If the ``registry`` argument is not ``None``, it must\n    be an instance of the :class:`pyramid.registry.Registry` class\n    representing the registry to configure.  If ``registry`` is ``None``, the\n    configurator will create a :class:`pyramid.registry.Registry` instance\n    itself; it will also perform some default configuration that would not\n    otherwise be done.  After its construction, the configurator may be used\n    to add further configuration to the registry.\n\n    .. warning:: If ``registry`` is assigned the above-mentioned class\n       instance, all other constructor arguments are ignored,\n       with the exception of ``package``.\n\n    If the ``package`` argument is passed, it must be a reference to a Python\n    :term:`package` (e.g. ``sys.modules['thepackage']``) or a :term:`dotted\n    Python name` to the same.  This value is used as a basis to convert\n    relative paths passed to various configuration methods, such as methods\n    which accept a ``renderer`` argument, into absolute paths.  If ``None``\n    is passed (the default), the package is assumed to be the Python package\n    in which the *caller* of the ``Configurator`` constructor lives.\n\n    If the ``root_package`` is passed, it will propagate through the\n    configuration hierarchy as a way for included packages to locate\n    resources relative to the package in which the main ``Configurator`` was\n    created. If ``None`` is passed (the default), the ``root_package`` will\n    be derived from the ``package`` argument. The ``package`` attribute is\n    always pointing at the package being included when using :meth:`.include`,\n    whereas the ``root_package`` does not change.\n\n    If the ``settings`` argument is passed, it should be a Python dictionary\n    representing the :term:`deployment settings` for this application.  These\n    are later retrievable using the\n    :attr:`pyramid.registry.Registry.settings` attribute (aka\n    ``request.registry.settings``).\n\n    If the ``root_factory`` argument is passed, it should be an object\n    representing the default :term:`root factory` for your application or a\n    :term:`dotted Python name` to the same.  If it is ``None``, a default\n    root factory will be used.\n\n    If ``authentication_policy`` is passed, it should be an instance\n    of an :term:`authentication policy` or a :term:`dotted Python\n    name` to the same.\n\n    If ``authorization_policy`` is passed, it should be an instance of\n    an :term:`authorization policy` or a :term:`dotted Python name` to\n    the same.\n\n    .. note:: A ``ConfigurationError`` will be raised when an\n       authorization policy is supplied without also supplying an\n       authentication policy (authorization requires authentication).\n\n    If ``renderers`` is ``None`` (the default), a default set of\n    :term:`renderer` factories is used. Else, it should be a list of\n    tuples representing a set of renderer factories which should be\n    configured into this application, and each tuple representing a set of\n    positional values that should be passed to\n    :meth:`pyramid.config.Configurator.add_renderer`.\n\n    If ``debug_logger`` is not passed, a default debug logger that logs to a\n    logger will be used (the logger name will be the package name of the\n    *caller* of this configurator).  If it is passed, it should be an\n    instance of the :class:`logging.Logger` (PEP 282) standard library class\n    or a Python logger name.  The debug logger is used by :app:`Pyramid`\n    itself to log warnings and authorization debugging information.\n\n    If ``locale_negotiator`` is passed, it should be a :term:`locale\n    negotiator` implementation or a :term:`dotted Python name` to\n    same.  See :ref:`custom_locale_negotiator`.\n\n    If ``request_factory`` is passed, it should be a :term:`request\n    factory` implementation or a :term:`dotted Python name` to the same.\n    See :ref:`changing_the_request_factory`.  By default it is ``None``,\n    which means use the default request factory.\n\n    If ``response_factory`` is passed, it should be a :term:`response\n    factory` implementation or a :term:`dotted Python name` to the same.\n    See :ref:`changing_the_response_factory`.  By default it is ``None``,\n    which means use the default response factory.\n\n    If ``default_permission`` is passed, it should be a\n    :term:`permission` string to be used as the default permission for\n    all view configuration registrations performed against this\n    Configurator.  An example of a permission string:``'view'``.\n    Adding a default permission makes it unnecessary to protect each\n    view configuration with an explicit permission, unless your\n    application policy requires some exception for a particular view.\n    By default, ``default_permission`` is ``None``, meaning that view\n    configurations which do not explicitly declare a permission will\n    always be executable by entirely anonymous users (any\n    authorization policy in effect is ignored).\n\n    .. seealso::\n\n        See also :ref:`setting_a_default_permission`.\n\n    If ``session_factory`` is passed, it should be an object which\n    implements the :term:`session factory` interface.  If a nondefault\n    value is passed, the ``session_factory`` will be used to create a\n    session object when ``request.session`` is accessed.  Note that\n    the same outcome can be achieved by calling\n    :meth:`pyramid.config.Configurator.set_session_factory`.  By\n    default, this argument is ``None``, indicating that no session\n    factory will be configured (and thus accessing ``request.session``\n    will throw an error) unless ``set_session_factory`` is called later\n    during configuration.\n\n    If ``autocommit`` is ``True``, every method called on the configurator\n    will cause an immediate action, and no configuration conflict detection\n    will be used. If ``autocommit`` is ``False``, most methods of the\n    configurator will defer their action until\n    :meth:`pyramid.config.Configurator.commit` is called.  When\n    :meth:`pyramid.config.Configurator.commit` is called, the actions implied\n    by the called methods will be checked for configuration conflicts unless\n    ``autocommit`` is ``True``.  If a conflict is detected, a\n    ``ConfigurationConflictError`` will be raised.  Calling\n    :meth:`pyramid.config.Configurator.make_wsgi_app` always implies a final\n    commit.\n\n    If ``default_view_mapper`` is passed, it will be used as the default\n    :term:`view mapper` factory for view configurations that don't otherwise\n    specify one (see :class:`pyramid.interfaces.IViewMapperFactory`).  If\n    ``default_view_mapper`` is not passed, a superdefault view mapper will be\n    used.\n\n    If ``exceptionresponse_view`` is passed, it must be a :term:`view\n    callable` or ``None``.  If it is a view callable, it will be used as an\n    exception view callable when an :term:`exception response` is raised. If\n    ``exceptionresponse_view`` is ``None``, no exception response view will\n    be registered, and all raised exception responses will be bubbled up to\n    Pyramid's caller.  By\n    default, the ``pyramid.httpexceptions.default_exceptionresponse_view``\n    function is used as the ``exceptionresponse_view``.\n\n    If ``route_prefix`` is passed, all routes added with\n    :meth:`pyramid.config.Configurator.add_route` will have the specified path\n    prepended to their pattern.\n\n    If ``introspection`` is passed, it must be a boolean value.  If it's\n    ``True``, introspection values during actions will be kept for use\n    for tools like the debug toolbar.  If it's ``False``, introspection\n    values provided by registrations will be ignored.  By default, it is\n    ``True``.\n\n    .. versionadded:: 1.1\n       The ``exceptionresponse_view`` argument.\n\n    .. versionadded:: 1.2\n       The ``route_prefix`` argument.\n\n    .. versionadded:: 1.3\n       The ``introspection`` argument.\n\n    .. versionadded:: 1.6\n       The ``root_package`` argument.\n       The ``response_factory`` argument.\n    \"\"\"\n    manager = manager # for testing injection\n    venusian = venusian # for testing injection\n    _ainfo = None\n    basepath = None\n    includepath = ()\n    info = ''\n    object_description = staticmethod(object_description)\n    introspectable = Introspectable\n    inspect = inspect\n\n    def __init__(self,\n                 registry=None,\n                 package=None,\n                 settings=None,\n                 root_factory=None,\n                 authentication_policy=None,\n                 authorization_policy=None,\n                 renderers=None,\n                 debug_logger=None,\n                 locale_negotiator=None,\n                 request_factory=None,\n                 response_factory=None,\n                 default_permission=None,\n                 session_factory=None,\n                 default_view_mapper=None,\n                 autocommit=False,\n                 exceptionresponse_view=default_exceptionresponse_view,\n                 route_prefix=None,\n                 introspection=True,\n                 root_package=None,\n                 ):\n        if package is None:\n            package = caller_package()\n        if root_package is None:\n            root_package = package\n        name_resolver = DottedNameResolver(package)\n        self.name_resolver = name_resolver\n        self.package_name = name_resolver.get_package_name()\n        self.package = name_resolver.get_package()\n        self.root_package = root_package\n        self.registry = registry\n        self.autocommit = autocommit\n        self.route_prefix = route_prefix\n        self.introspection = introspection\n        if registry is None:\n            registry = Registry(self.package_name)\n            self.registry = registry\n            self.setup_registry(\n                settings=settings,\n                root_factory=root_factory,\n                authentication_policy=authentication_policy,\n                authorization_policy=authorization_policy,\n                renderers=renderers,\n                debug_logger=debug_logger,\n                locale_negotiator=locale_negotiator,\n                request_factory=request_factory,\n                response_factory=response_factory,\n                default_permission=default_permission,\n                session_factory=session_factory,\n                default_view_mapper=default_view_mapper,\n                exceptionresponse_view=exceptionresponse_view,\n                )\n\n    def setup_registry(self,\n                       settings=None,\n                       root_factory=None,\n                       authentication_policy=None,\n                       authorization_policy=None,\n                       renderers=None,\n                       debug_logger=None,\n                       locale_negotiator=None,\n                       request_factory=None,\n                       response_factory=None,\n                       default_permission=None,\n                       session_factory=None,\n                       default_view_mapper=None,\n                       exceptionresponse_view=default_exceptionresponse_view,\n                       ):\n        \"\"\" When you pass a non-``None`` ``registry`` argument to the\n        :term:`Configurator` constructor, no initial setup is performed\n        against the registry.  This is because the registry you pass in may\n        have already been initialized for use under :app:`Pyramid` via a\n        different configurator.  However, in some circumstances (such as when\n        you want to use a global registry instead of a registry created as a\n        result of the Configurator constructor), or when you want to reset\n        the initial setup of a registry, you *do* want to explicitly\n        initialize the registry associated with a Configurator for use under\n        :app:`Pyramid`.  Use ``setup_registry`` to do this initialization.\n\n        ``setup_registry`` configures settings, a root factory, security\n        policies, renderers, a debug logger, a locale negotiator, and various\n        other settings using the configurator's current registry, as per the\n        descriptions in the Configurator constructor.\"\"\"\n\n        registry = self.registry\n\n        self._fix_registry()\n\n        self._set_settings(settings)\n\n        if isinstance(debug_logger, string_types):\n            debug_logger = logging.getLogger(debug_logger)\n\n        if debug_logger is None:\n            debug_logger = logging.getLogger(self.package_name)\n\n        registry.registerUtility(debug_logger, IDebugLogger)\n\n        self.add_default_response_adapters()\n        self.add_default_renderers()\n        self.add_default_view_predicates()\n        self.add_default_view_derivers()\n        self.add_default_route_predicates()\n        self.add_default_tweens()\n\n        if exceptionresponse_view is not None:\n            exceptionresponse_view = self.maybe_dotted(exceptionresponse_view)\n            self.add_view(exceptionresponse_view, context=IExceptionResponse)\n            self.add_view(exceptionresponse_view,context=WebobWSGIHTTPException)\n\n        # commit below because:\n        #\n        # - the default exceptionresponse_view requires the superdefault view\n        #   mapper, so we need to configure it before adding default_view_mapper\n        #\n        # - superdefault renderers should be overrideable without requiring\n        #   the user to commit before calling config.add_renderer\n\n        self.commit()\n\n        # self.commit() should not be called within this method after this\n        # point because the following registrations should be treated as\n        # analogues of methods called by the user after configurator\n        # construction.  Rationale: user-supplied implementations should be\n        # preferred rather than add-on author implementations with the help of\n        # automatic conflict resolution.\n\n        if authentication_policy and not authorization_policy:\n            authorization_policy = ACLAuthorizationPolicy() # default\n\n        if authorization_policy:\n            self.set_authorization_policy(authorization_policy)\n\n        if authentication_policy:\n            self.set_authentication_policy(authentication_policy)\n\n        if default_view_mapper is not None:\n            self.set_view_mapper(default_view_mapper)\n\n        if renderers:\n            for name, renderer in renderers:\n                self.add_renderer(name, renderer)\n\n        if root_factory is not None:\n            self.set_root_factory(root_factory)\n\n        if locale_negotiator:\n            self.set_locale_negotiator(locale_negotiator)\n\n        if request_factory:\n            self.set_request_factory(request_factory)\n\n        if response_factory:\n            self.set_response_factory(response_factory)\n\n        if default_permission:\n            self.set_default_permission(default_permission)\n\n        if session_factory is not None:\n            self.set_session_factory(session_factory)\n\n        tweens = aslist(registry.settings.get('pyramid.tweens', []))\n        for factory in tweens:\n            self._add_tween(factory, explicit=True)\n\n        includes = aslist(registry.settings.get('pyramid.includes', []))\n        for inc in includes:\n            self.include(inc)\n\n    def _make_spec(self, path_or_spec):\n        package, filename = resolve_asset_spec(path_or_spec, self.package_name)\n        if package is None:\n            return filename # absolute filename\n        return '%s:%s' % (package, filename)\n\n    def _fix_registry(self):\n        \"\"\" Fix up a ZCA component registry that is not a\n        pyramid.registry.Registry by adding analogues of ``has_listeners``,\n        ``notify``, ``queryAdapterOrSelf``, and ``registerSelfAdapter``\n        through monkey-patching.\"\"\"\n\n        _registry = self.registry\n\n        if not hasattr(_registry, 'notify'):\n            def notify(*events):\n                [ _ for _ in _registry.subscribers(events, None) ]\n            _registry.notify = notify\n\n        if not hasattr(_registry, 'has_listeners'):\n            _registry.has_listeners = True\n\n        if not hasattr(_registry, 'queryAdapterOrSelf'):\n            def queryAdapterOrSelf(object, interface, default=None):\n                if not interface.providedBy(object):\n                    return _registry.queryAdapter(object, interface,\n                                                  default=default)\n                return object\n            _registry.queryAdapterOrSelf = queryAdapterOrSelf\n\n        if not hasattr(_registry, 'registerSelfAdapter'):\n            def registerSelfAdapter(required=None, provided=None,\n                                    name=empty, info=empty, event=True):\n                return _registry.registerAdapter(lambda x: x,\n                                                 required=required,\n                                                 provided=provided, name=name,\n                                                 info=info, event=event)\n            _registry.registerSelfAdapter = registerSelfAdapter\n\n        if not hasattr(_registry, '_lock'):\n            _registry._lock = threading.Lock()\n\n        if not hasattr(_registry, '_clear_view_lookup_cache'):\n            def _clear_view_lookup_cache():\n                _registry._view_lookup_cache = {}\n            _registry._clear_view_lookup_cache = _clear_view_lookup_cache\n\n\n    # API\n\n    def _get_introspector(self):\n        introspector = getattr(self.registry, 'introspector', _marker)\n        if introspector is _marker:\n            introspector = Introspector()\n            self._set_introspector(introspector)\n        return introspector\n\n    def _set_introspector(self, introspector):\n        self.registry.introspector = introspector\n\n    def _del_introspector(self):\n        del self.registry.introspector\n\n    introspector = property(\n        _get_introspector, _set_introspector, _del_introspector\n        )\n\n    def get_predlist(self, name):\n        predlist = self.registry.queryUtility(IPredicateList, name=name)\n        if predlist is None:\n            predlist = PredicateList()\n            self.registry.registerUtility(predlist, IPredicateList, name=name)\n        return predlist\n\n\n    def _add_predicate(self, type, name, factory, weighs_more_than=None,\n                       weighs_less_than=None):\n        factory = self.maybe_dotted(factory)\n        discriminator = ('%s option' % type, name)\n        intr = self.introspectable(\n            '%s predicates' % type,\n            discriminator,\n            '%s predicate named %s' % (type, name),\n            '%s predicate' % type)\n        intr['name'] = name\n        intr['factory'] = factory\n        intr['weighs_more_than'] = weighs_more_than\n        intr['weighs_less_than'] = weighs_less_than\n        def register():\n            predlist = self.get_predlist(type)\n            predlist.add(name, factory, weighs_more_than=weighs_more_than,\n                         weighs_less_than=weighs_less_than)\n        self.action(discriminator, register, introspectables=(intr,),\n                    order=PHASE1_CONFIG) # must be registered early\n\n    @property\n    def action_info(self):\n        info = self.info # usually a ZCML action (ParserInfo) if self.info\n        if not info:\n            # Try to provide more accurate info for conflict reports\n            if self._ainfo:\n                info = self._ainfo[0]\n            else:\n                info = ActionInfo(None, 0, '', '')\n        return info\n\n    def action(self, discriminator, callable=None, args=(), kw=None, order=0,\n               introspectables=(), **extra):\n        \"\"\" Register an action which will be executed when\n        :meth:`pyramid.config.Configurator.commit` is called (or executed\n        immediately if ``autocommit`` is ``True``).\n\n        .. warning:: This method is typically only used by :app:`Pyramid`\n           framework extension authors, not by :app:`Pyramid` application\n           developers.\n\n        The ``discriminator`` uniquely identifies the action.  It must be\n        given, but it can be ``None``, to indicate that the action never\n        conflicts.  It must be a hashable value.\n\n        The ``callable`` is a callable object which performs the task\n        associated with the action when the action is executed.  It is\n        optional.\n\n        ``args`` and ``kw`` are tuple and dict objects respectively, which\n        are passed to ``callable`` when this action is executed.  Both are\n        optional.\n\n        ``order`` is a grouping mechanism; an action with a lower order will\n        be executed before an action with a higher order (has no effect when\n        autocommit is ``True``).\n\n        ``introspectables`` is a sequence of :term:`introspectable` objects\n        (or the empty sequence if no introspectable objects are associated\n        with this action).  If this configurator's ``introspection``\n        attribute is ``False``, these introspectables will be ignored.\n\n        ``extra`` provides a facility for inserting extra keys and values\n        into an action dictionary.\n        \"\"\"\n        # catch nonhashable discriminators here; most unit tests use\n        # autocommit=False, which won't catch unhashable discriminators\n        assert hash(discriminator) \n\n        if kw is None:\n            kw = {}\n\n        autocommit = self.autocommit\n        action_info = self.action_info\n\n        if not self.introspection:\n            # if we're not introspecting, ignore any introspectables passed\n            # to us\n            introspectables = ()\n\n        if autocommit:\n            # callables can depend on the side effects of resolving a\n            # deferred discriminator\n            self.begin()\n            try:\n                undefer(discriminator)\n                if callable is not None:\n                    callable(*args, **kw)\n                for introspectable in introspectables:\n                    introspectable.register(self.introspector, action_info)\n            finally:\n                self.end()\n\n        else:\n            action = extra\n            action.update(\n                dict(\n                    discriminator=discriminator,\n                    callable=callable,\n                    args=args,\n                    kw=kw,\n                    order=order,\n                    info=action_info,\n                    includepath=self.includepath,\n                    introspectables=introspectables,\n                    )\n                )\n            self.action_state.action(**action)\n\n    def _get_action_state(self):\n        registry = self.registry\n        try:\n            state = registry.action_state\n        except AttributeError:\n            state = ActionState()\n            registry.action_state = state\n        return state\n\n    def _set_action_state(self, state):\n        self.registry.action_state = state\n\n    action_state = property(_get_action_state, _set_action_state)\n\n    _ctx = action_state # bw compat\n\n    def commit(self):\n        \"\"\" Commit any pending configuration actions. If a configuration\n        conflict is detected in the pending configuration actions, this method\n        will raise a :exc:`ConfigurationConflictError`; within the traceback\n        of this error will be information about the source of the conflict,\n        usually including file names and line numbers of the cause of the\n        configuration conflicts.\"\"\"\n        self.begin()\n        try:\n            self.action_state.execute_actions(introspector=self.introspector)\n        finally:\n            self.end()\n        self.action_state = ActionState() # old actions have been processed\n\n    def include(self, callable, route_prefix=None):\n        \"\"\"Include a configuration callable, to support imperative\n        application extensibility.\n\n        .. warning:: In versions of :app:`Pyramid` prior to 1.2, this\n            function accepted ``*callables``, but this has been changed\n            to support only a single callable.\n\n        A configuration callable should be a callable that accepts a single\n        argument named ``config``, which will be an instance of a\n        :term:`Configurator`.  However, be warned that it will not be the same\n        configurator instance on which you call this method.  The\n        code which runs as a result of calling the callable should invoke\n        methods on the configurator passed to it which add configuration\n        state.  The return value of a callable will be ignored.\n\n        Values allowed to be presented via the ``callable`` argument to\n        this method: any callable Python object or any :term:`dotted Python\n        name` which resolves to a callable Python object.  It may also be a\n        Python :term:`module`, in which case, the module will be searched for\n        a callable named ``includeme``, which will be treated as the\n        configuration callable.\n\n        For example, if the ``includeme`` function below lives in a module\n        named ``myapp.myconfig``:\n\n        .. code-block:: python\n           :linenos:\n\n           # myapp.myconfig module\n\n           def my_view(request):\n               from pyramid.response import Response\n               return Response('OK')\n\n           def includeme(config):\n               config.add_view(my_view)\n\n        You might cause it to be included within your Pyramid application like\n        so:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include('myapp.myconfig.includeme')\n\n        Because the function is named ``includeme``, the function name can\n        also be omitted from the dotted name reference:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include('myapp.myconfig')\n\n        Included configuration statements will be overridden by local\n        configuration statements if an included callable causes a\n        configuration conflict by registering something with the same\n        configuration parameters.\n\n        If the ``route_prefix`` is supplied, it must be a string.  Any calls\n        to :meth:`pyramid.config.Configurator.add_route` within the included\n        callable will have their pattern prefixed with the value of\n        ``route_prefix``. This can be used to help mount a set of routes at a\n        different location than the included callable's author intended, while\n        still maintaining the same route names.  For example:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def included(config):\n               config.add_route('show_users', '/show')\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include(included, route_prefix='/users')\n\n        In the above configuration, the ``show_users`` route will have an\n        effective route pattern of ``/users/show``, instead of ``/show``\n        because the ``route_prefix`` argument will be prepended to the\n        pattern.\n\n        .. versionadded:: 1.2\n           The ``route_prefix`` parameter.\n\n        \"\"\"\n        # \"\"\" <-- emacs\n\n        action_state = self.action_state\n\n        if route_prefix is None:\n            route_prefix = ''\n\n        old_route_prefix = self.route_prefix\n        if old_route_prefix is None:\n            old_route_prefix = ''\n\n        route_prefix = '%s/%s' % (\n            old_route_prefix.rstrip('/'),\n            route_prefix.lstrip('/')\n            )\n        route_prefix = route_prefix.strip('/')\n        if not route_prefix:\n            route_prefix = None\n\n        c = self.maybe_dotted(callable)\n        module = self.inspect.getmodule(c)\n        if module is c:\n            try:\n                c = getattr(module, 'includeme')\n            except AttributeError:\n                raise ConfigurationError(\n                    \"module %r has no attribute 'includeme'\" % (module.__name__)\n                    )\n                                                       \n        spec = module.__name__ + ':' + c.__name__\n        sourcefile = self.inspect.getsourcefile(c)\n\n        if sourcefile is None:\n            raise ConfigurationError(\n                'No source file for module %r (.py file must exist, '\n                'refusing to use orphan .pyc or .pyo file).' % module.__name__)\n            \n\n        if action_state.processSpec(spec):\n            configurator = self.__class__(\n                registry=self.registry,\n                package=package_of(module),\n                root_package=self.root_package,\n                autocommit=self.autocommit,\n                route_prefix=route_prefix,\n                )\n            configurator.basepath = os.path.dirname(sourcefile)\n            configurator.includepath = self.includepath + (spec,)\n            c(configurator)\n\n    def add_directive(self, name, directive, action_wrap=True):\n        \"\"\"\n        Add a directive method to the configurator.\n\n        .. warning:: This method is typically only used by :app:`Pyramid`\n           framework extension authors, not by :app:`Pyramid` application\n           developers.\n\n        Framework extenders can add directive methods to a configurator by\n        instructing their users to call ``config.add_directive('somename',\n        'some.callable')``.  This will make ``some.callable`` accessible as\n        ``config.somename``.  ``some.callable`` should be a function which\n        accepts ``config`` as a first argument, and arbitrary positional and\n        keyword arguments following.  It should use config.action as\n        necessary to perform actions.  Directive methods can then be invoked\n        like 'built-in' directives such as ``add_view``, ``add_route``, etc.\n\n        The ``action_wrap`` argument should be ``True`` for directives which\n        perform ``config.action`` with potentially conflicting\n        discriminators.  ``action_wrap`` will cause the directive to be\n        wrapped in a decorator which provides more accurate conflict\n        cause information.\n\n        ``add_directive`` does not participate in conflict detection, and\n        later calls to ``add_directive`` will override earlier calls.\n        \"\"\"\n        c = self.maybe_dotted(directive)\n        if not hasattr(self.registry, '_directives'):\n            self.registry._directives = {}\n        self.registry._directives[name] = (c, action_wrap)\n\n    def __getattr__(self, name):\n        # allow directive extension names to work\n        directives = getattr(self.registry, '_directives', {})\n        c = directives.get(name)\n        if c is None:\n            raise AttributeError(name)\n        c, action_wrap = c\n        if action_wrap:\n            c = action_method(c)\n        # Create a bound method (works on both Py2 and Py3)\n        # http://stackoverflow.com/a/1015405/209039\n        m = c.__get__(self, self.__class__)\n        return m\n\n    def with_package(self, package):\n        \"\"\" Return a new Configurator instance with the same registry\n        as this configurator. ``package`` may be an actual Python package\n        object or a :term:`dotted Python name` representing a package.\"\"\"\n        configurator = self.__class__(\n            registry=self.registry,\n            package=package,\n            root_package=self.root_package,\n            autocommit=self.autocommit,\n            route_prefix=self.route_prefix,\n            introspection=self.introspection,\n            )\n        configurator.basepath = self.basepath\n        configurator.includepath = self.includepath\n        configurator.info = self.info\n        return configurator\n\n    def maybe_dotted(self, dotted):\n        \"\"\" Resolve the :term:`dotted Python name` ``dotted`` to a\n        global Python object.  If ``dotted`` is not a string, return\n        it without attempting to do any name resolution.  If\n        ``dotted`` is a relative dotted name (e.g. ``.foo.bar``,\n        consider it relative to the ``package`` argument supplied to\n        this Configurator's constructor.\"\"\"\n        return self.name_resolver.maybe_resolve(dotted)\n\n    def absolute_asset_spec(self, relative_spec):\n        \"\"\" Resolve the potentially relative :term:`asset\n        specification` string passed as ``relative_spec`` into an\n        absolute asset specification string and return the string.\n        Use the ``package`` of this configurator as the package to\n        which the asset specification will be considered relative\n        when generating an absolute asset specification.  If the\n        provided ``relative_spec`` argument is already absolute, or if\n        the ``relative_spec`` is not a string, it is simply returned.\"\"\"\n        if not isinstance(relative_spec, string_types):\n            return relative_spec\n        return self._make_spec(relative_spec)\n\n    absolute_resource_spec = absolute_asset_spec # b/w compat forever\n\n    def begin(self, request=_marker):\n        \"\"\" Indicate that application or test configuration has begun.\n        This pushes a dictionary containing the :term:`application\n        registry` implied by ``registry`` attribute of this\n        configurator and the :term:`request` implied by the\n        ``request`` argument onto the :term:`thread local` stack\n        consulted by various :mod:`pyramid.threadlocal` API\n        functions.\n\n        If ``request`` is not specified and the registry owned by the\n        configurator is already pushed as the current threadlocal registry\n        then this method will keep the current threadlocal request unchanged.\n\n        .. versionchanged:: 1.8\n           The current threadlocal request is propagated if the current\n           threadlocal registry remains unchanged.\n\n        \"\"\"\n        if request is _marker:\n            current = self.manager.get()\n            if current['registry'] == self.registry:\n                request = current['request']\n            else:\n                request = None\n        self.manager.push({'registry':self.registry, 'request':request})\n\n    def end(self):\n        \"\"\" Indicate that application or test configuration has ended.\n        This pops the last value pushed onto the :term:`thread local`\n        stack (usually by the ``begin`` method) and returns that\n        value.\n        \"\"\"\n        return self.manager.pop()\n\n    # this is *not* an action method (uses caller_package)\n    def scan(self, package=None, categories=None, onerror=None, ignore=None,\n             **kw):\n        \"\"\"Scan a Python package and any of its subpackages for objects\n        marked with :term:`configuration decoration` such as\n        :class:`pyramid.view.view_config`.  Any decorated object found will\n        influence the current configuration state.\n\n        The ``package`` argument should be a Python :term:`package` or module\n        object (or a :term:`dotted Python name` which refers to such a\n        package or module).  If ``package`` is ``None``, the package of the\n        *caller* is used.\n\n        The ``categories`` argument, if provided, should be the\n        :term:`Venusian` 'scan categories' to use during scanning.  Providing\n        this argument is not often necessary; specifying scan categories is\n        an extremely advanced usage.  By default, ``categories`` is ``None``\n        which will execute *all* Venusian decorator callbacks including\n        :app:`Pyramid`-related decorators such as\n        :class:`pyramid.view.view_config`.  See the :term:`Venusian`\n        documentation for more information about limiting a scan by using an\n        explicit set of categories.\n\n        The ``onerror`` argument, if provided, should be a Venusian\n        ``onerror`` callback function.  The onerror function is passed to\n        :meth:`venusian.Scanner.scan` to influence error behavior when an\n        exception is raised during the scanning process.  See the\n        :term:`Venusian` documentation for more information about ``onerror``\n        callbacks.\n\n        The ``ignore`` argument, if provided, should be a Venusian ``ignore``\n        value.  Providing an ``ignore`` argument allows the scan to ignore\n        particular modules, packages, or global objects during a scan.\n        ``ignore`` can be a string or a callable, or a list containing\n        strings or callables.  The simplest usage of ``ignore`` is to provide\n        a module or package by providing a full path to its dotted name.  For\n        example: ``config.scan(ignore='my.module.subpackage')`` would ignore\n        the ``my.module.subpackage`` package during a scan, which would\n        prevent the subpackage and any of its submodules from being imported\n        and scanned.  See the :term:`Venusian` documentation for more\n        information about the ``ignore`` argument.\n\n        To perform a ``scan``, Pyramid creates a Venusian ``Scanner`` object.\n        The ``kw`` argument represents a set of keyword arguments to pass to\n        the Venusian ``Scanner`` object's constructor.  See the\n        :term:`venusian` documentation (its ``Scanner`` class) for more\n        information about the constructor.  By default, the only keyword\n        arguments passed to the Scanner constructor are ``{'config':self}``\n        where ``self`` is this configurator object.  This services the\n        requirement of all built-in Pyramid decorators, but extension systems\n        may require additional arguments.  Providing this argument is not\n        often necessary; it's an advanced usage.\n\n        .. versionadded:: 1.1\n           The ``**kw`` argument.\n\n        .. versionadded:: 1.3\n           The ``ignore`` argument.\n\n        \"\"\"\n        package = self.maybe_dotted(package)\n        if package is None: # pragma: no cover\n            package = caller_package()\n\n        ctorkw = {'config': self}\n        ctorkw.update(kw)\n\n        scanner = self.venusian.Scanner(**ctorkw)\n\n        scanner.scan(package, categories=categories, onerror=onerror,\n                     ignore=ignore)\n\n    def make_wsgi_app(self):\n        \"\"\" Commits any pending configuration statements, sends a\n        :class:`pyramid.events.ApplicationCreated` event to all listeners,\n        adds this configuration's registry to\n        :attr:`pyramid.config.global_registries`, and returns a\n        :app:`Pyramid` WSGI application representing the committed\n        configuration state.\"\"\"\n        self.commit()\n        app = Router(self.registry)\n\n        # Allow tools like \"pshell development.ini\" to find the 'last'\n        # registry configured.\n        global_registries.add(self.registry)\n\n        # Push the registry onto the stack in case any code that depends on\n        # the registry threadlocal APIs used in listeners subscribed to the\n        # IApplicationCreated event.\n        self.begin()\n        try:\n            self.registry.notify(ApplicationCreated(app))\n        finally:\n            self.end()\n\n        return app",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 95,
                            "end_lineno": 1022,
                            "parent": null
                        },
                        {
                            "file_name": "pyramid/config/__init__.py",
                            "type": "method",
                            "name": "Configurator.include",
                            "content": "class Configurator(\n    TestingConfiguratorMixin,\n    TweensConfiguratorMixin,\n    SecurityConfiguratorMixin,\n    ViewsConfiguratorMixin,\n    RoutesConfiguratorMixin,\n    ZCAConfiguratorMixin,\n    I18NConfiguratorMixin,\n    RenderingConfiguratorMixin,\n    AssetsConfiguratorMixin,\n    SettingsConfiguratorMixin,\n    FactoriesConfiguratorMixin,\n    AdaptersConfiguratorMixin,\n    ):\n    \"\"\"\n    A Configurator is used to configure a :app:`Pyramid`\n    :term:`application registry`.\n\n    If the ``registry`` argument is not ``None``, it must\n    be an instance of the :class:`pyramid.registry.Registry` class\n    representing the registry to configure.  If ``registry`` is ``None``, the\n    configurator will create a :class:`pyramid.registry.Registry` instance\n    itself; it will also perform some default configuration that would not\n    otherwise be done.  After its construction, the configurator may be used\n    to add further configuration to the registry.\n\n    .. warning:: If ``registry`` is assigned the above-mentioned class\n       instance, all other constructor arguments are ignored,\n       with the exception of ``package``.\n\n    If the ``package`` argument is passed, it must be a reference to a Python\n    :term:`package` (e.g. ``sys.modules['thepackage']``) or a :term:`dotted\n    Python name` to the same.  This value is used as a basis to convert\n    relative paths passed to various configuration methods, such as methods\n    which accept a ``renderer`` argument, into absolute paths.  If ``None``\n    is passed (the default), the package is assumed to be the Python package\n    in which the *caller* of the ``Configurator`` constructor lives.\n\n    If the ``root_package`` is passed, it will propagate through the\n    configuration hierarchy as a way for included packages to locate\n    resources relative to the package in which the main ``Configurator`` was\n    created. If ``None`` is passed (the default), the ``root_package`` will\n    be derived from the ``package`` argument. The ``package`` attribute is\n    always pointing at the package being included when using :meth:`.include`,\n    whereas the ``root_package`` does not change.\n\n    If the ``settings`` argument is passed, it should be a Python dictionary\n    representing the :term:`deployment settings` for this application.  These\n    are later retrievable using the\n    :attr:`pyramid.registry.Registry.settings` attribute (aka\n    ``request.registry.settings``).\n\n    If the ``root_factory`` argument is passed, it should be an object\n    representing the default :term:`root factory` for your application or a\n    :term:`dotted Python name` to the same.  If it is ``None``, a default\n    root factory will be used.\n\n    If ``authentication_policy`` is passed, it should be an instance\n    of an :term:`authentication policy` or a :term:`dotted Python\n    name` to the same.\n\n    If ``authorization_policy`` is passed, it should be an instance of\n    an :term:`authorization policy` or a :term:`dotted Python name` to\n    the same.\n\n    .. note:: A ``ConfigurationError`` will be raised when an\n       authorization policy is supplied without also supplying an\n       authentication policy (authorization requires authentication).\n\n    If ``renderers`` is ``None`` (the default), a default set of\n    :term:`renderer` factories is used. Else, it should be a list of\n    tuples representing a set of renderer factories which should be\n    configured into this application, and each tuple representing a set of\n    positional values that should be passed to\n    :meth:`pyramid.config.Configurator.add_renderer`.\n\n    If ``debug_logger`` is not passed, a default debug logger that logs to a\n    logger will be used (the logger name will be the package name of the\n    *caller* of this configurator).  If it is passed, it should be an\n    instance of the :class:`logging.Logger` (PEP 282) standard library class\n    or a Python logger name.  The debug logger is used by :app:`Pyramid`\n    itself to log warnings and authorization debugging information.\n\n    If ``locale_negotiator`` is passed, it should be a :term:`locale\n    negotiator` implementation or a :term:`dotted Python name` to\n    same.  See :ref:`custom_locale_negotiator`.\n\n    If ``request_factory`` is passed, it should be a :term:`request\n    factory` implementation or a :term:`dotted Python name` to the same.\n    See :ref:`changing_the_request_factory`.  By default it is ``None``,\n    which means use the default request factory.\n\n    If ``response_factory`` is passed, it should be a :term:`response\n    factory` implementation or a :term:`dotted Python name` to the same.\n    See :ref:`changing_the_response_factory`.  By default it is ``None``,\n    which means use the default response factory.\n\n    If ``default_permission`` is passed, it should be a\n    :term:`permission` string to be used as the default permission for\n    all view configuration registrations performed against this\n    Configurator.  An example of a permission string:``'view'``.\n    Adding a default permission makes it unnecessary to protect each\n    view configuration with an explicit permission, unless your\n    application policy requires some exception for a particular view.\n    By default, ``default_permission`` is ``None``, meaning that view\n    configurations which do not explicitly declare a permission will\n    always be executable by entirely anonymous users (any\n    authorization policy in effect is ignored).\n\n    .. seealso::\n\n        See also :ref:`setting_a_default_permission`.\n\n    If ``session_factory`` is passed, it should be an object which\n    implements the :term:`session factory` interface.  If a nondefault\n    value is passed, the ``session_factory`` will be used to create a\n    session object when ``request.session`` is accessed.  Note that\n    the same outcome can be achieved by calling\n    :meth:`pyramid.config.Configurator.set_session_factory`.  By\n    default, this argument is ``None``, indicating that no session\n    factory will be configured (and thus accessing ``request.session``\n    will throw an error) unless ``set_session_factory`` is called later\n    during configuration.\n\n    If ``autocommit`` is ``True``, every method called on the configurator\n    will cause an immediate action, and no configuration conflict detection\n    will be used. If ``autocommit`` is ``False``, most methods of the\n    configurator will defer their action until\n    :meth:`pyramid.config.Configurator.commit` is called.  When\n    :meth:`pyramid.config.Configurator.commit` is called, the actions implied\n    by the called methods will be checked for configuration conflicts unless\n    ``autocommit`` is ``True``.  If a conflict is detected, a\n    ``ConfigurationConflictError`` will be raised.  Calling\n    :meth:`pyramid.config.Configurator.make_wsgi_app` always implies a final\n    commit.\n\n    If ``default_view_mapper`` is passed, it will be used as the default\n    :term:`view mapper` factory for view configurations that don't otherwise\n    specify one (see :class:`pyramid.interfaces.IViewMapperFactory`).  If\n    ``default_view_mapper`` is not passed, a superdefault view mapper will be\n    used.\n\n    If ``exceptionresponse_view`` is passed, it must be a :term:`view\n    callable` or ``None``.  If it is a view callable, it will be used as an\n    exception view callable when an :term:`exception response` is raised. If\n    ``exceptionresponse_view`` is ``None``, no exception response view will\n    be registered, and all raised exception responses will be bubbled up to\n    Pyramid's caller.  By\n    default, the ``pyramid.httpexceptions.default_exceptionresponse_view``\n    function is used as the ``exceptionresponse_view``.\n\n    If ``route_prefix`` is passed, all routes added with\n    :meth:`pyramid.config.Configurator.add_route` will have the specified path\n    prepended to their pattern.\n\n    If ``introspection`` is passed, it must be a boolean value.  If it's\n    ``True``, introspection values during actions will be kept for use\n    for tools like the debug toolbar.  If it's ``False``, introspection\n    values provided by registrations will be ignored.  By default, it is\n    ``True``.\n\n    .. versionadded:: 1.1\n       The ``exceptionresponse_view`` argument.\n\n    .. versionadded:: 1.2\n       The ``route_prefix`` argument.\n\n    .. versionadded:: 1.3\n       The ``introspection`` argument.\n\n    .. versionadded:: 1.6\n       The ``root_package`` argument.\n       The ``response_factory`` argument.\n    \"\"\"\n    manager = manager # for testing injection\n    venusian = venusian # for testing injection\n    _ainfo = None\n    basepath = None\n    includepath = ()\n    info = ''\n    object_description = staticmethod(object_description)\n    introspectable = Introspectable\n    inspect = inspect\n\n    def __init__(self,\n                 registry=None,\n                 package=None,\n                 settings=None,\n                 root_factory=None,\n                 authentication_policy=None,\n                 authorization_policy=None,\n                 renderers=None,\n                 debug_logger=None,\n                 locale_negotiator=None,\n                 request_factory=None,\n                 response_factory=None,\n                 default_permission=None,\n                 session_factory=None,\n                 default_view_mapper=None,\n                 autocommit=False,\n                 exceptionresponse_view=default_exceptionresponse_view,\n                 route_prefix=None,\n                 introspection=True,\n                 root_package=None,\n                 ):\n        if package is None:\n            package = caller_package()\n        if root_package is None:\n            root_package = package\n        name_resolver = DottedNameResolver(package)\n        self.name_resolver = name_resolver\n        self.package_name = name_resolver.get_package_name()\n        self.package = name_resolver.get_package()\n        self.root_package = root_package\n        self.registry = registry\n        self.autocommit = autocommit\n        self.route_prefix = route_prefix\n        self.introspection = introspection\n        if registry is None:\n            registry = Registry(self.package_name)\n            self.registry = registry\n            self.setup_registry(\n                settings=settings,\n                root_factory=root_factory,\n                authentication_policy=authentication_policy,\n                authorization_policy=authorization_policy,\n                renderers=renderers,\n                debug_logger=debug_logger,\n                locale_negotiator=locale_negotiator,\n                request_factory=request_factory,\n                response_factory=response_factory,\n                default_permission=default_permission,\n                session_factory=session_factory,\n                default_view_mapper=default_view_mapper,\n                exceptionresponse_view=exceptionresponse_view,\n                )\n\n    def setup_registry(self,\n                       settings=None,\n                       root_factory=None,\n                       authentication_policy=None,\n                       authorization_policy=None,\n                       renderers=None,\n                       debug_logger=None,\n                       locale_negotiator=None,\n                       request_factory=None,\n                       response_factory=None,\n                       default_permission=None,\n                       session_factory=None,\n                       default_view_mapper=None,\n                       exceptionresponse_view=default_exceptionresponse_view,\n                       ):\n        \"\"\" When you pass a non-``None`` ``registry`` argument to the\n        :term:`Configurator` constructor, no initial setup is performed\n        against the registry.  This is because the registry you pass in may\n        have already been initialized for use under :app:`Pyramid` via a\n        different configurator.  However, in some circumstances (such as when\n        you want to use a global registry instead of a registry created as a\n        result of the Configurator constructor), or when you want to reset\n        the initial setup of a registry, you *do* want to explicitly\n        initialize the registry associated with a Configurator for use under\n        :app:`Pyramid`.  Use ``setup_registry`` to do this initialization.\n\n        ``setup_registry`` configures settings, a root factory, security\n        policies, renderers, a debug logger, a locale negotiator, and various\n        other settings using the configurator's current registry, as per the\n        descriptions in the Configurator constructor.\"\"\"\n\n        registry = self.registry\n\n        self._fix_registry()\n\n        self._set_settings(settings)\n\n        if isinstance(debug_logger, string_types):\n            debug_logger = logging.getLogger(debug_logger)\n\n        if debug_logger is None:\n            debug_logger = logging.getLogger(self.package_name)\n\n        registry.registerUtility(debug_logger, IDebugLogger)\n\n        self.add_default_response_adapters()\n        self.add_default_renderers()\n        self.add_default_view_predicates()\n        self.add_default_view_derivers()\n        self.add_default_route_predicates()\n        self.add_default_tweens()\n\n        if exceptionresponse_view is not None:\n            exceptionresponse_view = self.maybe_dotted(exceptionresponse_view)\n            self.add_view(exceptionresponse_view, context=IExceptionResponse)\n            self.add_view(exceptionresponse_view,context=WebobWSGIHTTPException)\n\n        # commit below because:\n        #\n        # - the default exceptionresponse_view requires the superdefault view\n        #   mapper, so we need to configure it before adding default_view_mapper\n        #\n        # - superdefault renderers should be overrideable without requiring\n        #   the user to commit before calling config.add_renderer\n\n        self.commit()\n\n        # self.commit() should not be called within this method after this\n        # point because the following registrations should be treated as\n        # analogues of methods called by the user after configurator\n        # construction.  Rationale: user-supplied implementations should be\n        # preferred rather than add-on author implementations with the help of\n        # automatic conflict resolution.\n\n        if authentication_policy and not authorization_policy:\n            authorization_policy = ACLAuthorizationPolicy() # default\n\n        if authorization_policy:\n            self.set_authorization_policy(authorization_policy)\n\n        if authentication_policy:\n            self.set_authentication_policy(authentication_policy)\n\n        if default_view_mapper is not None:\n            self.set_view_mapper(default_view_mapper)\n\n        if renderers:\n            for name, renderer in renderers:\n                self.add_renderer(name, renderer)\n\n        if root_factory is not None:\n            self.set_root_factory(root_factory)\n\n        if locale_negotiator:\n            self.set_locale_negotiator(locale_negotiator)\n\n        if request_factory:\n            self.set_request_factory(request_factory)\n\n        if response_factory:\n            self.set_response_factory(response_factory)\n\n        if default_permission:\n            self.set_default_permission(default_permission)\n\n        if session_factory is not None:\n            self.set_session_factory(session_factory)\n\n        tweens = aslist(registry.settings.get('pyramid.tweens', []))\n        for factory in tweens:\n            self._add_tween(factory, explicit=True)\n\n        includes = aslist(registry.settings.get('pyramid.includes', []))\n        for inc in includes:\n            self.include(inc)\n\n    def _make_spec(self, path_or_spec):\n        package, filename = resolve_asset_spec(path_or_spec, self.package_name)\n        if package is None:\n            return filename # absolute filename\n        return '%s:%s' % (package, filename)\n\n    def _fix_registry(self):\n        \"\"\" Fix up a ZCA component registry that is not a\n        pyramid.registry.Registry by adding analogues of ``has_listeners``,\n        ``notify``, ``queryAdapterOrSelf``, and ``registerSelfAdapter``\n        through monkey-patching.\"\"\"\n\n        _registry = self.registry\n\n        if not hasattr(_registry, 'notify'):\n            def notify(*events):\n                [ _ for _ in _registry.subscribers(events, None) ]\n            _registry.notify = notify\n\n        if not hasattr(_registry, 'has_listeners'):\n            _registry.has_listeners = True\n\n        if not hasattr(_registry, 'queryAdapterOrSelf'):\n            def queryAdapterOrSelf(object, interface, default=None):\n                if not interface.providedBy(object):\n                    return _registry.queryAdapter(object, interface,\n                                                  default=default)\n                return object\n            _registry.queryAdapterOrSelf = queryAdapterOrSelf\n\n        if not hasattr(_registry, 'registerSelfAdapter'):\n            def registerSelfAdapter(required=None, provided=None,\n                                    name=empty, info=empty, event=True):\n                return _registry.registerAdapter(lambda x: x,\n                                                 required=required,\n                                                 provided=provided, name=name,\n                                                 info=info, event=event)\n            _registry.registerSelfAdapter = registerSelfAdapter\n\n        if not hasattr(_registry, '_lock'):\n            _registry._lock = threading.Lock()\n\n        if not hasattr(_registry, '_clear_view_lookup_cache'):\n            def _clear_view_lookup_cache():\n                _registry._view_lookup_cache = {}\n            _registry._clear_view_lookup_cache = _clear_view_lookup_cache\n\n\n    # API\n\n    def _get_introspector(self):\n        introspector = getattr(self.registry, 'introspector', _marker)\n        if introspector is _marker:\n            introspector = Introspector()\n            self._set_introspector(introspector)\n        return introspector\n\n    def _set_introspector(self, introspector):\n        self.registry.introspector = introspector\n\n    def _del_introspector(self):\n        del self.registry.introspector\n\n    introspector = property(\n        _get_introspector, _set_introspector, _del_introspector\n        )\n\n    def get_predlist(self, name):\n        predlist = self.registry.queryUtility(IPredicateList, name=name)\n        if predlist is None:\n            predlist = PredicateList()\n            self.registry.registerUtility(predlist, IPredicateList, name=name)\n        return predlist\n\n\n    def _add_predicate(self, type, name, factory, weighs_more_than=None,\n                       weighs_less_than=None):\n        factory = self.maybe_dotted(factory)\n        discriminator = ('%s option' % type, name)\n        intr = self.introspectable(\n            '%s predicates' % type,\n            discriminator,\n            '%s predicate named %s' % (type, name),\n            '%s predicate' % type)\n        intr['name'] = name\n        intr['factory'] = factory\n        intr['weighs_more_than'] = weighs_more_than\n        intr['weighs_less_than'] = weighs_less_than\n        def register():\n            predlist = self.get_predlist(type)\n            predlist.add(name, factory, weighs_more_than=weighs_more_than,\n                         weighs_less_than=weighs_less_than)\n        self.action(discriminator, register, introspectables=(intr,),\n                    order=PHASE1_CONFIG) # must be registered early\n\n    @property\n    def action_info(self):\n        info = self.info # usually a ZCML action (ParserInfo) if self.info\n        if not info:\n            # Try to provide more accurate info for conflict reports\n            if self._ainfo:\n                info = self._ainfo[0]\n            else:\n                info = ActionInfo(None, 0, '', '')\n        return info\n\n    def action(self, discriminator, callable=None, args=(), kw=None, order=0,\n               introspectables=(), **extra):\n        \"\"\" Register an action which will be executed when\n        :meth:`pyramid.config.Configurator.commit` is called (or executed\n        immediately if ``autocommit`` is ``True``).\n\n        .. warning:: This method is typically only used by :app:`Pyramid`\n           framework extension authors, not by :app:`Pyramid` application\n           developers.\n\n        The ``discriminator`` uniquely identifies the action.  It must be\n        given, but it can be ``None``, to indicate that the action never\n        conflicts.  It must be a hashable value.\n\n        The ``callable`` is a callable object which performs the task\n        associated with the action when the action is executed.  It is\n        optional.\n\n        ``args`` and ``kw`` are tuple and dict objects respectively, which\n        are passed to ``callable`` when this action is executed.  Both are\n        optional.\n\n        ``order`` is a grouping mechanism; an action with a lower order will\n        be executed before an action with a higher order (has no effect when\n        autocommit is ``True``).\n\n        ``introspectables`` is a sequence of :term:`introspectable` objects\n        (or the empty sequence if no introspectable objects are associated\n        with this action).  If this configurator's ``introspection``\n        attribute is ``False``, these introspectables will be ignored.\n\n        ``extra`` provides a facility for inserting extra keys and values\n        into an action dictionary.\n        \"\"\"\n        # catch nonhashable discriminators here; most unit tests use\n        # autocommit=False, which won't catch unhashable discriminators\n        assert hash(discriminator) \n\n        if kw is None:\n            kw = {}\n\n        autocommit = self.autocommit\n        action_info = self.action_info\n\n        if not self.introspection:\n            # if we're not introspecting, ignore any introspectables passed\n            # to us\n            introspectables = ()\n\n        if autocommit:\n            # callables can depend on the side effects of resolving a\n            # deferred discriminator\n            self.begin()\n            try:\n                undefer(discriminator)\n                if callable is not None:\n                    callable(*args, **kw)\n                for introspectable in introspectables:\n                    introspectable.register(self.introspector, action_info)\n            finally:\n                self.end()\n\n        else:\n            action = extra\n            action.update(\n                dict(\n                    discriminator=discriminator,\n                    callable=callable,\n                    args=args,\n                    kw=kw,\n                    order=order,\n                    info=action_info,\n                    includepath=self.includepath,\n                    introspectables=introspectables,\n                    )\n                )\n            self.action_state.action(**action)\n\n    def _get_action_state(self):\n        registry = self.registry\n        try:\n            state = registry.action_state\n        except AttributeError:\n            state = ActionState()\n            registry.action_state = state\n        return state\n\n    def _set_action_state(self, state):\n        self.registry.action_state = state\n\n    action_state = property(_get_action_state, _set_action_state)\n\n    _ctx = action_state # bw compat\n\n    def commit(self):\n        \"\"\" Commit any pending configuration actions. If a configuration\n        conflict is detected in the pending configuration actions, this method\n        will raise a :exc:`ConfigurationConflictError`; within the traceback\n        of this error will be information about the source of the conflict,\n        usually including file names and line numbers of the cause of the\n        configuration conflicts.\"\"\"\n        self.begin()\n        try:\n            self.action_state.execute_actions(introspector=self.introspector)\n        finally:\n            self.end()\n        self.action_state = ActionState() # old actions have been processed\n\n    def include(self, callable, route_prefix=None):\n        \"\"\"Include a configuration callable, to support imperative\n        application extensibility.\n\n        .. warning:: In versions of :app:`Pyramid` prior to 1.2, this\n            function accepted ``*callables``, but this has been changed\n            to support only a single callable.\n\n        A configuration callable should be a callable that accepts a single\n        argument named ``config``, which will be an instance of a\n        :term:`Configurator`.  However, be warned that it will not be the same\n        configurator instance on which you call this method.  The\n        code which runs as a result of calling the callable should invoke\n        methods on the configurator passed to it which add configuration\n        state.  The return value of a callable will be ignored.\n\n        Values allowed to be presented via the ``callable`` argument to\n        this method: any callable Python object or any :term:`dotted Python\n        name` which resolves to a callable Python object.  It may also be a\n        Python :term:`module`, in which case, the module will be searched for\n        a callable named ``includeme``, which will be treated as the\n        configuration callable.\n\n        For example, if the ``includeme`` function below lives in a module\n        named ``myapp.myconfig``:\n\n        .. code-block:: python\n           :linenos:\n\n           # myapp.myconfig module\n\n           def my_view(request):\n               from pyramid.response import Response\n               return Response('OK')\n\n           def includeme(config):\n               config.add_view(my_view)\n\n        You might cause it to be included within your Pyramid application like\n        so:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include('myapp.myconfig.includeme')\n\n        Because the function is named ``includeme``, the function name can\n        also be omitted from the dotted name reference:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include('myapp.myconfig')\n\n        Included configuration statements will be overridden by local\n        configuration statements if an included callable causes a\n        configuration conflict by registering something with the same\n        configuration parameters.\n\n        If the ``route_prefix`` is supplied, it must be a string.  Any calls\n        to :meth:`pyramid.config.Configurator.add_route` within the included\n        callable will have their pattern prefixed with the value of\n        ``route_prefix``. This can be used to help mount a set of routes at a\n        different location than the included callable's author intended, while\n        still maintaining the same route names.  For example:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def included(config):\n               config.add_route('show_users', '/show')\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include(included, route_prefix='/users')\n\n        In the above configuration, the ``show_users`` route will have an\n        effective route pattern of ``/users/show``, instead of ``/show``\n        because the ``route_prefix`` argument will be prepended to the\n        pattern.\n\n        .. versionadded:: 1.2\n           The ``route_prefix`` parameter.\n\n        \"\"\"\n        # \"\"\" <-- emacs\n\n        action_state = self.action_state\n\n        if route_prefix is None:\n            route_prefix = ''\n\n        old_route_prefix = self.route_prefix\n        if old_route_prefix is None:\n            old_route_prefix = ''\n\n        route_prefix = '%s/%s' % (\n            old_route_prefix.rstrip('/'),\n            route_prefix.lstrip('/')\n            )\n        route_prefix = route_prefix.strip('/')\n        if not route_prefix:\n            route_prefix = None\n\n        c = self.maybe_dotted(callable)\n        module = self.inspect.getmodule(c)\n        if module is c:\n            try:\n                c = getattr(module, 'includeme')\n            except AttributeError:\n                raise ConfigurationError(\n                    \"module %r has no attribute 'includeme'\" % (module.__name__)\n                    )\n                                                       \n        spec = module.__name__ + ':' + c.__name__\n        sourcefile = self.inspect.getsourcefile(c)\n\n        if sourcefile is None:\n            raise ConfigurationError(\n                'No source file for module %r (.py file must exist, '\n                'refusing to use orphan .pyc or .pyo file).' % module.__name__)\n            \n\n        if action_state.processSpec(spec):\n            configurator = self.__class__(\n                registry=self.registry,\n                package=package_of(module),\n                root_package=self.root_package,\n                autocommit=self.autocommit,\n                route_prefix=route_prefix,\n                )\n            configurator.basepath = os.path.dirname(sourcefile)\n            configurator.includepath = self.includepath + (spec,)\n            c(configurator)\n\n    def add_directive(self, name, directive, action_wrap=True):\n        \"\"\"\n        Add a directive method to the configurator.\n\n        .. warning:: This method is typically only used by :app:`Pyramid`\n           framework extension authors, not by :app:`Pyramid` application\n           developers.\n\n        Framework extenders can add directive methods to a configurator by\n        instructing their users to call ``config.add_directive('somename',\n        'some.callable')``.  This will make ``some.callable`` accessible as\n        ``config.somename``.  ``some.callable`` should be a function which\n        accepts ``config`` as a first argument, and arbitrary positional and\n        keyword arguments following.  It should use config.action as\n        necessary to perform actions.  Directive methods can then be invoked\n        like 'built-in' directives such as ``add_view``, ``add_route``, etc.\n\n        The ``action_wrap`` argument should be ``True`` for directives which\n        perform ``config.action`` with potentially conflicting\n        discriminators.  ``action_wrap`` will cause the directive to be\n        wrapped in a decorator which provides more accurate conflict\n        cause information.\n\n        ``add_directive`` does not participate in conflict detection, and\n        later calls to ``add_directive`` will override earlier calls.\n        \"\"\"\n        c = self.maybe_dotted(directive)\n        if not hasattr(self.registry, '_directives'):\n            self.registry._directives = {}\n        self.registry._directives[name] = (c, action_wrap)\n\n    def __getattr__(self, name):\n        # allow directive extension names to work\n        directives = getattr(self.registry, '_directives', {})\n        c = directives.get(name)\n        if c is None:\n            raise AttributeError(name)\n        c, action_wrap = c\n        if action_wrap:\n            c = action_method(c)\n        # Create a bound method (works on both Py2 and Py3)\n        # http://stackoverflow.com/a/1015405/209039\n        m = c.__get__(self, self.__class__)\n        return m\n\n    def with_package(self, package):\n        \"\"\" Return a new Configurator instance with the same registry\n        as this configurator. ``package`` may be an actual Python package\n        object or a :term:`dotted Python name` representing a package.\"\"\"\n        configurator = self.__class__(\n            registry=self.registry,\n            package=package,\n            root_package=self.root_package,\n            autocommit=self.autocommit,\n            route_prefix=self.route_prefix,\n            introspection=self.introspection,\n            )\n        configurator.basepath = self.basepath\n        configurator.includepath = self.includepath\n        configurator.info = self.info\n        return configurator\n\n    def maybe_dotted(self, dotted):\n        \"\"\" Resolve the :term:`dotted Python name` ``dotted`` to a\n        global Python object.  If ``dotted`` is not a string, return\n        it without attempting to do any name resolution.  If\n        ``dotted`` is a relative dotted name (e.g. ``.foo.bar``,\n        consider it relative to the ``package`` argument supplied to\n        this Configurator's constructor.\"\"\"\n        return self.name_resolver.maybe_resolve(dotted)\n\n    def absolute_asset_spec(self, relative_spec):\n        \"\"\" Resolve the potentially relative :term:`asset\n        specification` string passed as ``relative_spec`` into an\n        absolute asset specification string and return the string.\n        Use the ``package`` of this configurator as the package to\n        which the asset specification will be considered relative\n        when generating an absolute asset specification.  If the\n        provided ``relative_spec`` argument is already absolute, or if\n        the ``relative_spec`` is not a string, it is simply returned.\"\"\"\n        if not isinstance(relative_spec, string_types):\n            return relative_spec\n        return self._make_spec(relative_spec)\n\n    absolute_resource_spec = absolute_asset_spec # b/w compat forever\n\n    def begin(self, request=_marker):\n        \"\"\" Indicate that application or test configuration has begun.\n        This pushes a dictionary containing the :term:`application\n        registry` implied by ``registry`` attribute of this\n        configurator and the :term:`request` implied by the\n        ``request`` argument onto the :term:`thread local` stack\n        consulted by various :mod:`pyramid.threadlocal` API\n        functions.\n\n        If ``request`` is not specified and the registry owned by the\n        configurator is already pushed as the current threadlocal registry\n        then this method will keep the current threadlocal request unchanged.\n\n        .. versionchanged:: 1.8\n           The current threadlocal request is propagated if the current\n           threadlocal registry remains unchanged.\n\n        \"\"\"\n        if request is _marker:\n            current = self.manager.get()\n            if current['registry'] == self.registry:\n                request = current['request']\n            else:\n                request = None\n        self.manager.push({'registry':self.registry, 'request':request})\n\n    def end(self):\n        \"\"\" Indicate that application or test configuration has ended.\n        This pops the last value pushed onto the :term:`thread local`\n        stack (usually by the ``begin`` method) and returns that\n        value.\n        \"\"\"\n        return self.manager.pop()\n\n    # this is *not* an action method (uses caller_package)\n    def scan(self, package=None, categories=None, onerror=None, ignore=None,\n             **kw):\n        \"\"\"Scan a Python package and any of its subpackages for objects\n        marked with :term:`configuration decoration` such as\n        :class:`pyramid.view.view_config`.  Any decorated object found will\n        influence the current configuration state.\n\n        The ``package`` argument should be a Python :term:`package` or module\n        object (or a :term:`dotted Python name` which refers to such a\n        package or module).  If ``package`` is ``None``, the package of the\n        *caller* is used.\n\n        The ``categories`` argument, if provided, should be the\n        :term:`Venusian` 'scan categories' to use during scanning.  Providing\n        this argument is not often necessary; specifying scan categories is\n        an extremely advanced usage.  By default, ``categories`` is ``None``\n        which will execute *all* Venusian decorator callbacks including\n        :app:`Pyramid`-related decorators such as\n        :class:`pyramid.view.view_config`.  See the :term:`Venusian`\n        documentation for more information about limiting a scan by using an\n        explicit set of categories.\n\n        The ``onerror`` argument, if provided, should be a Venusian\n        ``onerror`` callback function.  The onerror function is passed to\n        :meth:`venusian.Scanner.scan` to influence error behavior when an\n        exception is raised during the scanning process.  See the\n        :term:`Venusian` documentation for more information about ``onerror``\n        callbacks.\n\n        The ``ignore`` argument, if provided, should be a Venusian ``ignore``\n        value.  Providing an ``ignore`` argument allows the scan to ignore\n        particular modules, packages, or global objects during a scan.\n        ``ignore`` can be a string or a callable, or a list containing\n        strings or callables.  The simplest usage of ``ignore`` is to provide\n        a module or package by providing a full path to its dotted name.  For\n        example: ``config.scan(ignore='my.module.subpackage')`` would ignore\n        the ``my.module.subpackage`` package during a scan, which would\n        prevent the subpackage and any of its submodules from being imported\n        and scanned.  See the :term:`Venusian` documentation for more\n        information about the ``ignore`` argument.\n\n        To perform a ``scan``, Pyramid creates a Venusian ``Scanner`` object.\n        The ``kw`` argument represents a set of keyword arguments to pass to\n        the Venusian ``Scanner`` object's constructor.  See the\n        :term:`venusian` documentation (its ``Scanner`` class) for more\n        information about the constructor.  By default, the only keyword\n        arguments passed to the Scanner constructor are ``{'config':self}``\n        where ``self`` is this configurator object.  This services the\n        requirement of all built-in Pyramid decorators, but extension systems\n        may require additional arguments.  Providing this argument is not\n        often necessary; it's an advanced usage.\n\n        .. versionadded:: 1.1\n           The ``**kw`` argument.\n\n        .. versionadded:: 1.3\n           The ``ignore`` argument.\n\n        \"\"\"\n        package = self.maybe_dotted(package)\n        if package is None: # pragma: no cover\n            package = caller_package()\n\n        ctorkw = {'config': self}\n        ctorkw.update(kw)\n\n        scanner = self.venusian.Scanner(**ctorkw)\n\n        scanner.scan(package, categories=categories, onerror=onerror,\n                     ignore=ignore)\n\n    def make_wsgi_app(self):\n        \"\"\" Commits any pending configuration statements, sends a\n        :class:`pyramid.events.ApplicationCreated` event to all listeners,\n        adds this configuration's registry to\n        :attr:`pyramid.config.global_registries`, and returns a\n        :app:`Pyramid` WSGI application representing the committed\n        configuration state.\"\"\"\n        self.commit()\n        app = Router(self.registry)\n\n        # Allow tools like \"pshell development.ini\" to find the 'last'\n        # registry configured.\n        global_registries.add(self.registry)\n\n        # Push the registry onto the stack in case any code that depends on\n        # the registry threadlocal APIs used in listeners subscribed to the\n        # IApplicationCreated event.\n        self.begin()\n        try:\n            self.registry.notify(ApplicationCreated(app))\n        finally:\n            self.end()\n\n        return app",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 662,
                            "end_lineno": 805,
                            "parent": {
                                "file_name": "pyramid/config/__init__.py",
                                "type": "class",
                                "name": "Configurator",
                                "content": "class Configurator(\n    TestingConfiguratorMixin,\n    TweensConfiguratorMixin,\n    SecurityConfiguratorMixin,\n    ViewsConfiguratorMixin,\n    RoutesConfiguratorMixin,\n    ZCAConfiguratorMixin,\n    I18NConfiguratorMixin,\n    RenderingConfiguratorMixin,\n    AssetsConfiguratorMixin,\n    SettingsConfiguratorMixin,\n    FactoriesConfiguratorMixin,\n    AdaptersConfiguratorMixin,\n    ):\n    \"\"\"\n    A Configurator is used to configure a :app:`Pyramid`\n    :term:`application registry`.\n\n    If the ``registry`` argument is not ``None``, it must\n    be an instance of the :class:`pyramid.registry.Registry` class\n    representing the registry to configure.  If ``registry`` is ``None``, the\n    configurator will create a :class:`pyramid.registry.Registry` instance\n    itself; it will also perform some default configuration that would not\n    otherwise be done.  After its construction, the configurator may be used\n    to add further configuration to the registry.\n\n    .. warning:: If ``registry`` is assigned the above-mentioned class\n       instance, all other constructor arguments are ignored,\n       with the exception of ``package``.\n\n    If the ``package`` argument is passed, it must be a reference to a Python\n    :term:`package` (e.g. ``sys.modules['thepackage']``) or a :term:`dotted\n    Python name` to the same.  This value is used as a basis to convert\n    relative paths passed to various configuration methods, such as methods\n    which accept a ``renderer`` argument, into absolute paths.  If ``None``\n    is passed (the default), the package is assumed to be the Python package\n    in which the *caller* of the ``Configurator`` constructor lives.\n\n    If the ``root_package`` is passed, it will propagate through the\n    configuration hierarchy as a way for included packages to locate\n    resources relative to the package in which the main ``Configurator`` was\n    created. If ``None`` is passed (the default), the ``root_package`` will\n    be derived from the ``package`` argument. The ``package`` attribute is\n    always pointing at the package being included when using :meth:`.include`,\n    whereas the ``root_package`` does not change.\n\n    If the ``settings`` argument is passed, it should be a Python dictionary\n    representing the :term:`deployment settings` for this application.  These\n    are later retrievable using the\n    :attr:`pyramid.registry.Registry.settings` attribute (aka\n    ``request.registry.settings``).\n\n    If the ``root_factory`` argument is passed, it should be an object\n    representing the default :term:`root factory` for your application or a\n    :term:`dotted Python name` to the same.  If it is ``None``, a default\n    root factory will be used.\n\n    If ``authentication_policy`` is passed, it should be an instance\n    of an :term:`authentication policy` or a :term:`dotted Python\n    name` to the same.\n\n    If ``authorization_policy`` is passed, it should be an instance of\n    an :term:`authorization policy` or a :term:`dotted Python name` to\n    the same.\n\n    .. note:: A ``ConfigurationError`` will be raised when an\n       authorization policy is supplied without also supplying an\n       authentication policy (authorization requires authentication).\n\n    If ``renderers`` is ``None`` (the default), a default set of\n    :term:`renderer` factories is used. Else, it should be a list of\n    tuples representing a set of renderer factories which should be\n    configured into this application, and each tuple representing a set of\n    positional values that should be passed to\n    :meth:`pyramid.config.Configurator.add_renderer`.\n\n    If ``debug_logger`` is not passed, a default debug logger that logs to a\n    logger will be used (the logger name will be the package name of the\n    *caller* of this configurator).  If it is passed, it should be an\n    instance of the :class:`logging.Logger` (PEP 282) standard library class\n    or a Python logger name.  The debug logger is used by :app:`Pyramid`\n    itself to log warnings and authorization debugging information.\n\n    If ``locale_negotiator`` is passed, it should be a :term:`locale\n    negotiator` implementation or a :term:`dotted Python name` to\n    same.  See :ref:`custom_locale_negotiator`.\n\n    If ``request_factory`` is passed, it should be a :term:`request\n    factory` implementation or a :term:`dotted Python name` to the same.\n    See :ref:`changing_the_request_factory`.  By default it is ``None``,\n    which means use the default request factory.\n\n    If ``response_factory`` is passed, it should be a :term:`response\n    factory` implementation or a :term:`dotted Python name` to the same.\n    See :ref:`changing_the_response_factory`.  By default it is ``None``,\n    which means use the default response factory.\n\n    If ``default_permission`` is passed, it should be a\n    :term:`permission` string to be used as the default permission for\n    all view configuration registrations performed against this\n    Configurator.  An example of a permission string:``'view'``.\n    Adding a default permission makes it unnecessary to protect each\n    view configuration with an explicit permission, unless your\n    application policy requires some exception for a particular view.\n    By default, ``default_permission`` is ``None``, meaning that view\n    configurations which do not explicitly declare a permission will\n    always be executable by entirely anonymous users (any\n    authorization policy in effect is ignored).\n\n    .. seealso::\n\n        See also :ref:`setting_a_default_permission`.\n\n    If ``session_factory`` is passed, it should be an object which\n    implements the :term:`session factory` interface.  If a nondefault\n    value is passed, the ``session_factory`` will be used to create a\n    session object when ``request.session`` is accessed.  Note that\n    the same outcome can be achieved by calling\n    :meth:`pyramid.config.Configurator.set_session_factory`.  By\n    default, this argument is ``None``, indicating that no session\n    factory will be configured (and thus accessing ``request.session``\n    will throw an error) unless ``set_session_factory`` is called later\n    during configuration.\n\n    If ``autocommit`` is ``True``, every method called on the configurator\n    will cause an immediate action, and no configuration conflict detection\n    will be used. If ``autocommit`` is ``False``, most methods of the\n    configurator will defer their action until\n    :meth:`pyramid.config.Configurator.commit` is called.  When\n    :meth:`pyramid.config.Configurator.commit` is called, the actions implied\n    by the called methods will be checked for configuration conflicts unless\n    ``autocommit`` is ``True``.  If a conflict is detected, a\n    ``ConfigurationConflictError`` will be raised.  Calling\n    :meth:`pyramid.config.Configurator.make_wsgi_app` always implies a final\n    commit.\n\n    If ``default_view_mapper`` is passed, it will be used as the default\n    :term:`view mapper` factory for view configurations that don't otherwise\n    specify one (see :class:`pyramid.interfaces.IViewMapperFactory`).  If\n    ``default_view_mapper`` is not passed, a superdefault view mapper will be\n    used.\n\n    If ``exceptionresponse_view`` is passed, it must be a :term:`view\n    callable` or ``None``.  If it is a view callable, it will be used as an\n    exception view callable when an :term:`exception response` is raised. If\n    ``exceptionresponse_view`` is ``None``, no exception response view will\n    be registered, and all raised exception responses will be bubbled up to\n    Pyramid's caller.  By\n    default, the ``pyramid.httpexceptions.default_exceptionresponse_view``\n    function is used as the ``exceptionresponse_view``.\n\n    If ``route_prefix`` is passed, all routes added with\n    :meth:`pyramid.config.Configurator.add_route` will have the specified path\n    prepended to their pattern.\n\n    If ``introspection`` is passed, it must be a boolean value.  If it's\n    ``True``, introspection values during actions will be kept for use\n    for tools like the debug toolbar.  If it's ``False``, introspection\n    values provided by registrations will be ignored.  By default, it is\n    ``True``.\n\n    .. versionadded:: 1.1\n       The ``exceptionresponse_view`` argument.\n\n    .. versionadded:: 1.2\n       The ``route_prefix`` argument.\n\n    .. versionadded:: 1.3\n       The ``introspection`` argument.\n\n    .. versionadded:: 1.6\n       The ``root_package`` argument.\n       The ``response_factory`` argument.\n    \"\"\"\n    manager = manager # for testing injection\n    venusian = venusian # for testing injection\n    _ainfo = None\n    basepath = None\n    includepath = ()\n    info = ''\n    object_description = staticmethod(object_description)\n    introspectable = Introspectable\n    inspect = inspect\n\n    def __init__(self,\n                 registry=None,\n                 package=None,\n                 settings=None,\n                 root_factory=None,\n                 authentication_policy=None,\n                 authorization_policy=None,\n                 renderers=None,\n                 debug_logger=None,\n                 locale_negotiator=None,\n                 request_factory=None,\n                 response_factory=None,\n                 default_permission=None,\n                 session_factory=None,\n                 default_view_mapper=None,\n                 autocommit=False,\n                 exceptionresponse_view=default_exceptionresponse_view,\n                 route_prefix=None,\n                 introspection=True,\n                 root_package=None,\n                 ):\n        if package is None:\n            package = caller_package()\n        if root_package is None:\n            root_package = package\n        name_resolver = DottedNameResolver(package)\n        self.name_resolver = name_resolver\n        self.package_name = name_resolver.get_package_name()\n        self.package = name_resolver.get_package()\n        self.root_package = root_package\n        self.registry = registry\n        self.autocommit = autocommit\n        self.route_prefix = route_prefix\n        self.introspection = introspection\n        if registry is None:\n            registry = Registry(self.package_name)\n            self.registry = registry\n            self.setup_registry(\n                settings=settings,\n                root_factory=root_factory,\n                authentication_policy=authentication_policy,\n                authorization_policy=authorization_policy,\n                renderers=renderers,\n                debug_logger=debug_logger,\n                locale_negotiator=locale_negotiator,\n                request_factory=request_factory,\n                response_factory=response_factory,\n                default_permission=default_permission,\n                session_factory=session_factory,\n                default_view_mapper=default_view_mapper,\n                exceptionresponse_view=exceptionresponse_view,\n                )\n\n    def setup_registry(self,\n                       settings=None,\n                       root_factory=None,\n                       authentication_policy=None,\n                       authorization_policy=None,\n                       renderers=None,\n                       debug_logger=None,\n                       locale_negotiator=None,\n                       request_factory=None,\n                       response_factory=None,\n                       default_permission=None,\n                       session_factory=None,\n                       default_view_mapper=None,\n                       exceptionresponse_view=default_exceptionresponse_view,\n                       ):\n        \"\"\" When you pass a non-``None`` ``registry`` argument to the\n        :term:`Configurator` constructor, no initial setup is performed\n        against the registry.  This is because the registry you pass in may\n        have already been initialized for use under :app:`Pyramid` via a\n        different configurator.  However, in some circumstances (such as when\n        you want to use a global registry instead of a registry created as a\n        result of the Configurator constructor), or when you want to reset\n        the initial setup of a registry, you *do* want to explicitly\n        initialize the registry associated with a Configurator for use under\n        :app:`Pyramid`.  Use ``setup_registry`` to do this initialization.\n\n        ``setup_registry`` configures settings, a root factory, security\n        policies, renderers, a debug logger, a locale negotiator, and various\n        other settings using the configurator's current registry, as per the\n        descriptions in the Configurator constructor.\"\"\"\n\n        registry = self.registry\n\n        self._fix_registry()\n\n        self._set_settings(settings)\n\n        if isinstance(debug_logger, string_types):\n            debug_logger = logging.getLogger(debug_logger)\n\n        if debug_logger is None:\n            debug_logger = logging.getLogger(self.package_name)\n\n        registry.registerUtility(debug_logger, IDebugLogger)\n\n        self.add_default_response_adapters()\n        self.add_default_renderers()\n        self.add_default_view_predicates()\n        self.add_default_view_derivers()\n        self.add_default_route_predicates()\n        self.add_default_tweens()\n\n        if exceptionresponse_view is not None:\n            exceptionresponse_view = self.maybe_dotted(exceptionresponse_view)\n            self.add_view(exceptionresponse_view, context=IExceptionResponse)\n            self.add_view(exceptionresponse_view,context=WebobWSGIHTTPException)\n\n        # commit below because:\n        #\n        # - the default exceptionresponse_view requires the superdefault view\n        #   mapper, so we need to configure it before adding default_view_mapper\n        #\n        # - superdefault renderers should be overrideable without requiring\n        #   the user to commit before calling config.add_renderer\n\n        self.commit()\n\n        # self.commit() should not be called within this method after this\n        # point because the following registrations should be treated as\n        # analogues of methods called by the user after configurator\n        # construction.  Rationale: user-supplied implementations should be\n        # preferred rather than add-on author implementations with the help of\n        # automatic conflict resolution.\n\n        if authentication_policy and not authorization_policy:\n            authorization_policy = ACLAuthorizationPolicy() # default\n\n        if authorization_policy:\n            self.set_authorization_policy(authorization_policy)\n\n        if authentication_policy:\n            self.set_authentication_policy(authentication_policy)\n\n        if default_view_mapper is not None:\n            self.set_view_mapper(default_view_mapper)\n\n        if renderers:\n            for name, renderer in renderers:\n                self.add_renderer(name, renderer)\n\n        if root_factory is not None:\n            self.set_root_factory(root_factory)\n\n        if locale_negotiator:\n            self.set_locale_negotiator(locale_negotiator)\n\n        if request_factory:\n            self.set_request_factory(request_factory)\n\n        if response_factory:\n            self.set_response_factory(response_factory)\n\n        if default_permission:\n            self.set_default_permission(default_permission)\n\n        if session_factory is not None:\n            self.set_session_factory(session_factory)\n\n        tweens = aslist(registry.settings.get('pyramid.tweens', []))\n        for factory in tweens:\n            self._add_tween(factory, explicit=True)\n\n        includes = aslist(registry.settings.get('pyramid.includes', []))\n        for inc in includes:\n            self.include(inc)\n\n    def _make_spec(self, path_or_spec):\n        package, filename = resolve_asset_spec(path_or_spec, self.package_name)\n        if package is None:\n            return filename # absolute filename\n        return '%s:%s' % (package, filename)\n\n    def _fix_registry(self):\n        \"\"\" Fix up a ZCA component registry that is not a\n        pyramid.registry.Registry by adding analogues of ``has_listeners``,\n        ``notify``, ``queryAdapterOrSelf``, and ``registerSelfAdapter``\n        through monkey-patching.\"\"\"\n\n        _registry = self.registry\n\n        if not hasattr(_registry, 'notify'):\n            def notify(*events):\n                [ _ for _ in _registry.subscribers(events, None) ]\n            _registry.notify = notify\n\n        if not hasattr(_registry, 'has_listeners'):\n            _registry.has_listeners = True\n\n        if not hasattr(_registry, 'queryAdapterOrSelf'):\n            def queryAdapterOrSelf(object, interface, default=None):\n                if not interface.providedBy(object):\n                    return _registry.queryAdapter(object, interface,\n                                                  default=default)\n                return object\n            _registry.queryAdapterOrSelf = queryAdapterOrSelf\n\n        if not hasattr(_registry, 'registerSelfAdapter'):\n            def registerSelfAdapter(required=None, provided=None,\n                                    name=empty, info=empty, event=True):\n                return _registry.registerAdapter(lambda x: x,\n                                                 required=required,\n                                                 provided=provided, name=name,\n                                                 info=info, event=event)\n            _registry.registerSelfAdapter = registerSelfAdapter\n\n        if not hasattr(_registry, '_lock'):\n            _registry._lock = threading.Lock()\n\n        if not hasattr(_registry, '_clear_view_lookup_cache'):\n            def _clear_view_lookup_cache():\n                _registry._view_lookup_cache = {}\n            _registry._clear_view_lookup_cache = _clear_view_lookup_cache\n\n\n    # API\n\n    def _get_introspector(self):\n        introspector = getattr(self.registry, 'introspector', _marker)\n        if introspector is _marker:\n            introspector = Introspector()\n            self._set_introspector(introspector)\n        return introspector\n\n    def _set_introspector(self, introspector):\n        self.registry.introspector = introspector\n\n    def _del_introspector(self):\n        del self.registry.introspector\n\n    introspector = property(\n        _get_introspector, _set_introspector, _del_introspector\n        )\n\n    def get_predlist(self, name):\n        predlist = self.registry.queryUtility(IPredicateList, name=name)\n        if predlist is None:\n            predlist = PredicateList()\n            self.registry.registerUtility(predlist, IPredicateList, name=name)\n        return predlist\n\n\n    def _add_predicate(self, type, name, factory, weighs_more_than=None,\n                       weighs_less_than=None):\n        factory = self.maybe_dotted(factory)\n        discriminator = ('%s option' % type, name)\n        intr = self.introspectable(\n            '%s predicates' % type,\n            discriminator,\n            '%s predicate named %s' % (type, name),\n            '%s predicate' % type)\n        intr['name'] = name\n        intr['factory'] = factory\n        intr['weighs_more_than'] = weighs_more_than\n        intr['weighs_less_than'] = weighs_less_than\n        def register():\n            predlist = self.get_predlist(type)\n            predlist.add(name, factory, weighs_more_than=weighs_more_than,\n                         weighs_less_than=weighs_less_than)\n        self.action(discriminator, register, introspectables=(intr,),\n                    order=PHASE1_CONFIG) # must be registered early\n\n    @property\n    def action_info(self):\n        info = self.info # usually a ZCML action (ParserInfo) if self.info\n        if not info:\n            # Try to provide more accurate info for conflict reports\n            if self._ainfo:\n                info = self._ainfo[0]\n            else:\n                info = ActionInfo(None, 0, '', '')\n        return info\n\n    def action(self, discriminator, callable=None, args=(), kw=None, order=0,\n               introspectables=(), **extra):\n        \"\"\" Register an action which will be executed when\n        :meth:`pyramid.config.Configurator.commit` is called (or executed\n        immediately if ``autocommit`` is ``True``).\n\n        .. warning:: This method is typically only used by :app:`Pyramid`\n           framework extension authors, not by :app:`Pyramid` application\n           developers.\n\n        The ``discriminator`` uniquely identifies the action.  It must be\n        given, but it can be ``None``, to indicate that the action never\n        conflicts.  It must be a hashable value.\n\n        The ``callable`` is a callable object which performs the task\n        associated with the action when the action is executed.  It is\n        optional.\n\n        ``args`` and ``kw`` are tuple and dict objects respectively, which\n        are passed to ``callable`` when this action is executed.  Both are\n        optional.\n\n        ``order`` is a grouping mechanism; an action with a lower order will\n        be executed before an action with a higher order (has no effect when\n        autocommit is ``True``).\n\n        ``introspectables`` is a sequence of :term:`introspectable` objects\n        (or the empty sequence if no introspectable objects are associated\n        with this action).  If this configurator's ``introspection``\n        attribute is ``False``, these introspectables will be ignored.\n\n        ``extra`` provides a facility for inserting extra keys and values\n        into an action dictionary.\n        \"\"\"\n        # catch nonhashable discriminators here; most unit tests use\n        # autocommit=False, which won't catch unhashable discriminators\n        assert hash(discriminator) \n\n        if kw is None:\n            kw = {}\n\n        autocommit = self.autocommit\n        action_info = self.action_info\n\n        if not self.introspection:\n            # if we're not introspecting, ignore any introspectables passed\n            # to us\n            introspectables = ()\n\n        if autocommit:\n            # callables can depend on the side effects of resolving a\n            # deferred discriminator\n            self.begin()\n            try:\n                undefer(discriminator)\n                if callable is not None:\n                    callable(*args, **kw)\n                for introspectable in introspectables:\n                    introspectable.register(self.introspector, action_info)\n            finally:\n                self.end()\n\n        else:\n            action = extra\n            action.update(\n                dict(\n                    discriminator=discriminator,\n                    callable=callable,\n                    args=args,\n                    kw=kw,\n                    order=order,\n                    info=action_info,\n                    includepath=self.includepath,\n                    introspectables=introspectables,\n                    )\n                )\n            self.action_state.action(**action)\n\n    def _get_action_state(self):\n        registry = self.registry\n        try:\n            state = registry.action_state\n        except AttributeError:\n            state = ActionState()\n            registry.action_state = state\n        return state\n\n    def _set_action_state(self, state):\n        self.registry.action_state = state\n\n    action_state = property(_get_action_state, _set_action_state)\n\n    _ctx = action_state # bw compat\n\n    def commit(self):\n        \"\"\" Commit any pending configuration actions. If a configuration\n        conflict is detected in the pending configuration actions, this method\n        will raise a :exc:`ConfigurationConflictError`; within the traceback\n        of this error will be information about the source of the conflict,\n        usually including file names and line numbers of the cause of the\n        configuration conflicts.\"\"\"\n        self.begin()\n        try:\n            self.action_state.execute_actions(introspector=self.introspector)\n        finally:\n            self.end()\n        self.action_state = ActionState() # old actions have been processed\n\n    def include(self, callable, route_prefix=None):\n        \"\"\"Include a configuration callable, to support imperative\n        application extensibility.\n\n        .. warning:: In versions of :app:`Pyramid` prior to 1.2, this\n            function accepted ``*callables``, but this has been changed\n            to support only a single callable.\n\n        A configuration callable should be a callable that accepts a single\n        argument named ``config``, which will be an instance of a\n        :term:`Configurator`.  However, be warned that it will not be the same\n        configurator instance on which you call this method.  The\n        code which runs as a result of calling the callable should invoke\n        methods on the configurator passed to it which add configuration\n        state.  The return value of a callable will be ignored.\n\n        Values allowed to be presented via the ``callable`` argument to\n        this method: any callable Python object or any :term:`dotted Python\n        name` which resolves to a callable Python object.  It may also be a\n        Python :term:`module`, in which case, the module will be searched for\n        a callable named ``includeme``, which will be treated as the\n        configuration callable.\n\n        For example, if the ``includeme`` function below lives in a module\n        named ``myapp.myconfig``:\n\n        .. code-block:: python\n           :linenos:\n\n           # myapp.myconfig module\n\n           def my_view(request):\n               from pyramid.response import Response\n               return Response('OK')\n\n           def includeme(config):\n               config.add_view(my_view)\n\n        You might cause it to be included within your Pyramid application like\n        so:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include('myapp.myconfig.includeme')\n\n        Because the function is named ``includeme``, the function name can\n        also be omitted from the dotted name reference:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include('myapp.myconfig')\n\n        Included configuration statements will be overridden by local\n        configuration statements if an included callable causes a\n        configuration conflict by registering something with the same\n        configuration parameters.\n\n        If the ``route_prefix`` is supplied, it must be a string.  Any calls\n        to :meth:`pyramid.config.Configurator.add_route` within the included\n        callable will have their pattern prefixed with the value of\n        ``route_prefix``. This can be used to help mount a set of routes at a\n        different location than the included callable's author intended, while\n        still maintaining the same route names.  For example:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def included(config):\n               config.add_route('show_users', '/show')\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include(included, route_prefix='/users')\n\n        In the above configuration, the ``show_users`` route will have an\n        effective route pattern of ``/users/show``, instead of ``/show``\n        because the ``route_prefix`` argument will be prepended to the\n        pattern.\n\n        .. versionadded:: 1.2\n           The ``route_prefix`` parameter.\n\n        \"\"\"\n        # \"\"\" <-- emacs\n\n        action_state = self.action_state\n\n        if route_prefix is None:\n            route_prefix = ''\n\n        old_route_prefix = self.route_prefix\n        if old_route_prefix is None:\n            old_route_prefix = ''\n\n        route_prefix = '%s/%s' % (\n            old_route_prefix.rstrip('/'),\n            route_prefix.lstrip('/')\n            )\n        route_prefix = route_prefix.strip('/')\n        if not route_prefix:\n            route_prefix = None\n\n        c = self.maybe_dotted(callable)\n        module = self.inspect.getmodule(c)\n        if module is c:\n            try:\n                c = getattr(module, 'includeme')\n            except AttributeError:\n                raise ConfigurationError(\n                    \"module %r has no attribute 'includeme'\" % (module.__name__)\n                    )\n                                                       \n        spec = module.__name__ + ':' + c.__name__\n        sourcefile = self.inspect.getsourcefile(c)\n\n        if sourcefile is None:\n            raise ConfigurationError(\n                'No source file for module %r (.py file must exist, '\n                'refusing to use orphan .pyc or .pyo file).' % module.__name__)\n            \n\n        if action_state.processSpec(spec):\n            configurator = self.__class__(\n                registry=self.registry,\n                package=package_of(module),\n                root_package=self.root_package,\n                autocommit=self.autocommit,\n                route_prefix=route_prefix,\n                )\n            configurator.basepath = os.path.dirname(sourcefile)\n            configurator.includepath = self.includepath + (spec,)\n            c(configurator)\n\n    def add_directive(self, name, directive, action_wrap=True):\n        \"\"\"\n        Add a directive method to the configurator.\n\n        .. warning:: This method is typically only used by :app:`Pyramid`\n           framework extension authors, not by :app:`Pyramid` application\n           developers.\n\n        Framework extenders can add directive methods to a configurator by\n        instructing their users to call ``config.add_directive('somename',\n        'some.callable')``.  This will make ``some.callable`` accessible as\n        ``config.somename``.  ``some.callable`` should be a function which\n        accepts ``config`` as a first argument, and arbitrary positional and\n        keyword arguments following.  It should use config.action as\n        necessary to perform actions.  Directive methods can then be invoked\n        like 'built-in' directives such as ``add_view``, ``add_route``, etc.\n\n        The ``action_wrap`` argument should be ``True`` for directives which\n        perform ``config.action`` with potentially conflicting\n        discriminators.  ``action_wrap`` will cause the directive to be\n        wrapped in a decorator which provides more accurate conflict\n        cause information.\n\n        ``add_directive`` does not participate in conflict detection, and\n        later calls to ``add_directive`` will override earlier calls.\n        \"\"\"\n        c = self.maybe_dotted(directive)\n        if not hasattr(self.registry, '_directives'):\n            self.registry._directives = {}\n        self.registry._directives[name] = (c, action_wrap)\n\n    def __getattr__(self, name):\n        # allow directive extension names to work\n        directives = getattr(self.registry, '_directives', {})\n        c = directives.get(name)\n        if c is None:\n            raise AttributeError(name)\n        c, action_wrap = c\n        if action_wrap:\n            c = action_method(c)\n        # Create a bound method (works on both Py2 and Py3)\n        # http://stackoverflow.com/a/1015405/209039\n        m = c.__get__(self, self.__class__)\n        return m\n\n    def with_package(self, package):\n        \"\"\" Return a new Configurator instance with the same registry\n        as this configurator. ``package`` may be an actual Python package\n        object or a :term:`dotted Python name` representing a package.\"\"\"\n        configurator = self.__class__(\n            registry=self.registry,\n            package=package,\n            root_package=self.root_package,\n            autocommit=self.autocommit,\n            route_prefix=self.route_prefix,\n            introspection=self.introspection,\n            )\n        configurator.basepath = self.basepath\n        configurator.includepath = self.includepath\n        configurator.info = self.info\n        return configurator\n\n    def maybe_dotted(self, dotted):\n        \"\"\" Resolve the :term:`dotted Python name` ``dotted`` to a\n        global Python object.  If ``dotted`` is not a string, return\n        it without attempting to do any name resolution.  If\n        ``dotted`` is a relative dotted name (e.g. ``.foo.bar``,\n        consider it relative to the ``package`` argument supplied to\n        this Configurator's constructor.\"\"\"\n        return self.name_resolver.maybe_resolve(dotted)\n\n    def absolute_asset_spec(self, relative_spec):\n        \"\"\" Resolve the potentially relative :term:`asset\n        specification` string passed as ``relative_spec`` into an\n        absolute asset specification string and return the string.\n        Use the ``package`` of this configurator as the package to\n        which the asset specification will be considered relative\n        when generating an absolute asset specification.  If the\n        provided ``relative_spec`` argument is already absolute, or if\n        the ``relative_spec`` is not a string, it is simply returned.\"\"\"\n        if not isinstance(relative_spec, string_types):\n            return relative_spec\n        return self._make_spec(relative_spec)\n\n    absolute_resource_spec = absolute_asset_spec # b/w compat forever\n\n    def begin(self, request=_marker):\n        \"\"\" Indicate that application or test configuration has begun.\n        This pushes a dictionary containing the :term:`application\n        registry` implied by ``registry`` attribute of this\n        configurator and the :term:`request` implied by the\n        ``request`` argument onto the :term:`thread local` stack\n        consulted by various :mod:`pyramid.threadlocal` API\n        functions.\n\n        If ``request`` is not specified and the registry owned by the\n        configurator is already pushed as the current threadlocal registry\n        then this method will keep the current threadlocal request unchanged.\n\n        .. versionchanged:: 1.8\n           The current threadlocal request is propagated if the current\n           threadlocal registry remains unchanged.\n\n        \"\"\"\n        if request is _marker:\n            current = self.manager.get()\n            if current['registry'] == self.registry:\n                request = current['request']\n            else:\n                request = None\n        self.manager.push({'registry':self.registry, 'request':request})\n\n    def end(self):\n        \"\"\" Indicate that application or test configuration has ended.\n        This pops the last value pushed onto the :term:`thread local`\n        stack (usually by the ``begin`` method) and returns that\n        value.\n        \"\"\"\n        return self.manager.pop()\n\n    # this is *not* an action method (uses caller_package)\n    def scan(self, package=None, categories=None, onerror=None, ignore=None,\n             **kw):\n        \"\"\"Scan a Python package and any of its subpackages for objects\n        marked with :term:`configuration decoration` such as\n        :class:`pyramid.view.view_config`.  Any decorated object found will\n        influence the current configuration state.\n\n        The ``package`` argument should be a Python :term:`package` or module\n        object (or a :term:`dotted Python name` which refers to such a\n        package or module).  If ``package`` is ``None``, the package of the\n        *caller* is used.\n\n        The ``categories`` argument, if provided, should be the\n        :term:`Venusian` 'scan categories' to use during scanning.  Providing\n        this argument is not often necessary; specifying scan categories is\n        an extremely advanced usage.  By default, ``categories`` is ``None``\n        which will execute *all* Venusian decorator callbacks including\n        :app:`Pyramid`-related decorators such as\n        :class:`pyramid.view.view_config`.  See the :term:`Venusian`\n        documentation for more information about limiting a scan by using an\n        explicit set of categories.\n\n        The ``onerror`` argument, if provided, should be a Venusian\n        ``onerror`` callback function.  The onerror function is passed to\n        :meth:`venusian.Scanner.scan` to influence error behavior when an\n        exception is raised during the scanning process.  See the\n        :term:`Venusian` documentation for more information about ``onerror``\n        callbacks.\n\n        The ``ignore`` argument, if provided, should be a Venusian ``ignore``\n        value.  Providing an ``ignore`` argument allows the scan to ignore\n        particular modules, packages, or global objects during a scan.\n        ``ignore`` can be a string or a callable, or a list containing\n        strings or callables.  The simplest usage of ``ignore`` is to provide\n        a module or package by providing a full path to its dotted name.  For\n        example: ``config.scan(ignore='my.module.subpackage')`` would ignore\n        the ``my.module.subpackage`` package during a scan, which would\n        prevent the subpackage and any of its submodules from being imported\n        and scanned.  See the :term:`Venusian` documentation for more\n        information about the ``ignore`` argument.\n\n        To perform a ``scan``, Pyramid creates a Venusian ``Scanner`` object.\n        The ``kw`` argument represents a set of keyword arguments to pass to\n        the Venusian ``Scanner`` object's constructor.  See the\n        :term:`venusian` documentation (its ``Scanner`` class) for more\n        information about the constructor.  By default, the only keyword\n        arguments passed to the Scanner constructor are ``{'config':self}``\n        where ``self`` is this configurator object.  This services the\n        requirement of all built-in Pyramid decorators, but extension systems\n        may require additional arguments.  Providing this argument is not\n        often necessary; it's an advanced usage.\n\n        .. versionadded:: 1.1\n           The ``**kw`` argument.\n\n        .. versionadded:: 1.3\n           The ``ignore`` argument.\n\n        \"\"\"\n        package = self.maybe_dotted(package)\n        if package is None: # pragma: no cover\n            package = caller_package()\n\n        ctorkw = {'config': self}\n        ctorkw.update(kw)\n\n        scanner = self.venusian.Scanner(**ctorkw)\n\n        scanner.scan(package, categories=categories, onerror=onerror,\n                     ignore=ignore)\n\n    def make_wsgi_app(self):\n        \"\"\" Commits any pending configuration statements, sends a\n        :class:`pyramid.events.ApplicationCreated` event to all listeners,\n        adds this configuration's registry to\n        :attr:`pyramid.config.global_registries`, and returns a\n        :app:`Pyramid` WSGI application representing the committed\n        configuration state.\"\"\"\n        self.commit()\n        app = Router(self.registry)\n\n        # Allow tools like \"pshell development.ini\" to find the 'last'\n        # registry configured.\n        global_registries.add(self.registry)\n\n        # Push the registry onto the stack in case any code that depends on\n        # the registry threadlocal APIs used in listeners subscribed to the\n        # IApplicationCreated event.\n        self.begin()\n        try:\n            self.registry.notify(ApplicationCreated(app))\n        finally:\n            self.end()\n\n        return app",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 95,
                                "end_lineno": 1022,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "import unittest\n\nimport os\n\nfrom pyramid.compat import im_func\nfrom pyramid.testing import skip_on\n\nfrom pyramid.tests.test_config import dummy_tween_factory\nfrom pyramid.tests.test_config import dummy_include\nfrom pyramid.tests.test_config import dummy_extend\nfrom pyramid.tests.test_config import dummy_extend2\nfrom pyramid.tests.test_config import IDummy\nfrom pyramid.tests.test_config import DummyContext\n\nfrom pyramid.exceptions import ConfigurationExecutionError\nfrom pyramid.exceptions import ConfigurationConflictError\n\nfrom pyramid.interfaces import IRequest\n\nclass ConfiguratorTests(unittest.TestCase):\n    def _makeOne(self, *arg, **kw):\n        from pyramid.config import Configurator\n        config = Configurator(*arg, **kw)\n        return config\n\n    def _getViewCallable(self, config, ctx_iface=None, request_iface=None,\n                         name='', exception_view=False):\n        from zope.interface import Interface\n        from pyramid.interfaces import IRequest\n        from pyramid.interfaces import IView\n        from pyramid.interfaces import IViewClassifier\n        from pyramid.interfaces import IExceptionViewClassifier\n        if exception_view: # pragma: no cover\n            classifier = IExceptionViewClassifier\n        else:\n            classifier = IViewClassifier\n        if ctx_iface is None:\n            ctx_iface = Interface\n        if request_iface is None:\n            request_iface = IRequest\n        return config.registry.adapters.lookup(\n            (classifier, request_iface, ctx_iface), IView, name=name,\n            default=None)\n\n    def _registerEventListener(self, config, event_iface=None):\n        if event_iface is None: # pragma: no cover\n            from zope.interface import Interface\n            event_iface = Interface\n        L = []\n        def subscriber(*event):\n            L.extend(event)\n        config.registry.registerHandler(subscriber, (event_iface,))\n        return L\n\n    def _makeRequest(self, config):\n        request = DummyRequest()\n        request.registry = config.registry\n        return request\n\n    def test_ctor_no_registry(self):\n        import sys\n        from pyramid.interfaces import ISettings\n        from pyramid.config import Configurator\n        from pyramid.interfaces import IRendererFactory\n        config = Configurator()\n        this_pkg = sys.modules['pyramid.tests.test_config']\n        self.assertTrue(config.registry.getUtility(ISettings))\n        self.assertEqual(config.package, this_pkg)\n        config.commit()\n        self.assertTrue(config.registry.getUtility(IRendererFactory, 'json'))\n        self.assertTrue(config.registry.getUtility(IRendererFactory, 'string'))\n\n    def test_begin(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        config.manager = manager\n        config.begin()\n        self.assertEqual(manager.pushed,\n                         {'registry':config.registry, 'request':None})\n        self.assertEqual(manager.popped, False)\n\n    def test_begin_with_request(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        request = object()\n        manager = DummyThreadLocalManager()\n        config.manager = manager\n        config.begin(request=request)\n        self.assertEqual(manager.pushed,\n                         {'registry':config.registry, 'request':request})\n        self.assertEqual(manager.popped, False)\n\n    def test_begin_overrides_request(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        req = object()\n        # set it up for auto-propagation\n        pushed = {'registry': config.registry, 'request': None}\n        manager.pushed = pushed\n        config.manager = manager\n        config.begin(req)\n        self.assertTrue(manager.pushed is not pushed)\n        self.assertEqual(manager.pushed['request'], req)\n        self.assertEqual(manager.pushed['registry'], config.registry)\n\n    def test_begin_propagates_request_for_same_registry(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        req = object()\n        pushed = {'registry': config.registry, 'request': req}\n        manager.pushed = pushed\n        config.manager = manager\n        config.begin()\n        self.assertTrue(manager.pushed is not pushed)\n        self.assertEqual(manager.pushed['request'], req)\n        self.assertEqual(manager.pushed['registry'], config.registry)\n\n    def test_begin_does_not_propagate_request_for_diff_registry(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        req = object()\n        pushed = {'registry': object(), 'request': req}\n        manager.pushed = pushed\n        config.manager = manager\n        config.begin()\n        self.assertTrue(manager.pushed is not pushed)\n        self.assertEqual(manager.pushed['request'], None)\n        self.assertEqual(manager.pushed['registry'], config.registry)\n\n    def test_end(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        pushed = manager.pushed\n        config.manager = manager\n        config.end()\n        self.assertEqual(manager.pushed, pushed)\n        self.assertEqual(manager.popped, True)\n\n    def test_ctor_with_package_registry(self):\n        import sys\n        from pyramid.config import Configurator\n        pkg = sys.modules['pyramid']\n        config = Configurator(package=pkg)\n        self.assertEqual(config.package, pkg)\n\n    def test_ctor_noreg_custom_settings(self):\n        from pyramid.interfaces import ISettings\n        settings = {'reload_templates':True,\n                    'mysetting':True}\n        config = self._makeOne(settings=settings)\n        settings = config.registry.getUtility(ISettings)\n        self.assertEqual(settings['reload_templates'], True)\n        self.assertEqual(settings['debug_authorization'], False)\n        self.assertEqual(settings['mysetting'], True)\n\n    def test_ctor_noreg_debug_logger_None_default(self):\n        from pyramid.interfaces import IDebugLogger\n        config = self._makeOne()\n        logger = config.registry.getUtility(IDebugLogger)\n        self.assertEqual(logger.name, 'pyramid.tests.test_config')\n\n    def test_ctor_noreg_debug_logger_non_None(self):\n        from pyramid.interfaces import IDebugLogger\n        logger = object()\n        config = self._makeOne(debug_logger=logger)\n        result = config.registry.getUtility(IDebugLogger)\n        self.assertEqual(logger, result)\n\n    def test_ctor_authentication_policy(self):\n        from pyramid.interfaces import IAuthenticationPolicy\n        policy = object()\n        config = self._makeOne(authentication_policy=policy)\n        config.commit()\n        result = config.registry.getUtility(IAuthenticationPolicy)\n        self.assertEqual(policy, result)\n\n    def test_ctor_authorization_policy_only(self):\n        policy = object()\n        config = self._makeOne(authorization_policy=policy)\n        self.assertRaises(ConfigurationExecutionError, config.commit)\n\n    def test_ctor_no_root_factory(self):\n        from pyramid.interfaces import IRootFactory\n        config = self._makeOne()\n        self.assertEqual(config.registry.queryUtility(IRootFactory), None)\n        config.commit()\n        self.assertEqual(config.registry.queryUtility(IRootFactory), None)\n\n    def test_ctor_with_root_factory(self):\n        from pyramid.interfaces import IRootFactory\n        factory = object()\n        config = self._makeOne(root_factory=factory)\n        self.assertEqual(config.registry.queryUtility(IRootFactory), None)\n        config.commit()\n        self.assertEqual(config.registry.queryUtility(IRootFactory), factory)\n\n    def test_ctor_alternate_renderers(self):\n        from pyramid.interfaces import IRendererFactory\n        renderer = object()\n        config = self._makeOne(renderers=[('yeah', renderer)])\n        config.commit()\n        self.assertEqual(config.registry.getUtility(IRendererFactory, 'yeah'),\n                         renderer)\n\n    def test_ctor_default_renderers(self):\n        from pyramid.interfaces import IRendererFactory\n        from pyramid.renderers import json_renderer_factory\n        config = self._makeOne()\n        self.assertEqual(config.registry.getUtility(IRendererFactory, 'json'),\n                         json_renderer_factory)\n\n    def test_ctor_default_permission(self):\n        from pyramid.interfaces import IDefaultPermission\n        config = self._makeOne(default_permission='view')\n        config.commit()\n        self.assertEqual(config.registry.getUtility(IDefaultPermission), 'view')\n\n    def test_ctor_session_factory(self):\n        from pyramid.interfaces import ISessionFactory\n        factory = object()\n        config = self._makeOne(session_factory=factory)\n        self.assertEqual(config.registry.queryUtility(ISessionFactory), None)\n        config.commit()\n        self.assertEqual(config.registry.getUtility(ISessionFactory), factory)\n\n    def test_ctor_default_view_mapper(self):\n        from pyramid.interfaces import IViewMapperFactory\n        mapper = object()\n        config = self._makeOne(default_view_mapper=mapper)\n        config.commit()\n        self.assertEqual(config.registry.getUtility(IViewMapperFactory),\n                         mapper)\n\n    def test_ctor_httpexception_view_default(self):\n        from pyramid.interfaces import IExceptionResponse\n        from pyramid.httpexceptions import default_exceptionresponse_view\n        from pyramid.interfaces import IRequest\n        config = self._makeOne()\n        view = self._getViewCallable(config,\n                                     ctx_iface=IExceptionResponse,\n                                     request_iface=IRequest)\n        self.assertTrue(view.__wraps__ is default_exceptionresponse_view)\n\n    def test_ctor_exceptionresponse_view_None(self):\n        from pyramid.interfaces import IExceptionResponse\n        from pyramid.interfaces import IRequest\n        config = self._makeOne(exceptionresponse_view=None)\n        view = self._getViewCallable(config,\n                                     ctx_iface=IExceptionResponse,\n                                     request_iface=IRequest)\n        self.assertTrue(view is None)\n\n    def test_ctor_exceptionresponse_view_custom(self):\n        from pyramid.interfaces import IExceptionResponse\n        from pyramid.interfaces import IRequest\n        def exceptionresponse_view(context, request): pass\n        config = self._makeOne(exceptionresponse_view=exceptionresponse_view)\n        view = self._getViewCallable(config,\n                                     ctx_iface=IExceptionResponse,\n                                     request_iface=IRequest)\n        self.assertTrue(view.__wraps__ is exceptionresponse_view)\n\n    def test_ctor_with_introspection(self):\n        config = self._makeOne(introspection=False)\n        self.assertEqual(config.introspection, False)\n\n    def test_ctor_default_webob_response_adapter_registered(self):\n        from webob import Response as WebobResponse\n        response = WebobResponse()\n        from pyramid.interfaces import IResponse\n        config = self._makeOne(autocommit=True)\n        result = config.registry.queryAdapter(response, IResponse)\n        self.assertEqual(result, response)\n        \n    def test_with_package_module(self):\n        from pyramid.tests.test_config import test_init\n        import pyramid.tests\n        config = self._makeOne()\n        newconfig = config.with_package(test_init)\n        self.assertEqual(newconfig.package, pyramid.tests.test_config)\n\n    def test_with_package_package(self):\n        import pyramid.tests.test_config\n        config = self._makeOne()\n        newconfig = config.with_package(pyramid.tests.test_config)\n        self.assertEqual(newconfig.package, pyramid.tests.test_config)\n\n    def test_with_package(self):\n        import pyramid.tests\n        config = self._makeOne()\n        config.basepath = 'basepath'\n        config.info = 'info'\n        config.includepath = ('spec',)\n        config.autocommit = True\n        config.route_prefix = 'prefix'\n        newconfig = config.with_package(pyramid.tests)\n        self.assertEqual(newconfig.package, pyramid.tests)\n        self.assertEqual(newconfig.registry, config.registry)\n        self.assertEqual(newconfig.autocommit, True)\n        self.assertEqual(newconfig.route_prefix, 'prefix')\n        self.assertEqual(newconfig.info, 'info')\n        self.assertEqual(newconfig.basepath, 'basepath')\n        self.assertEqual(newconfig.includepath, ('spec',))\n\n    def test_maybe_dotted_string_success(self):\n        import pyramid.tests.test_config\n        config = self._makeOne()\n        result = config.maybe_dotted('pyramid.tests.test_config')\n        self.assertEqual(result, pyramid.tests.test_config)\n\n    def test_maybe_dotted_string_fail(self):\n        config = self._makeOne()\n        self.assertRaises(ImportError, config.maybe_dotted, 'cant.be.found')\n\n    def test_maybe_dotted_notstring_success(self):\n        import pyramid.tests.test_config\n        config = self._makeOne()\n        result = config.maybe_dotted(pyramid.tests.test_config)\n        self.assertEqual(result, pyramid.tests.test_config)\n\n    def test_absolute_asset_spec_already_absolute(self):\n        import pyramid.tests.test_config\n        config = self._makeOne(package=pyramid.tests.test_config)\n        result = config.absolute_asset_spec('already:absolute')\n        self.assertEqual(result, 'already:absolute')\n\n    def test_absolute_asset_spec_notastring(self):\n        import pyramid.tests.test_config\n        config = self._makeOne(package=pyramid.tests.test_config)\n        result = config.absolute_asset_spec(None)\n        self.assertEqual(result, None)\n\n    def test_absolute_asset_spec_relative(self):\n        import pyramid.tests.test_config\n        config = self._makeOne(package=pyramid.tests.test_config)\n        result = config.absolute_asset_spec('files')\n        self.assertEqual(result, 'pyramid.tests.test_config:files')\n\n    def test__fix_registry_has_listeners(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config._fix_registry()\n        self.assertEqual(reg.has_listeners, True)\n\n    def test__fix_registry_notify(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config._fix_registry()\n        self.assertEqual(reg.notify(1), None)\n        self.assertEqual(reg.events, (1,))\n\n    def test__fix_registry_queryAdapterOrSelf(self):\n        from zope.interface import Interface\n        from zope.interface import implementer\n        class IFoo(Interface):\n            pass\n        @implementer(IFoo)\n        class Foo(object):\n            pass\n        class Bar(object):\n            pass\n        adaptation = ()\n        foo = Foo()\n        bar = Bar()\n        reg = DummyRegistry(adaptation)\n        config = self._makeOne(reg)\n        config._fix_registry()\n        self.assertTrue(reg.queryAdapterOrSelf(foo, IFoo) is foo)\n        self.assertTrue(reg.queryAdapterOrSelf(bar, IFoo) is adaptation)\n\n    def test__fix_registry_registerSelfAdapter(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config._fix_registry()\n        reg.registerSelfAdapter('required', 'provided', name='abc')\n        self.assertEqual(len(reg.adapters), 1)\n        args, kw = reg.adapters[0]\n        self.assertEqual(args[0]('abc'), 'abc')\n        self.assertEqual(kw,\n                         {'info': '', 'provided': 'provided',\n                          'required': 'required', 'name': 'abc', 'event': True})\n\n    def test__fix_registry_adds__lock(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config._fix_registry()\n        self.assertTrue(hasattr(reg, '_lock'))\n\n    def test__fix_registry_adds_clear_view_lookup_cache(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        self.assertFalse(hasattr(reg, '_clear_view_lookup_cache'))\n        config._fix_registry()\n        self.assertFalse(hasattr(reg, '_view_lookup_cache'))\n        reg._clear_view_lookup_cache()\n        self.assertEqual(reg._view_lookup_cache, {})\n\n    def test_setup_registry_calls_fix_registry(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config.add_view = lambda *arg, **kw: False\n        config._add_tween = lambda *arg, **kw: False\n        config.setup_registry()\n        self.assertEqual(reg.has_listeners, True)\n\n    def test_setup_registry_registers_default_exceptionresponse_views(self):\n        from webob.exc import WSGIHTTPException\n        from pyramid.interfaces import IExceptionResponse\n        from pyramid.view import default_exceptionresponse_view\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        views = []\n        config.add_view = lambda *arg, **kw: views.append((arg, kw))\n        config.add_default_view_predicates = lambda *arg: None\n        config._add_tween = lambda *arg, **kw: False\n        config.setup_registry()\n        self.assertEqual(views[0], ((default_exceptionresponse_view,),\n                                    {'context':IExceptionResponse}))\n        self.assertEqual(views[1], ((default_exceptionresponse_view,),\n                                    {'context':WSGIHTTPException}))\n\n    def test_setup_registry_registers_default_view_predicates(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        vp_called = []\n        config.add_view = lambda *arg, **kw: None\n        config.add_default_view_predicates = lambda *arg: vp_called.append(True)\n        config._add_tween = lambda *arg, **kw: False\n        config.setup_registry()\n        self.assertTrue(vp_called)\n\n    def test_setup_registry_registers_default_webob_iresponse_adapter(self):\n        from webob import Response\n        from pyramid.interfaces import IResponse\n        config = self._makeOne()\n        config.setup_registry()\n        response = Response()\n        self.assertTrue(\n            config.registry.queryAdapter(response, IResponse) is response)\n\n    def test_setup_registry_explicit_notfound_trumps_iexceptionresponse(self):\n        from pyramid.renderers import null_renderer\n        from zope.interface import implementedBy\n        from pyramid.interfaces import IRequest\n        from pyramid.httpexceptions import HTTPNotFound\n        from pyramid.registry import Registry\n        reg = Registry()\n        config = self._makeOne(reg, autocommit=True)\n        config.setup_registry() # registers IExceptionResponse default view\n        def myview(context, request):\n            return 'OK'\n        config.add_view(myview, context=HTTPNotFound, renderer=null_renderer)\n        request = self._makeRequest(config)\n        view = self._getViewCallable(config,\n                                     ctx_iface=implementedBy(HTTPNotFound),\n                                     request_iface=IRequest)\n        result = view(None, request)\n        self.assertEqual(result, 'OK')\n\n    def test_setup_registry_custom_settings(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import ISettings\n        settings = {'reload_templates':True,\n                    'mysetting':True}\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(settings=settings)\n        settings = reg.getUtility(ISettings)\n        self.assertEqual(settings['reload_templates'], True)\n        self.assertEqual(settings['debug_authorization'], False)\n        self.assertEqual(settings['mysetting'], True)\n\n    def test_setup_registry_debug_logger_None_default(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDebugLogger\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry()\n        logger = reg.getUtility(IDebugLogger)\n        self.assertEqual(logger.name, 'pyramid.tests.test_config')\n\n    def test_setup_registry_debug_logger_non_None(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDebugLogger\n        logger = object()\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(debug_logger=logger)\n        result = reg.getUtility(IDebugLogger)\n        self.assertEqual(logger, result)\n\n    def test_setup_registry_debug_logger_name(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDebugLogger\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(debug_logger='foo')\n        result = reg.getUtility(IDebugLogger)\n        self.assertEqual(result.name, 'foo')\n\n    def test_setup_registry_authentication_policy(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IAuthenticationPolicy\n        policy = object()\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(authentication_policy=policy)\n        config.commit()\n        result = reg.getUtility(IAuthenticationPolicy)\n        self.assertEqual(policy, result)\n\n    def test_setup_registry_authentication_policy_dottedname(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IAuthenticationPolicy\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(authentication_policy='pyramid.tests.test_config')\n        config.commit()\n        result = reg.getUtility(IAuthenticationPolicy)\n        import pyramid.tests.test_config\n        self.assertEqual(result, pyramid.tests.test_config)\n\n    def test_setup_registry_authorization_policy_dottedname(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IAuthorizationPolicy\n        reg = Registry()\n        config = self._makeOne(reg)\n        dummy = object()\n        config.setup_registry(authentication_policy=dummy,\n                              authorization_policy='pyramid.tests.test_config')\n        config.commit()\n        result = reg.getUtility(IAuthorizationPolicy)\n        import pyramid.tests.test_config\n        self.assertEqual(result, pyramid.tests.test_config)\n\n    def test_setup_registry_authorization_policy_only(self):\n        from pyramid.registry import Registry\n        policy = object()\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(authorization_policy=policy)\n        config = self.assertRaises(ConfigurationExecutionError, config.commit)\n\n    def test_setup_registry_no_default_root_factory(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRootFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry()\n        config.commit()\n        self.assertEqual(reg.queryUtility(IRootFactory), None)\n\n    def test_setup_registry_dottedname_root_factory(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRootFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        import pyramid.tests.test_config\n        config.setup_registry(root_factory='pyramid.tests.test_config')\n        self.assertEqual(reg.queryUtility(IRootFactory), None)\n        config.commit()\n        self.assertEqual(reg.getUtility(IRootFactory),\n                         pyramid.tests.test_config)\n\n    def test_setup_registry_locale_negotiator_dottedname(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import ILocaleNegotiator\n        reg = Registry()\n        config = self._makeOne(reg)\n        import pyramid.tests.test_config\n        config.setup_registry(locale_negotiator='pyramid.tests.test_config')\n        self.assertEqual(reg.queryUtility(ILocaleNegotiator), None)\n        config.commit()\n        utility = reg.getUtility(ILocaleNegotiator)\n        self.assertEqual(utility, pyramid.tests.test_config)\n\n    def test_setup_registry_locale_negotiator(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import ILocaleNegotiator\n        reg = Registry()\n        config = self._makeOne(reg)\n        negotiator = object()\n        config.setup_registry(locale_negotiator=negotiator)\n        self.assertEqual(reg.queryUtility(ILocaleNegotiator), None)\n        config.commit()\n        utility = reg.getUtility(ILocaleNegotiator)\n        self.assertEqual(utility, negotiator)\n\n    def test_setup_registry_request_factory(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRequestFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        factory = object()\n        config.setup_registry(request_factory=factory)\n        self.assertEqual(reg.queryUtility(IRequestFactory), None)\n        config.commit()\n        utility = reg.getUtility(IRequestFactory)\n        self.assertEqual(utility, factory)\n\n    def test_setup_registry_response_factory(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IResponseFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        factory = lambda r: object()\n        config.setup_registry(response_factory=factory)\n        self.assertEqual(reg.queryUtility(IResponseFactory), None)\n        config.commit()\n        utility = reg.getUtility(IResponseFactory)\n        self.assertEqual(utility, factory)\n\n    def test_setup_registry_request_factory_dottedname(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRequestFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        import pyramid.tests.test_config\n        config.setup_registry(request_factory='pyramid.tests.test_config')\n        self.assertEqual(reg.queryUtility(IRequestFactory), None)\n        config.commit()\n        utility = reg.getUtility(IRequestFactory)\n        self.assertEqual(utility, pyramid.tests.test_config)\n\n    def test_setup_registry_alternate_renderers(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRendererFactory\n        renderer = object()\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(renderers=[('yeah', renderer)])\n        config.commit()\n        self.assertEqual(reg.getUtility(IRendererFactory, 'yeah'),\n                         renderer)\n\n    def test_setup_registry_default_permission(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDefaultPermission\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(default_permission='view')\n        config.commit()\n        self.assertEqual(reg.getUtility(IDefaultPermission), 'view')\n\n    def test_setup_registry_includes(self):\n        from pyramid.registry import Registry\n        reg = Registry()\n        config = self._makeOne(reg)\n        settings = {\n            'pyramid.includes':\n\"\"\"pyramid.tests.test_config.dummy_include\npyramid.tests.test_config.dummy_include2\"\"\",\n        }\n        config.setup_registry(settings=settings)\n        self.assertTrue(reg.included)\n        self.assertTrue(reg.also_included)\n\n    def test_setup_registry_includes_spaces(self):\n        from pyramid.registry import Registry\n        reg = Registry()\n        config = self._makeOne(reg)\n        settings = {\n            'pyramid.includes':\n\"\"\"pyramid.tests.test_config.dummy_include pyramid.tests.test_config.dummy_include2\"\"\",\n        }\n        config.setup_registry(settings=settings)\n        self.assertTrue(reg.included)\n        self.assertTrue(reg.also_included)\n\n    def test_setup_registry_tweens(self):\n        from pyramid.interfaces import ITweens\n        from pyramid.registry import Registry\n        reg = Registry()\n        config = self._makeOne(reg)\n        settings = {\n            'pyramid.tweens':\n                    'pyramid.tests.test_config.dummy_tween_factory'\n        }\n        config.setup_registry(settings=settings)\n        config.commit()\n        tweens = config.registry.getUtility(ITweens)\n        self.assertEqual(\n            tweens.explicit,\n            [('pyramid.tests.test_config.dummy_tween_factory',\n              dummy_tween_factory)])\n\n    def test_introspector_decorator(self):\n        inst = self._makeOne()\n        default = inst.introspector\n        self.assertTrue(hasattr(default, 'add'))\n        self.assertEqual(inst.introspector, inst.registry.introspector)\n        introspector = object()\n        inst.introspector = introspector\n        new = inst.introspector\n        self.assertTrue(new is introspector)\n        self.assertEqual(inst.introspector, inst.registry.introspector)\n        del inst.introspector\n        default = inst.introspector\n        self.assertFalse(default is new)\n        self.assertTrue(hasattr(default, 'add'))\n\n    def test_make_wsgi_app(self):\n        import pyramid.config\n        from pyramid.router import Router\n        from pyramid.interfaces import IApplicationCreated\n        manager = DummyThreadLocalManager()\n        config = self._makeOne()\n        subscriber = self._registerEventListener(config, IApplicationCreated)\n        config.manager = manager\n        app = config.make_wsgi_app()\n        self.assertEqual(app.__class__, Router)\n        self.assertEqual(manager.pushed['registry'], config.registry)\n        self.assertEqual(manager.pushed['request'], None)\n        self.assertTrue(manager.popped)\n        self.assertEqual(pyramid.config.global_registries.last, app.registry)\n        self.assertEqual(len(subscriber), 1)\n        self.assertTrue(IApplicationCreated.providedBy(subscriber[0]))\n        pyramid.config.global_registries.empty()\n\n    def test_include_with_dotted_name(self):\n        from pyramid.tests import test_config\n        config = self._makeOne()\n        config.include('pyramid.tests.test_config.dummy_include')\n        after = config.action_state\n        actions = after.actions\n        self.assertEqual(len(actions), 1)\n        action = after.actions[0]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_include_with_python_callable(self):\n        from pyramid.tests import test_config\n        config = self._makeOne()\n        config.include(dummy_include)\n        after = config.action_state\n        actions = after.actions\n        self.assertEqual(len(actions), 1)\n        action = actions[0]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_include_with_module_defaults_to_includeme(self):\n        from pyramid.tests import test_config\n        config = self._makeOne()\n        config.include('pyramid.tests.test_config')\n        after = config.action_state\n        actions = after.actions\n        self.assertEqual(len(actions), 1)\n        action = actions[0]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_include_with_module_defaults_to_includeme_missing(self):\n        from pyramid.exceptions import ConfigurationError\n        config = self._makeOne()\n        self.assertRaises(ConfigurationError, config.include, 'pyramid.tests')\n\n    def test_include_with_route_prefix(self):\n        root_config = self._makeOne(autocommit=True)\n        def dummy_subapp(config):\n            self.assertEqual(config.route_prefix, 'root')\n        root_config.include(dummy_subapp, route_prefix='root')\n\n    def test_include_with_nested_route_prefix(self):\n        root_config = self._makeOne(autocommit=True, route_prefix='root')\n        def dummy_subapp2(config):\n            self.assertEqual(config.route_prefix, 'root/nested')\n        def dummy_subapp3(config):\n            self.assertEqual(config.route_prefix, 'root/nested/nested2')\n            config.include(dummy_subapp4)\n        def dummy_subapp4(config):\n            self.assertEqual(config.route_prefix, 'root/nested/nested2')\n        def dummy_subapp(config):\n            self.assertEqual(config.route_prefix, 'root/nested')\n            config.include(dummy_subapp2)\n            config.include(dummy_subapp3, route_prefix='nested2')\n\n        root_config.include(dummy_subapp, route_prefix='nested')\n\n    def test_include_with_missing_source_file(self):\n        from pyramid.exceptions import ConfigurationError\n        import inspect\n        config = self._makeOne()\n        class DummyInspect(object):\n            def getmodule(self, c):\n                return inspect.getmodule(c)\n            def getsourcefile(self, c):\n                return None\n        config.inspect = DummyInspect()\n        try:\n            config.include('pyramid.tests.test_config.dummy_include')\n        except ConfigurationError as e:\n            self.assertEqual(\n                e.args[0], \n                \"No source file for module 'pyramid.tests.test_config' (.py \"\n                \"file must exist, refusing to use orphan .pyc or .pyo file).\")\n        else: # pragma: no cover\n            raise AssertionError\n\n    def test_include_constant_root_package(self):\n        from pyramid import tests\n        from pyramid.tests import test_config\n        config = self._makeOne(root_package=tests)\n        results = {}\n        def include(config):\n            results['package'] = config.package\n            results['root_package'] = config.root_package\n        config.include(include)\n        self.assertEqual(results['root_package'], tests)\n        self.assertEqual(results['package'], test_config)\n\n    def test_action_branching_kw_is_None(self):\n        config = self._makeOne(autocommit=True)\n        self.assertEqual(config.action('discrim'), None)\n\n    def test_action_branching_kw_is_not_None(self):\n        config = self._makeOne(autocommit=True)\n        self.assertEqual(config.action('discrim', kw={'a':1}), None)\n\n    def test_action_autocommit_with_introspectables(self):\n        from pyramid.util import ActionInfo\n        config = self._makeOne(autocommit=True)\n        intr = DummyIntrospectable()\n        config.action('discrim', introspectables=(intr,))\n        self.assertEqual(len(intr.registered), 1)\n        self.assertEqual(intr.registered[0][0], config.introspector)\n        self.assertEqual(intr.registered[0][1].__class__, ActionInfo)\n\n    def test_action_autocommit_with_introspectables_introspection_off(self):\n        config = self._makeOne(autocommit=True)\n        config.introspection = False\n        intr = DummyIntrospectable()\n        config.action('discrim', introspectables=(intr,))\n        self.assertEqual(len(intr.registered), 0)\n        \n    def test_action_branching_nonautocommit_with_config_info(self):\n        config = self._makeOne(autocommit=False)\n        config.info = 'abc'\n        state = DummyActionState()\n        state.autocommit = False\n        config.action_state = state\n        config.action('discrim', kw={'a':1})\n        self.assertEqual(\n            state.actions,\n            [((),\n             {'args': (),\n             'callable': None,\n             'discriminator': 'discrim',\n             'includepath': (),\n             'info': 'abc',\n             'introspectables': (),\n             'kw': {'a': 1},\n             'order': 0})])\n\n    def test_action_branching_nonautocommit_without_config_info(self):\n        config = self._makeOne(autocommit=False)\n        config.info = ''\n        config._ainfo = ['z']\n        state = DummyActionState()\n        config.action_state = state\n        state.autocommit = False\n        config.action('discrim', kw={'a':1})\n        self.assertEqual(\n            state.actions,\n            [((),\n             {'args': (),\n             'callable': None,\n             'discriminator': 'discrim',\n             'includepath': (),\n             'info': 'z',\n             'introspectables': (),\n             'kw': {'a': 1},\n             'order': 0})])\n\n    def test_action_branching_nonautocommit_with_introspectables(self):\n        config = self._makeOne(autocommit=False)\n        config.info = ''\n        config._ainfo = []\n        state = DummyActionState()\n        config.action_state = state\n        state.autocommit = False\n        intr = DummyIntrospectable()\n        config.action('discrim', introspectables=(intr,))\n        self.assertEqual(\n            state.actions[0][1]['introspectables'], (intr,))\n\n    def test_action_nonautocommit_with_introspectables_introspection_off(self):\n        config = self._makeOne(autocommit=False)\n        config.info = ''\n        config._ainfo = []\n        config.introspection = False\n        state = DummyActionState()\n        config.action_state = state\n        state.autocommit = False\n        intr = DummyIntrospectable()\n        config.action('discrim', introspectables=(intr,))\n        self.assertEqual(\n            state.actions[0][1]['introspectables'], ())\n        \n    def test_scan_integration(self):\n        from zope.interface import alsoProvides\n        from pyramid.interfaces import IRequest\n        from pyramid.view import render_view_to_response\n        import pyramid.tests.test_config.pkgs.scannable as package\n        config = self._makeOne(autocommit=True)\n        config.scan(package)\n\n        ctx = DummyContext()\n        req = DummyRequest()\n        alsoProvides(req, IRequest)\n        req.registry = config.registry\n\n        req.method = 'GET'\n        result = render_view_to_response(ctx, req, '')\n        self.assertEqual(result, 'grokked')\n\n        req.method = 'POST'\n        result = render_view_to_response(ctx, req, '')\n        self.assertEqual(result, 'grokked_post')\n\n        result= render_view_to_response(ctx, req, 'grokked_class')\n        self.assertEqual(result, 'grokked_class')\n\n        result= render_view_to_response(ctx, req, 'grokked_instance')\n        self.assertEqual(result, 'grokked_instance')\n\n        result= render_view_to_response(ctx, req, 'oldstyle_grokked_class')\n        self.assertEqual(result, 'oldstyle_grokked_class')\n\n        req.method = 'GET'\n        result = render_view_to_response(ctx, req, 'another')\n        self.assertEqual(result, 'another_grokked')\n\n        req.method = 'POST'\n        result = render_view_to_response(ctx, req, 'another')\n        self.assertEqual(result, 'another_grokked_post')\n\n        result= render_view_to_response(ctx, req, 'another_grokked_class')\n        self.assertEqual(result, 'another_grokked_class')\n\n        result= render_view_to_response(ctx, req, 'another_grokked_instance')\n        self.assertEqual(result, 'another_grokked_instance')\n\n        result= render_view_to_response(ctx, req,\n                                        'another_oldstyle_grokked_class')\n        self.assertEqual(result, 'another_oldstyle_grokked_class')\n\n        result = render_view_to_response(ctx, req, 'stacked1')\n        self.assertEqual(result, 'stacked')\n\n        result = render_view_to_response(ctx, req, 'stacked2')\n        self.assertEqual(result, 'stacked')\n\n        result = render_view_to_response(ctx, req, 'another_stacked1')\n        self.assertEqual(result, 'another_stacked')\n\n        result = render_view_to_response(ctx, req, 'another_stacked2')\n        self.assertEqual(result, 'another_stacked')\n\n        result = render_view_to_response(ctx, req, 'stacked_class1')\n        self.assertEqual(result, 'stacked_class')\n\n        result = render_view_to_response(ctx, req, 'stacked_class2')\n        self.assertEqual(result, 'stacked_class')\n\n        result = render_view_to_response(ctx, req, 'another_stacked_class1')\n        self.assertEqual(result, 'another_stacked_class')\n\n        result = render_view_to_response(ctx, req, 'another_stacked_class2')\n        self.assertEqual(result, 'another_stacked_class')\n\n        # NB: on Jython, a class without an __init__ apparently accepts\n        # any number of arguments without raising a TypeError, so the next\n        # assertion may fail there.  We don't support Jython at the moment,\n        # this is just a note to a future self.\n\n        self.assertRaises(TypeError,\n                          render_view_to_response, ctx, req, 'basemethod')\n\n        result = render_view_to_response(ctx, req, 'method1')\n        self.assertEqual(result, 'method1')\n\n        result = render_view_to_response(ctx, req, 'method2')\n        self.assertEqual(result, 'method2')\n\n        result = render_view_to_response(ctx, req, 'stacked_method1')\n        self.assertEqual(result, 'stacked_method')\n\n        result = render_view_to_response(ctx, req, 'stacked_method2')\n        self.assertEqual(result, 'stacked_method')\n\n        result = render_view_to_response(ctx, req, 'subpackage_init')\n        self.assertEqual(result, 'subpackage_init')\n\n        result = render_view_to_response(ctx, req, 'subpackage_notinit')\n        self.assertEqual(result, 'subpackage_notinit')\n\n        result = render_view_to_response(ctx, req, 'subsubpackage_init')\n        self.assertEqual(result, 'subsubpackage_init')\n\n        result = render_view_to_response(ctx, req, 'pod_notinit')\n        self.assertEqual(result, None)\n\n    def test_scan_integration_with_ignore(self):\n        from zope.interface import alsoProvides\n        from pyramid.interfaces import IRequest\n        from pyramid.view import render_view_to_response\n        import pyramid.tests.test_config.pkgs.scannable as package\n        config = self._makeOne(autocommit=True)\n        config.scan(package, \n                    ignore='pyramid.tests.test_config.pkgs.scannable.another')\n\n        ctx = DummyContext()\n        req = DummyRequest()\n        alsoProvides(req, IRequest)\n        req.registry = config.registry\n\n        req.method = 'GET'\n        result = render_view_to_response(ctx, req, '')\n        self.assertEqual(result, 'grokked')\n\n        # ignored\n        v = render_view_to_response(ctx, req, 'another_stacked_class2')\n        self.assertEqual(v, None)\n        \n    def test_scan_integration_dottedname_package(self):\n        from zope.interface import alsoProvides\n        from pyramid.interfaces import IRequest\n        from pyramid.view import render_view_to_response\n        config = self._makeOne(autocommit=True)\n        config.scan('pyramid.tests.test_config.pkgs.scannable')\n\n        ctx = DummyContext()\n        req = DummyRequest()\n        alsoProvides(req, IRequest)\n        req.registry = config.registry\n\n        req.method = 'GET'\n        result = render_view_to_response(ctx, req, '')\n        self.assertEqual(result, 'grokked')\n\n    def test_scan_integration_with_extra_kw(self):\n        config = self._makeOne(autocommit=True)\n        config.scan('pyramid.tests.test_config.pkgs.scanextrakw', a=1)\n        self.assertEqual(config.a, 1)\n\n    def test_scan_integration_with_onerror(self):\n        # fancy sys.path manipulation here to appease \"setup.py test\" which\n        # fails miserably when it can't import something in the package\n        import sys\n        try:\n            here = os.path.dirname(__file__)\n            path = os.path.join(here, 'path')\n            sys.path.append(path)\n            config = self._makeOne(autocommit=True)\n            class FooException(Exception):\n                pass\n            def onerror(name):\n                raise FooException\n            self.assertRaises(FooException, config.scan, 'scanerror',\n                              onerror=onerror)\n        finally:\n            sys.path.remove(path)\n\n    def test_scan_integration_conflict(self):\n        from pyramid.tests.test_config.pkgs import selfscan\n        from pyramid.config import Configurator\n        c = Configurator()\n        c.scan(selfscan)\n        c.scan(selfscan)\n        try:\n            c.commit()\n        except ConfigurationConflictError as why:\n            def scanconflicts(e):\n                conflicts = e._conflicts.values()\n                for conflict in conflicts:\n                    for confinst in conflict:\n                        yield confinst.src\n            which = list(scanconflicts(why))\n            self.assertEqual(len(which), 4)\n            self.assertTrue(\"@view_config(renderer='string')\" in which)\n            self.assertTrue(\"@view_config(name='two', renderer='string')\" in\n                            which)\n\n    @skip_on('py3')\n    def test_hook_zca(self):\n        from zope.component import getSiteManager\n        def foo():\n            '123'\n        try:\n            config = self._makeOne()\n            config.hook_zca()\n            config.begin()\n            sm = getSiteManager()\n            self.assertEqual(sm, config.registry)\n        finally:\n            getSiteManager.reset()\n\n    @skip_on('py3')\n    def test_unhook_zca(self):\n        from zope.component import getSiteManager\n        def foo():\n            '123'\n        try:\n            getSiteManager.sethook(foo)\n            config = self._makeOne()\n            config.unhook_zca()\n            sm = getSiteManager()\n            self.assertNotEqual(sm, '123')\n        finally:\n            getSiteManager.reset()\n\n    def test_commit_conflict_simple(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        config.add_view(view1)\n        config.add_view(view2)\n        self.assertRaises(ConfigurationConflictError, config.commit)\n\n    def test_commit_conflict_resolved_with_include(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        def includeme(config):\n            config.add_view(view2)\n        config.add_view(view1)\n        config.include(includeme)\n        config.commit()\n        registeredview = self._getViewCallable(config)\n        self.assertEqual(registeredview.__name__, 'view1')\n\n    def test_commit_conflict_with_two_includes(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        def includeme1(config):\n            config.add_view(view1)\n        def includeme2(config):\n            config.add_view(view2)\n        config.include(includeme1)\n        config.include(includeme2)\n        try:\n            config.commit()\n        except ConfigurationConflictError as why:\n            c1, c2 = _conflictFunctions(why)\n            self.assertEqual(c1, 'includeme1')\n            self.assertEqual(c2, 'includeme2')\n        else: #pragma: no cover\n            raise AssertionError\n\n    def test_commit_conflict_resolved_with_two_includes_and_local(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        def view3(request): pass\n        def includeme1(config):\n            config.add_view(view1)\n        def includeme2(config):\n            config.add_view(view2)\n        config.include(includeme1)\n        config.include(includeme2)\n        config.add_view(view3)\n        config.commit()\n        registeredview = self._getViewCallable(config)\n        self.assertEqual(registeredview.__name__, 'view3')\n\n    def test_autocommit_no_conflicts(self):\n        from pyramid.renderers import null_renderer\n        config = self._makeOne(autocommit=True)\n        def view1(request): pass\n        def view2(request): pass\n        def view3(request): pass\n        config.add_view(view1, renderer=null_renderer)\n        config.add_view(view2, renderer=null_renderer)\n        config.add_view(view3, renderer=null_renderer)\n        config.commit()\n        registeredview = self._getViewCallable(config)\n        self.assertEqual(registeredview.__name__, 'view3')\n\n    def test_conflict_set_notfound_view(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        config.set_notfound_view(view1)\n        config.set_notfound_view(view2)\n        try:\n            config.commit()\n        except ConfigurationConflictError as why:\n            c1, c2 = _conflictFunctions(why)\n            self.assertEqual(c1, 'test_conflict_set_notfound_view')\n            self.assertEqual(c2, 'test_conflict_set_notfound_view')\n        else: # pragma: no cover\n            raise AssertionError\n\n    def test_conflict_set_forbidden_view(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        config.set_forbidden_view(view1)\n        config.set_forbidden_view(view2)\n        try:\n            config.commit()\n        except ConfigurationConflictError as why:\n            c1, c2 = _conflictFunctions(why)\n            self.assertEqual(c1, 'test_conflict_set_forbidden_view')\n            self.assertEqual(c2, 'test_conflict_set_forbidden_view')\n        else: # pragma: no cover\n            raise AssertionError\n\n    def test___getattr__missing_when_directives_exist(self):\n        config = self._makeOne()\n        directives = {}\n        config.registry._directives = directives\n        self.assertRaises(AttributeError, config.__getattr__, 'wontexist')\n\n    def test___getattr__missing_when_directives_dont_exist(self):\n        config = self._makeOne()\n        self.assertRaises(AttributeError, config.__getattr__, 'wontexist')\n\n    def test___getattr__matches(self):\n        config = self._makeOne()\n        def foo(config): pass\n        directives = {'foo':(foo, True)}\n        config.registry._directives = directives\n        foo_meth = config.foo\n        self.assertTrue(getattr(foo_meth, im_func).__docobj__ is foo)\n\n    def test___getattr__matches_no_action_wrap(self):\n        config = self._makeOne()\n        def foo(config): pass\n        directives = {'foo':(foo, False)}\n        config.registry._directives = directives\n        foo_meth = config.foo\n        self.assertTrue(getattr(foo_meth, im_func) is foo)\n\nclass TestConfigurator_add_directive(unittest.TestCase):\n\n    def setUp(self):\n        from pyramid.config import Configurator\n        self.config = Configurator()\n\n    def test_extend_with_dotted_name(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n            'dummy_extend', 'pyramid.tests.test_config.dummy_extend')\n        self.assertTrue(hasattr(config, 'dummy_extend'))\n        config.dummy_extend('discrim')\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_add_directive_with_partial(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n                'dummy_partial', 'pyramid.tests.test_config.dummy_partial')\n        self.assertTrue(hasattr(config, 'dummy_partial'))\n        config.dummy_partial()\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'partial')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_add_directive_with_custom_callable(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n                'dummy_callable', 'pyramid.tests.test_config.dummy_callable')\n        self.assertTrue(hasattr(config, 'dummy_callable'))\n        config.dummy_callable('discrim')\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_extend_with_python_callable(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n            'dummy_extend', dummy_extend)\n        self.assertTrue(hasattr(config, 'dummy_extend'))\n        config.dummy_extend('discrim')\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_extend_same_name_doesnt_conflict(self):\n        config = self.config\n        config.add_directive(\n            'dummy_extend', dummy_extend)\n        config.add_directive(\n            'dummy_extend', dummy_extend2)\n        self.assertTrue(hasattr(config, 'dummy_extend'))\n        config.dummy_extend('discrim')\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], config.registry)\n\n    def test_extend_action_method_successful(self):\n        config = self.config\n        config.add_directive(\n            'dummy_extend', dummy_extend)\n        config.dummy_extend('discrim')\n        config.dummy_extend('discrim')\n        self.assertRaises(ConfigurationConflictError, config.commit)\n\n    def test_directive_persists_across_configurator_creations(self):\n        config = self.config\n        config.add_directive('dummy_extend', dummy_extend)\n        config2 = config.with_package('pyramid.tests')\n        config2.dummy_extend('discrim')\n        after = config2.action_state\n        actions = after.actions\n        self.assertEqual(len(actions), 1)\n        action = actions[0]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], config2.package)\n\nclass TestConfigurator__add_predicate(unittest.TestCase):\n    def _makeOne(self):\n        from pyramid.config import Configurator\n        return Configurator()\n\n    def test_factory_as_object(self):\n        config = self._makeOne()\n\n        def _fakeAction(discriminator, callable=None, args=(), kw=None,\n                        order=0, introspectables=(), **extra):\n            self.assertEqual(len(introspectables), 1)\n            self.assertEqual(introspectables[0]['name'], 'testing')\n            self.assertEqual(introspectables[0]['factory'], DummyPredicate)\n\n        config.action = _fakeAction\n        config._add_predicate('route', 'testing', DummyPredicate)\n\n    def test_factory_as_dotted_name(self):\n        config = self._makeOne()\n\n        def _fakeAction(discriminator, callable=None, args=(),\n                        kw=None, order=0, introspectables=(), **extra):\n            self.assertEqual(len(introspectables), 1)\n            self.assertEqual(introspectables[0]['name'], 'testing')\n            self.assertEqual(introspectables[0]['factory'], DummyPredicate)\n\n        config.action = _fakeAction\n        config._add_predicate(\n            'route',\n            'testing',\n            'pyramid.tests.test_config.test_init.DummyPredicate'\n            )\n        \nclass TestActionState(unittest.TestCase):\n    def _makeOne(self):\n        from pyramid.config import ActionState\n        return ActionState()\n    \n    def test_it(self):\n        c = self._makeOne()\n        self.assertEqual(c.actions, [])\n\n    def test_action_simple(self):\n        from pyramid.tests.test_config import dummyfactory as f\n        c = self._makeOne()\n        c.actions = []\n        c.action(1, f, (1,), {'x':1})\n        self.assertEqual(\n            c.actions,\n            [{'args': (1,),\n             'callable': f,\n             'discriminator': 1,\n             'includepath': (),\n             'info': None,\n             'introspectables': (),\n             'kw': {'x': 1},\n             'order': 0}])\n        c.action(None)\n        self.assertEqual(\n            c.actions,\n            [{'args': (1,),\n             'callable': f,\n             'discriminator': 1,\n             'includepath': (),\n             'info': None,\n             'introspectables': (),\n             'kw': {'x': 1},\n             'order': 0},\n\n             {'args': (),\n             'callable': None,\n             'discriminator': None,\n             'includepath': (),\n             'info': None,\n             'introspectables': (),\n             'kw': {},\n             'order': 0},])\n\n    def test_action_with_includepath(self):\n        c = self._makeOne()\n        c.actions = []\n        c.action(None, includepath=('abc',))\n        self.assertEqual(\n            c.actions,\n            [{'args': (),\n             'callable': None,\n             'discriminator': None,\n             'includepath': ('abc',),\n             'info': None,\n             'introspectables': (),\n             'kw': {},\n             'order': 0}])\n\n    def test_action_with_info(self):\n        c = self._makeOne()\n        c.action(None, info='abc')\n        self.assertEqual(\n            c.actions,\n            [{'args': (),\n             'callable': None,\n             'discriminator': None,\n             'includepath': (),\n             'info': 'abc',\n             'introspectables': (),\n             'kw': {},\n             'order': 0}])\n\n    def test_action_with_includepath_and_info(self):\n        c = self._makeOne()\n        c.action(None, includepath=('spec',), info='bleh')\n        self.assertEqual(\n            c.actions,\n            [{'args': (),\n             'callable': None,\n             'discriminator': None,\n             'includepath': ('spec',),\n             'info': 'bleh',\n             'introspectables': (),\n             'kw': {},\n             'order': 0}])\n\n    def test_action_with_order(self):\n        c = self._makeOne()\n        c.actions = []\n        c.action(None, order=99999)\n        self.assertEqual(\n            c.actions,\n            [{'args': (),\n             'callable': None,\n             'discriminator': None,\n             'includepath': (),\n             'info': None,\n             'introspectables': (),\n             'kw': {},\n             'order': 99999}])\n\n    def test_action_with_introspectables(self):\n        c = self._makeOne()\n        c.actions = []\n        intr = DummyIntrospectable()\n        c.action(None, introspectables=(intr,))\n        self.assertEqual(\n            c.actions,\n            [{'args': (),\n             'callable': None,\n             'discriminator': None,\n             'includepath': (),\n             'info': None,\n             'introspectables': (intr,),\n             'kw': {},\n             'order': 0}])\n\n    def test_processSpec(self):\n        c = self._makeOne()\n        self.assertTrue(c.processSpec('spec'))\n        self.assertFalse(c.processSpec('spec'))\n\n    def test_execute_actions_tuples(self):\n        output = []\n        def f(*a, **k):\n            output.append((a, k))\n        c = self._makeOne()\n        c.actions = [\n            (1, f, (1,)),\n            (1, f, (11,), {}, ('x', )),\n            (2, f, (2,)),\n            (None, None),\n            ]\n        c.execute_actions()\n        self.assertEqual(output,  [((1,), {}), ((2,), {})])\n\n    def test_execute_actions_dicts(self):\n        output = []\n        def f(*a, **k):\n            output.append((a, k))\n        c = self._makeOne()\n        c.actions = [\n            {'discriminator':1, 'callable':f, 'args':(1,), 'kw':{},\n             'order':0, 'includepath':(), 'info':None,\n             'introspectables':()},\n            {'discriminator':1, 'callable':f, 'args':(11,), 'kw':{},\n             'includepath':('x',), 'order': 0, 'info':None,\n             'introspectables':()},\n            {'discriminator':2, 'callable':f, 'args':(2,), 'kw':{},\n             'order':0, 'includepath':(), 'info':None,\n             'introspectables':()},\n            {'discriminator':None, 'callable':None, 'args':(), 'kw':{},\n             'order':0, 'includepath':(), 'info':None,\n             'introspectables':()},\n            ]\n        c.execute_actions()\n        self.assertEqual(output,  [((1,), {}), ((2,), {})])\n\n    def test_execute_actions_with_introspectables(self):\n        output = []\n        def f(*a, **k):\n            output.append((a, k))\n        c = self._makeOne()\n        intr = DummyIntrospectable()\n        c.actions = [\n            {'discriminator':1, 'callable':f, 'args':(1,), 'kw':{},\n             'order':0, 'includepath':(), 'info':None,\n             'introspectables':(intr,)},\n            ]\n        introspector = object()\n        c.execute_actions(introspector=introspector)\n        self.assertEqual(output,  [((1,), {})])\n        self.assertEqual(intr.registered, [(introspector, None)])\n\n    def test_execute_actions_with_introspectable_no_callable(self):\n        c = self._makeOne()\n        intr = DummyIntrospectable()\n        c.actions = [\n            {'discriminator':1, 'callable':None, 'args':(1,), 'kw':{},\n             'order':0, 'includepath':(), 'info':None,\n             'introspectables':(intr,)},\n            ]\n        introspector = object()\n        c.execute_actions(introspector=introspector)\n        self.assertEqual(intr.registered, [(introspector, None)])\n\n    def test_execute_actions_error(self):\n        output = []\n        def f(*a, **k):\n            output.append(('f', a, k))\n        def bad():\n            raise NotImplementedError\n        c = self._makeOne()\n        c.actions = [\n            (1, f, (1,)),\n            (1, f, (11,), {}, ('x', )),\n            (2, f, (2,)),\n            (3, bad, (), {}, (), 'oops')\n            ]\n        self.assertRaises(ConfigurationExecutionError, c.execute_actions)\n        self.assertEqual(output, [('f', (1,), {}), ('f', (2,), {})])\n\n    def test_reentrant_action(self):\n        output = []\n        c = self._makeOne()\n        def f(*a, **k):\n            output.append(('f', a, k))\n            c.actions.append((3, g, (8,), {}))\n        def g(*a, **k):\n            output.append(('g', a, k))\n        c.actions = [\n            (1, f, (1,)),\n        ]\n        c.execute_actions()\n        self.assertEqual(output, [('f', (1,), {}), ('g', (8,), {})])\n\n    def test_reentrant_action_with_deferred_discriminator(self):\n        # see https://github.com/Pylons/pyramid/issues/2697\n        from pyramid.registry import Deferred\n        output = []\n        c = self._makeOne()\n        def f(*a, **k):\n            output.append(('f', a, k))\n            c.actions.append((4, g, (4,), {}, (), None, 2))\n        def g(*a, **k):\n            output.append(('g', a, k))\n        def h(*a, **k):\n            output.append(('h', a, k))\n        def discrim():\n            self.assertEqual(output, [('f', (1,), {}), ('g', (2,), {})])\n            return 3\n        d = Deferred(discrim)\n        c.actions = [\n            (d, h, (3,), {}, (), None, 1), # order 1\n            (1, f, (1,)), # order 0\n            (2, g, (2,)), # order 0\n        ]\n        c.execute_actions()\n        self.assertEqual(output, [\n            ('f', (1,), {}), ('g', (2,), {}), ('h', (3,), {}), ('g', (4,), {})])\n\n    def test_reentrant_action_error(self):\n        from pyramid.exceptions import ConfigurationError\n        c = self._makeOne()\n        def f(*a, **k):\n            c.actions.append((3, g, (8,), {}, (), None, -1))\n        def g(*a, **k): pass\n        c.actions = [\n            (1, f, (1,)),\n        ]\n        self.assertRaises(ConfigurationError, c.execute_actions)\n\n    def test_reentrant_action_without_clear(self):\n        c = self._makeOne()\n        def f(*a, **k):\n            c.actions.append((3, g, (8,)))\n        def g(*a, **k): pass\n        c.actions = [\n            (1, f, (1,)),\n        ]\n        c.execute_actions(clear=False)\n        self.assertEqual(c.actions, [\n            (1, f, (1,)),\n            (3, g, (8,)),\n        ])\n\n    def test_executing_conflicting_action_across_orders(self):\n        from pyramid.exceptions import ConfigurationConflictError\n        c = self._makeOne()\n        def f(*a, **k): pass\n        def g(*a, **k): pass\n        c.actions = [\n            (1, f, (1,), {}, (), None, -1),\n            (1, g, (2,)),\n        ]\n        self.assertRaises(ConfigurationConflictError, c.execute_actions)\n\n    def test_executing_conflicting_action_across_reentrant_orders(self):\n        from pyramid.exceptions import ConfigurationConflictError\n        c = self._makeOne()\n        def f(*a, **k):\n            c.actions.append((1, g, (8,)))\n        def g(*a, **k): pass\n        c.actions = [\n            (1, f, (1,), {}, (), None, -1),\n        ]\n        self.assertRaises(ConfigurationConflictError, c.execute_actions)\n\nclass Test_reentrant_action_functional(unittest.TestCase):\n    def _makeConfigurator(self, *arg, **kw):\n        from pyramid.config import Configurator\n        config = Configurator(*arg, **kw)\n        return config\n\n    def test_functional(self):\n        def add_auto_route(config, name, view):\n               def register():\n                   config.add_view(route_name=name, view=view)\n                   config.add_route(name, '/' + name)\n               config.action(\n                   ('auto route', name), register, order=-30\n                   )\n        config = self._makeConfigurator()\n        config.add_directive('add_auto_route', add_auto_route)\n        def my_view(request): return request.response\n        config.add_auto_route('foo', my_view)\n        config.commit()\n        from pyramid.interfaces import IRoutesMapper\n        mapper = config.registry.getUtility(IRoutesMapper)\n        routes = mapper.get_routes()\n        route = routes[0]\n        self.assertEqual(len(routes), 1)\n        self.assertEqual(route.name, 'foo')\n        self.assertEqual(route.path, '/foo')\n\n    def test_deferred_discriminator(self):\n        # see https://github.com/Pylons/pyramid/issues/2697\n        from pyramid.config import PHASE0_CONFIG\n        config = self._makeConfigurator()\n        def deriver(view, info): return view\n        deriver.options = ('foo',)\n        config.add_view_deriver(deriver, 'foo_view')\n        # add_view uses a deferred discriminator and will fail if executed\n        # prior to add_view_deriver executing its action\n        config.add_view(lambda r: r.response, name='', foo=1)\n        def dummy_action():\n            # trigger a re-entrant action\n            config.action(None, lambda: None)\n        config.action(None, dummy_action, order=PHASE0_CONFIG)\n        config.commit()\n\nclass Test_resolveConflicts(unittest.TestCase):\n    def _callFUT(self, actions):\n        from pyramid.config import resolveConflicts\n        return resolveConflicts(actions)\n\n    def test_it_success_tuples(self):\n        from pyramid.tests.test_config import dummyfactory as f\n        result = self._callFUT([\n            (None, f),\n            (1, f, (1,), {}, (), 'first'),\n            (1, f, (2,), {}, ('x',), 'second'),\n            (1, f, (3,), {}, ('y',), 'third'),\n            (4, f, (4,), {}, ('y',), 'should be last', 99999),\n            (3, f, (3,), {}, ('y',)),\n            (None, f, (5,), {}, ('y',)),\n            ])\n        result = list(result)\n        self.assertEqual(\n            result,\n            [{'info': None,\n              'args': (),\n              'callable': f,\n              'introspectables': (),\n              'kw': {},\n              'discriminator': None,\n              'includepath': (),\n              'order': 0},\n\n              {'info': 'first',\n               'args': (1,),\n               'callable': f,\n               'introspectables': (),\n               'kw': {},\n               'discriminator': 1,\n               'includepath': (),\n               'order': 0},\n\n               {'info': None,\n                'args': (3,),\n                'callable': f,\n                'introspectables': (),\n                'kw': {},\n                'discriminator': 3,\n                'includepath': ('y',),\n                'order': 0},\n\n                {'info': None,\n                 'args': (5,),\n                 'callable': f,\n                 'introspectables': (),\n                 'kw': {},\n                 'discriminator': None,\n                 'includepath': ('y',),\n                 'order': 0},\n\n                 {'info': 'should be last',\n                  'args': (4,),\n                  'callable': f,\n                  'introspectables': (),\n                  'kw': {},\n                  'discriminator': 4,\n                  'includepath': ('y',),\n                  'order': 99999}\n                  ]\n                  )\n\n    def test_it_success_dicts(self):\n        from pyramid.tests.test_config import dummyfactory as f\n        result = self._callFUT([\n            (None, f),\n            (1, f, (1,), {}, (), 'first'),\n            (1, f, (2,), {}, ('x',), 'second'),\n            (1, f, (3,), {}, ('y',), 'third'),\n            (4, f, (4,), {}, ('y',), 'should be last', 99999),\n            (3, f, (3,), {}, ('y',)),\n            (None, f, (5,), {}, ('y',)),\n            ])\n        result = list(result)\n        self.assertEqual(\n            result,\n            [{'info': None,\n              'args': (),\n              'callable': f,\n              'introspectables': (),\n              'kw': {},\n              'discriminator': None,\n              'includepath': (),\n              'order': 0},\n\n              {'info': 'first',\n               'args': (1,),\n               'callable': f,\n               'introspectables': (),\n               'kw': {},\n               'discriminator': 1,\n               'includepath': (),\n               'order': 0},\n\n               {'info': None,\n                'args': (3,),\n                'callable': f,\n                'introspectables': (),\n                'kw': {},\n                'discriminator': 3,\n                'includepath': ('y',),\n                'order': 0},\n\n                {'info': None,\n                 'args': (5,),\n                 'callable': f,\n                 'introspectables': (),\n                 'kw': {},\n                 'discriminator': None,\n                 'includepath': ('y',),\n                 'order': 0},\n\n                 {'info': 'should be last',\n                  'args': (4,),\n                  'callable': f,\n                  'introspectables': (),\n                  'kw': {},\n                  'discriminator': 4,\n                  'includepath': ('y',),\n                  'order': 99999}\n                  ]\n                  )\n\n    def test_it_conflict(self):\n        from pyramid.tests.test_config import dummyfactory as f\n        result = self._callFUT([\n            (None, f),\n            (1, f, (2,), {}, ('x',), 'eek'),     # will conflict\n            (1, f, (3,), {}, ('y',), 'ack'),     # will conflict\n            (4, f, (4,), {}, ('y',)),\n            (3, f, (3,), {}, ('y',)),\n            (None, f, (5,), {}, ('y',)),\n            ])\n        self.assertRaises(ConfigurationConflictError, list, result)\n\n    def test_it_with_actions_grouped_by_order(self):\n        from pyramid.tests.test_config import dummyfactory as f\n        result = self._callFUT([\n            (None, f),                                 # X\n            (1, f, (1,), {}, (), 'third', 10),         # X\n            (1, f, (2,), {}, ('x',), 'fourth', 10),\n            (1, f, (3,), {}, ('y',), 'fifth', 10),\n            (2, f, (1,), {}, (), 'sixth', 10),         # X\n            (3, f, (1,), {}, (), 'seventh', 10),       # X\n            (5, f, (4,), {}, ('y',), 'eighth', 99999), # X\n            (4, f, (3,), {}, (), 'first', 5),          # X\n            (4, f, (5,), {}, ('y',), 'second', 5),\n            ])\n        result = list(result)\n        self.assertEqual(len(result), 6)\n        # resolved actions should be grouped by (order, i)\n        self.assertEqual(\n            result,\n            [{'info': None,\n              'args': (),\n              'callable': f,\n              'introspectables': (),\n              'kw': {},\n              'discriminator': None,\n              'includepath': (),\n              'order': 0},\n\n              {'info': 'first',\n               'args': (3,),\n               'callable': f,\n               'introspectables': (),\n               'kw': {},\n               'discriminator': 4,\n               'includepath': (),\n               'order': 5},\n\n               {'info': 'third',\n                'args': (1,),\n                'callable': f,\n                'introspectables': (),\n                'kw': {},\n                'discriminator': 1,\n                'includepath': (),\n                'order': 10},\n\n               {'info': 'sixth',\n                'args': (1,),\n                'callable': f,\n                'introspectables': (),\n                'kw': {},\n                'discriminator': 2,\n                'includepath': (),\n                'order': 10},\n\n               {'info': 'seventh',\n                'args': (1,),\n                'callable': f,\n                'introspectables': (),\n                'kw': {},\n                'discriminator': 3,\n                'includepath': (),\n                'order': 10},\n\n                 {'info': 'eighth',\n                  'args': (4,),\n                  'callable': f,\n                  'introspectables': (),\n                  'kw': {},\n                  'discriminator': 5,\n                  'includepath': ('y',),\n                  'order': 99999}\n                  ]\n                  )\n\n    def test_override_success_across_orders(self):\n        from pyramid.tests.test_config import dummyfactory as f\n        result = self._callFUT([\n            (1, f, (2,), {}, ('x',), 'eek', 0),\n            (1, f, (3,), {}, ('x', 'y'), 'ack', 10),\n            ])\n        result = list(result)\n        self.assertEqual(result, [\n            {'info': 'eek',\n            'args': (2,),\n            'callable': f,\n            'introspectables': (),\n            'kw': {},\n            'discriminator': 1,\n            'includepath': ('x',),\n            'order': 0},\n        ])\n\n    def test_conflicts_across_orders(self):\n        from pyramid.tests.test_config import dummyfactory as f\n        result = self._callFUT([\n            (1, f, (2,), {}, ('x', 'y'), 'eek', 0),\n            (1, f, (3,), {}, ('x'), 'ack', 10),\n            ])\n        self.assertRaises(ConfigurationConflictError, list, result)\n\nclass TestGlobalRegistriesIntegration(unittest.TestCase):\n    def setUp(self):\n        from pyramid.config import global_registries\n        global_registries.empty()\n\n    tearDown = setUp\n\n    def _makeConfigurator(self, *arg, **kw):\n        from pyramid.config import Configurator\n        config = Configurator(*arg, **kw)\n        return config\n\n    def test_global_registries_empty(self):\n        from pyramid.config import global_registries\n        self.assertEqual(global_registries.last, None)\n\n    def test_global_registries(self):\n        from pyramid.config import global_registries\n        config1 = self._makeConfigurator()\n        config1.make_wsgi_app()\n        self.assertEqual(global_registries.last, config1.registry)\n        config2 = self._makeConfigurator()\n        config2.make_wsgi_app()\n        self.assertEqual(global_registries.last, config2.registry)\n        self.assertEqual(list(global_registries),\n                         [config1.registry, config2.registry])\n        global_registries.remove(config2.registry)\n        self.assertEqual(global_registries.last, config1.registry)\n\nclass DummyRequest:\n    subpath = ()\n    matchdict = None\n    request_iface = IRequest\n    def __init__(self, environ=None):\n        if environ is None:\n            environ = {}\n        self.environ = environ\n        self.params = {}\n        self.cookies = {}\n\nclass DummyThreadLocalManager(object):\n    def __init__(self):\n        self.pushed = {'registry': None, 'request': None}\n        self.popped = False\n    def push(self, d):\n        self.pushed = d\n    def get(self):\n        return self.pushed\n    def pop(self):\n        self.popped = True\n\nfrom zope.interface import implementer\n@implementer(IDummy)\nclass DummyEvent:\n    pass\n\nclass DummyRegistry(object):\n    def __init__(self, adaptation=None, util=None):\n        self.utilities = []\n        self.adapters = []\n        self.adaptation = adaptation\n        self.util = util\n    def subscribers(self, events, name):\n        self.events = events\n        return events\n    def registerUtility(self, *arg, **kw):\n        self.utilities.append((arg, kw))\n    def registerAdapter(self, *arg, **kw):\n        self.adapters.append((arg, kw))\n    def queryAdapter(self, *arg, **kw):\n        return self.adaptation\n    def queryUtility(self, *arg, **kw):\n        return self.util\n\nfrom zope.interface import Interface\nclass IOther(Interface):\n    pass\n\ndef _conflictFunctions(e):\n    conflicts = e._conflicts.values()\n    for conflict in conflicts:\n        for confinst in conflict:\n            yield confinst.function\n\nclass DummyActionState(object):\n    autocommit = False\n    info = ''\n    def __init__(self):\n        self.actions = []\n    def action(self, *arg, **kw):\n        self.actions.append((arg, kw))\n\nclass DummyIntrospectable(object):\n    def __init__(self):\n        self.registered = []\n    def register(self, introspector, action_info):\n        self.registered.append((introspector, action_info))\n        \nclass DummyPredicate(object):\n    pass\n",
            "new_file_content": "import unittest\n\nimport os\n\nfrom pyramid.compat import im_func\nfrom pyramid.testing import skip_on\n\nfrom pyramid.tests.test_config import dummy_tween_factory\nfrom pyramid.tests.test_config import dummy_include\nfrom pyramid.tests.test_config import dummy_extend\nfrom pyramid.tests.test_config import dummy_extend2\nfrom pyramid.tests.test_config import IDummy\nfrom pyramid.tests.test_config import DummyContext\n\nfrom pyramid.exceptions import ConfigurationExecutionError\nfrom pyramid.exceptions import ConfigurationConflictError\n\nfrom pyramid.interfaces import IRequest\n\nclass ConfiguratorTests(unittest.TestCase):\n    def _makeOne(self, *arg, **kw):\n        from pyramid.config import Configurator\n        config = Configurator(*arg, **kw)\n        return config\n\n    def _getViewCallable(self, config, ctx_iface=None, request_iface=None,\n                         name='', exception_view=False):\n        from zope.interface import Interface\n        from pyramid.interfaces import IRequest\n        from pyramid.interfaces import IView\n        from pyramid.interfaces import IViewClassifier\n        from pyramid.interfaces import IExceptionViewClassifier\n        if exception_view: # pragma: no cover\n            classifier = IExceptionViewClassifier\n        else:\n            classifier = IViewClassifier\n        if ctx_iface is None:\n            ctx_iface = Interface\n        if request_iface is None:\n            request_iface = IRequest\n        return config.registry.adapters.lookup(\n            (classifier, request_iface, ctx_iface), IView, name=name,\n            default=None)\n\n    def _registerEventListener(self, config, event_iface=None):\n        if event_iface is None: # pragma: no cover\n            from zope.interface import Interface\n            event_iface = Interface\n        L = []\n        def subscriber(*event):\n            L.extend(event)\n        config.registry.registerHandler(subscriber, (event_iface,))\n        return L\n\n    def _makeRequest(self, config):\n        request = DummyRequest()\n        request.registry = config.registry\n        return request\n\n    def test_ctor_no_registry(self):\n        import sys\n        from pyramid.interfaces import ISettings\n        from pyramid.config import Configurator\n        from pyramid.interfaces import IRendererFactory\n        config = Configurator()\n        this_pkg = sys.modules['pyramid.tests.test_config']\n        self.assertTrue(config.registry.getUtility(ISettings))\n        self.assertEqual(config.package, this_pkg)\n        config.commit()\n        self.assertTrue(config.registry.getUtility(IRendererFactory, 'json'))\n        self.assertTrue(config.registry.getUtility(IRendererFactory, 'string'))\n\n    def test_begin(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        config.manager = manager\n        config.begin()\n        self.assertEqual(manager.pushed,\n                         {'registry':config.registry, 'request':None})\n        self.assertEqual(manager.popped, False)\n\n    def test_begin_with_request(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        request = object()\n        manager = DummyThreadLocalManager()\n        config.manager = manager\n        config.begin(request=request)\n        self.assertEqual(manager.pushed,\n                         {'registry':config.registry, 'request':request})\n        self.assertEqual(manager.popped, False)\n\n    def test_begin_overrides_request(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        req = object()\n        # set it up for auto-propagation\n        pushed = {'registry': config.registry, 'request': None}\n        manager.pushed = pushed\n        config.manager = manager\n        config.begin(req)\n        self.assertTrue(manager.pushed is not pushed)\n        self.assertEqual(manager.pushed['request'], req)\n        self.assertEqual(manager.pushed['registry'], config.registry)\n\n    def test_begin_propagates_request_for_same_registry(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        req = object()\n        pushed = {'registry': config.registry, 'request': req}\n        manager.pushed = pushed\n        config.manager = manager\n        config.begin()\n        self.assertTrue(manager.pushed is not pushed)\n        self.assertEqual(manager.pushed['request'], req)\n        self.assertEqual(manager.pushed['registry'], config.registry)\n\n    def test_begin_does_not_propagate_request_for_diff_registry(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        req = object()\n        pushed = {'registry': object(), 'request': req}\n        manager.pushed = pushed\n        config.manager = manager\n        config.begin()\n        self.assertTrue(manager.pushed is not pushed)\n        self.assertEqual(manager.pushed['request'], None)\n        self.assertEqual(manager.pushed['registry'], config.registry)\n\n    def test_end(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        pushed = manager.pushed\n        config.manager = manager\n        config.end()\n        self.assertEqual(manager.pushed, pushed)\n        self.assertEqual(manager.popped, True)\n\n    def test_ctor_with_package_registry(self):\n        import sys\n        from pyramid.config import Configurator\n        pkg = sys.modules['pyramid']\n        config = Configurator(package=pkg)\n        self.assertEqual(config.package, pkg)\n\n    def test_ctor_noreg_custom_settings(self):\n        from pyramid.interfaces import ISettings\n        settings = {'reload_templates':True,\n                    'mysetting':True}\n        config = self._makeOne(settings=settings)\n        settings = config.registry.getUtility(ISettings)\n        self.assertEqual(settings['reload_templates'], True)\n        self.assertEqual(settings['debug_authorization'], False)\n        self.assertEqual(settings['mysetting'], True)\n\n    def test_ctor_noreg_debug_logger_None_default(self):\n        from pyramid.interfaces import IDebugLogger\n        config = self._makeOne()\n        logger = config.registry.getUtility(IDebugLogger)\n        self.assertEqual(logger.name, 'pyramid.tests.test_config')\n\n    def test_ctor_noreg_debug_logger_non_None(self):\n        from pyramid.interfaces import IDebugLogger\n        logger = object()\n        config = self._makeOne(debug_logger=logger)\n        result = config.registry.getUtility(IDebugLogger)\n        self.assertEqual(logger, result)\n\n    def test_ctor_authentication_policy(self):\n        from pyramid.interfaces import IAuthenticationPolicy\n        policy = object()\n        config = self._makeOne(authentication_policy=policy)\n        config.commit()\n        result = config.registry.getUtility(IAuthenticationPolicy)\n        self.assertEqual(policy, result)\n\n    def test_ctor_authorization_policy_only(self):\n        policy = object()\n        config = self._makeOne(authorization_policy=policy)\n        self.assertRaises(ConfigurationExecutionError, config.commit)\n\n    def test_ctor_no_root_factory(self):\n        from pyramid.interfaces import IRootFactory\n        config = self._makeOne()\n        self.assertEqual(config.registry.queryUtility(IRootFactory), None)\n        config.commit()\n        self.assertEqual(config.registry.queryUtility(IRootFactory), None)\n\n    def test_ctor_with_root_factory(self):\n        from pyramid.interfaces import IRootFactory\n        factory = object()\n        config = self._makeOne(root_factory=factory)\n        self.assertEqual(config.registry.queryUtility(IRootFactory), None)\n        config.commit()\n        self.assertEqual(config.registry.queryUtility(IRootFactory), factory)\n\n    def test_ctor_alternate_renderers(self):\n        from pyramid.interfaces import IRendererFactory\n        renderer = object()\n        config = self._makeOne(renderers=[('yeah', renderer)])\n        config.commit()\n        self.assertEqual(config.registry.getUtility(IRendererFactory, 'yeah'),\n                         renderer)\n\n    def test_ctor_default_renderers(self):\n        from pyramid.interfaces import IRendererFactory\n        from pyramid.renderers import json_renderer_factory\n        config = self._makeOne()\n        self.assertEqual(config.registry.getUtility(IRendererFactory, 'json'),\n                         json_renderer_factory)\n\n    def test_ctor_default_permission(self):\n        from pyramid.interfaces import IDefaultPermission\n        config = self._makeOne(default_permission='view')\n        config.commit()\n        self.assertEqual(config.registry.getUtility(IDefaultPermission), 'view')\n\n    def test_ctor_session_factory(self):\n        from pyramid.interfaces import ISessionFactory\n        factory = object()\n        config = self._makeOne(session_factory=factory)\n        self.assertEqual(config.registry.queryUtility(ISessionFactory), None)\n        config.commit()\n        self.assertEqual(config.registry.getUtility(ISessionFactory), factory)\n\n    def test_ctor_default_view_mapper(self):\n        from pyramid.interfaces import IViewMapperFactory\n        mapper = object()\n        config = self._makeOne(default_view_mapper=mapper)\n        config.commit()\n        self.assertEqual(config.registry.getUtility(IViewMapperFactory),\n                         mapper)\n\n    def test_ctor_httpexception_view_default(self):\n        from pyramid.interfaces import IExceptionResponse\n        from pyramid.httpexceptions import default_exceptionresponse_view\n        from pyramid.interfaces import IRequest\n        config = self._makeOne()\n        view = self._getViewCallable(config,\n                                     ctx_iface=IExceptionResponse,\n                                     request_iface=IRequest)\n        self.assertTrue(view.__wraps__ is default_exceptionresponse_view)\n\n    def test_ctor_exceptionresponse_view_None(self):\n        from pyramid.interfaces import IExceptionResponse\n        from pyramid.interfaces import IRequest\n        config = self._makeOne(exceptionresponse_view=None)\n        view = self._getViewCallable(config,\n                                     ctx_iface=IExceptionResponse,\n                                     request_iface=IRequest)\n        self.assertTrue(view is None)\n\n    def test_ctor_exceptionresponse_view_custom(self):\n        from pyramid.interfaces import IExceptionResponse\n        from pyramid.interfaces import IRequest\n        def exceptionresponse_view(context, request): pass\n        config = self._makeOne(exceptionresponse_view=exceptionresponse_view)\n        view = self._getViewCallable(config,\n                                     ctx_iface=IExceptionResponse,\n                                     request_iface=IRequest)\n        self.assertTrue(view.__wraps__ is exceptionresponse_view)\n\n    def test_ctor_with_introspection(self):\n        config = self._makeOne(introspection=False)\n        self.assertEqual(config.introspection, False)\n\n    def test_ctor_default_webob_response_adapter_registered(self):\n        from webob import Response as WebobResponse\n        response = WebobResponse()\n        from pyramid.interfaces import IResponse\n        config = self._makeOne(autocommit=True)\n        result = config.registry.queryAdapter(response, IResponse)\n        self.assertEqual(result, response)\n        \n    def test_with_package_module(self):\n        from pyramid.tests.test_config import test_init\n        import pyramid.tests\n        config = self._makeOne()\n        newconfig = config.with_package(test_init)\n        self.assertEqual(newconfig.package, pyramid.tests.test_config)\n\n    def test_with_package_package(self):\n        import pyramid.tests.test_config\n        config = self._makeOne()\n        newconfig = config.with_package(pyramid.tests.test_config)\n        self.assertEqual(newconfig.package, pyramid.tests.test_config)\n\n    def test_with_package(self):\n        import pyramid.tests\n        config = self._makeOne()\n        config.basepath = 'basepath'\n        config.info = 'info'\n        config.includepath = ('spec',)\n        config.autocommit = True\n        config.route_prefix = 'prefix'\n        newconfig = config.with_package(pyramid.tests)\n        self.assertEqual(newconfig.package, pyramid.tests)\n        self.assertEqual(newconfig.registry, config.registry)\n        self.assertEqual(newconfig.autocommit, True)\n        self.assertEqual(newconfig.route_prefix, 'prefix')\n        self.assertEqual(newconfig.info, 'info')\n        self.assertEqual(newconfig.basepath, 'basepath')\n        self.assertEqual(newconfig.includepath, ('spec',))\n\n    def test_maybe_dotted_string_success(self):\n        import pyramid.tests.test_config\n        config = self._makeOne()\n        result = config.maybe_dotted('pyramid.tests.test_config')\n        self.assertEqual(result, pyramid.tests.test_config)\n\n    def test_maybe_dotted_string_fail(self):\n        config = self._makeOne()\n        self.assertRaises(ImportError, config.maybe_dotted, 'cant.be.found')\n\n    def test_maybe_dotted_notstring_success(self):\n        import pyramid.tests.test_config\n        config = self._makeOne()\n        result = config.maybe_dotted(pyramid.tests.test_config)\n        self.assertEqual(result, pyramid.tests.test_config)\n\n    def test_absolute_asset_spec_already_absolute(self):\n        import pyramid.tests.test_config\n        config = self._makeOne(package=pyramid.tests.test_config)\n        result = config.absolute_asset_spec('already:absolute')\n        self.assertEqual(result, 'already:absolute')\n\n    def test_absolute_asset_spec_notastring(self):\n        import pyramid.tests.test_config\n        config = self._makeOne(package=pyramid.tests.test_config)\n        result = config.absolute_asset_spec(None)\n        self.assertEqual(result, None)\n\n    def test_absolute_asset_spec_relative(self):\n        import pyramid.tests.test_config\n        config = self._makeOne(package=pyramid.tests.test_config)\n        result = config.absolute_asset_spec('files')\n        self.assertEqual(result, 'pyramid.tests.test_config:files')\n\n    def test__fix_registry_has_listeners(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config._fix_registry()\n        self.assertEqual(reg.has_listeners, True)\n\n    def test__fix_registry_notify(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config._fix_registry()\n        self.assertEqual(reg.notify(1), None)\n        self.assertEqual(reg.events, (1,))\n\n    def test__fix_registry_queryAdapterOrSelf(self):\n        from zope.interface import Interface\n        from zope.interface import implementer\n        class IFoo(Interface):\n            pass\n        @implementer(IFoo)\n        class Foo(object):\n            pass\n        class Bar(object):\n            pass\n        adaptation = ()\n        foo = Foo()\n        bar = Bar()\n        reg = DummyRegistry(adaptation)\n        config = self._makeOne(reg)\n        config._fix_registry()\n        self.assertTrue(reg.queryAdapterOrSelf(foo, IFoo) is foo)\n        self.assertTrue(reg.queryAdapterOrSelf(bar, IFoo) is adaptation)\n\n    def test__fix_registry_registerSelfAdapter(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config._fix_registry()\n        reg.registerSelfAdapter('required', 'provided', name='abc')\n        self.assertEqual(len(reg.adapters), 1)\n        args, kw = reg.adapters[0]\n        self.assertEqual(args[0]('abc'), 'abc')\n        self.assertEqual(kw,\n                         {'info': '', 'provided': 'provided',\n                          'required': 'required', 'name': 'abc', 'event': True})\n\n    def test__fix_registry_adds__lock(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config._fix_registry()\n        self.assertTrue(hasattr(reg, '_lock'))\n\n    def test__fix_registry_adds_clear_view_lookup_cache(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        self.assertFalse(hasattr(reg, '_clear_view_lookup_cache'))\n        config._fix_registry()\n        self.assertFalse(hasattr(reg, '_view_lookup_cache'))\n        reg._clear_view_lookup_cache()\n        self.assertEqual(reg._view_lookup_cache, {})\n\n    def test_setup_registry_calls_fix_registry(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config.add_view = lambda *arg, **kw: False\n        config._add_tween = lambda *arg, **kw: False\n        config.setup_registry()\n        self.assertEqual(reg.has_listeners, True)\n\n    def test_setup_registry_registers_default_exceptionresponse_views(self):\n        from webob.exc import WSGIHTTPException\n        from pyramid.interfaces import IExceptionResponse\n        from pyramid.view import default_exceptionresponse_view\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        views = []\n        config.add_view = lambda *arg, **kw: views.append((arg, kw))\n        config.add_default_view_predicates = lambda *arg: None\n        config._add_tween = lambda *arg, **kw: False\n        config.setup_registry()\n        self.assertEqual(views[0], ((default_exceptionresponse_view,),\n                                    {'context':IExceptionResponse}))\n        self.assertEqual(views[1], ((default_exceptionresponse_view,),\n                                    {'context':WSGIHTTPException}))\n\n    def test_setup_registry_registers_default_view_predicates(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        vp_called = []\n        config.add_view = lambda *arg, **kw: None\n        config.add_default_view_predicates = lambda *arg: vp_called.append(True)\n        config._add_tween = lambda *arg, **kw: False\n        config.setup_registry()\n        self.assertTrue(vp_called)\n\n    def test_setup_registry_registers_default_webob_iresponse_adapter(self):\n        from webob import Response\n        from pyramid.interfaces import IResponse\n        config = self._makeOne()\n        config.setup_registry()\n        response = Response()\n        self.assertTrue(\n            config.registry.queryAdapter(response, IResponse) is response)\n\n    def test_setup_registry_explicit_notfound_trumps_iexceptionresponse(self):\n        from pyramid.renderers import null_renderer\n        from zope.interface import implementedBy\n        from pyramid.interfaces import IRequest\n        from pyramid.httpexceptions import HTTPNotFound\n        from pyramid.registry import Registry\n        reg = Registry()\n        config = self._makeOne(reg, autocommit=True)\n        config.setup_registry() # registers IExceptionResponse default view\n        def myview(context, request):\n            return 'OK'\n        config.add_view(myview, context=HTTPNotFound, renderer=null_renderer)\n        request = self._makeRequest(config)\n        view = self._getViewCallable(config,\n                                     ctx_iface=implementedBy(HTTPNotFound),\n                                     request_iface=IRequest)\n        result = view(None, request)\n        self.assertEqual(result, 'OK')\n\n    def test_setup_registry_custom_settings(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import ISettings\n        settings = {'reload_templates':True,\n                    'mysetting':True}\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(settings=settings)\n        settings = reg.getUtility(ISettings)\n        self.assertEqual(settings['reload_templates'], True)\n        self.assertEqual(settings['debug_authorization'], False)\n        self.assertEqual(settings['mysetting'], True)\n\n    def test_setup_registry_debug_logger_None_default(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDebugLogger\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry()\n        logger = reg.getUtility(IDebugLogger)\n        self.assertEqual(logger.name, 'pyramid.tests.test_config')\n\n    def test_setup_registry_debug_logger_non_None(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDebugLogger\n        logger = object()\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(debug_logger=logger)\n        result = reg.getUtility(IDebugLogger)\n        self.assertEqual(logger, result)\n\n    def test_setup_registry_debug_logger_name(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDebugLogger\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(debug_logger='foo')\n        result = reg.getUtility(IDebugLogger)\n        self.assertEqual(result.name, 'foo')\n\n    def test_setup_registry_authentication_policy(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IAuthenticationPolicy\n        policy = object()\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(authentication_policy=policy)\n        config.commit()\n        result = reg.getUtility(IAuthenticationPolicy)\n        self.assertEqual(policy, result)\n\n    def test_setup_registry_authentication_policy_dottedname(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IAuthenticationPolicy\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(authentication_policy='pyramid.tests.test_config')\n        config.commit()\n        result = reg.getUtility(IAuthenticationPolicy)\n        import pyramid.tests.test_config\n        self.assertEqual(result, pyramid.tests.test_config)\n\n    def test_setup_registry_authorization_policy_dottedname(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IAuthorizationPolicy\n        reg = Registry()\n        config = self._makeOne(reg)\n        dummy = object()\n        config.setup_registry(authentication_policy=dummy,\n                              authorization_policy='pyramid.tests.test_config')\n        config.commit()\n        result = reg.getUtility(IAuthorizationPolicy)\n        import pyramid.tests.test_config\n        self.assertEqual(result, pyramid.tests.test_config)\n\n    def test_setup_registry_authorization_policy_only(self):\n        from pyramid.registry import Registry\n        policy = object()\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(authorization_policy=policy)\n        config = self.assertRaises(ConfigurationExecutionError, config.commit)\n\n    def test_setup_registry_no_default_root_factory(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRootFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry()\n        config.commit()\n        self.assertEqual(reg.queryUtility(IRootFactory), None)\n\n    def test_setup_registry_dottedname_root_factory(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRootFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        import pyramid.tests.test_config\n        config.setup_registry(root_factory='pyramid.tests.test_config')\n        self.assertEqual(reg.queryUtility(IRootFactory), None)\n        config.commit()\n        self.assertEqual(reg.getUtility(IRootFactory),\n                         pyramid.tests.test_config)\n\n    def test_setup_registry_locale_negotiator_dottedname(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import ILocaleNegotiator\n        reg = Registry()\n        config = self._makeOne(reg)\n        import pyramid.tests.test_config\n        config.setup_registry(locale_negotiator='pyramid.tests.test_config')\n        self.assertEqual(reg.queryUtility(ILocaleNegotiator), None)\n        config.commit()\n        utility = reg.getUtility(ILocaleNegotiator)\n        self.assertEqual(utility, pyramid.tests.test_config)\n\n    def test_setup_registry_locale_negotiator(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import ILocaleNegotiator\n        reg = Registry()\n        config = self._makeOne(reg)\n        negotiator = object()\n        config.setup_registry(locale_negotiator=negotiator)\n        self.assertEqual(reg.queryUtility(ILocaleNegotiator), None)\n        config.commit()\n        utility = reg.getUtility(ILocaleNegotiator)\n        self.assertEqual(utility, negotiator)\n\n    def test_setup_registry_request_factory(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRequestFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        factory = object()\n        config.setup_registry(request_factory=factory)\n        self.assertEqual(reg.queryUtility(IRequestFactory), None)\n        config.commit()\n        utility = reg.getUtility(IRequestFactory)\n        self.assertEqual(utility, factory)\n\n    def test_setup_registry_response_factory(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IResponseFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        factory = lambda r: object()\n        config.setup_registry(response_factory=factory)\n        self.assertEqual(reg.queryUtility(IResponseFactory), None)\n        config.commit()\n        utility = reg.getUtility(IResponseFactory)\n        self.assertEqual(utility, factory)\n\n    def test_setup_registry_request_factory_dottedname(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRequestFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        import pyramid.tests.test_config\n        config.setup_registry(request_factory='pyramid.tests.test_config')\n        self.assertEqual(reg.queryUtility(IRequestFactory), None)\n        config.commit()\n        utility = reg.getUtility(IRequestFactory)\n        self.assertEqual(utility, pyramid.tests.test_config)\n\n    def test_setup_registry_alternate_renderers(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRendererFactory\n        renderer = object()\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(renderers=[('yeah', renderer)])\n        config.commit()\n        self.assertEqual(reg.getUtility(IRendererFactory, 'yeah'),\n                         renderer)\n\n    def test_setup_registry_default_permission(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDefaultPermission\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(default_permission='view')\n        config.commit()\n        self.assertEqual(reg.getUtility(IDefaultPermission), 'view')\n\n    def test_setup_registry_includes(self):\n        from pyramid.registry import Registry\n        reg = Registry()\n        config = self._makeOne(reg)\n        settings = {\n            'pyramid.includes':\n\"\"\"pyramid.tests.test_config.dummy_include\npyramid.tests.test_config.dummy_include2\"\"\",\n        }\n        config.setup_registry(settings=settings)\n        self.assertTrue(reg.included)\n        self.assertTrue(reg.also_included)\n\n    def test_setup_registry_includes_spaces(self):\n        from pyramid.registry import Registry\n        reg = Registry()\n        config = self._makeOne(reg)\n        settings = {\n            'pyramid.includes':\n\"\"\"pyramid.tests.test_config.dummy_include pyramid.tests.test_config.dummy_include2\"\"\",\n        }\n        config.setup_registry(settings=settings)\n        self.assertTrue(reg.included)\n        self.assertTrue(reg.also_included)\n\n    def test_setup_registry_tweens(self):\n        from pyramid.interfaces import ITweens\n        from pyramid.registry import Registry\n        reg = Registry()\n        config = self._makeOne(reg)\n        settings = {\n            'pyramid.tweens':\n                    'pyramid.tests.test_config.dummy_tween_factory'\n        }\n        config.setup_registry(settings=settings)\n        config.commit()\n        tweens = config.registry.getUtility(ITweens)\n        self.assertEqual(\n            tweens.explicit,\n            [('pyramid.tests.test_config.dummy_tween_factory',\n              dummy_tween_factory)])\n\n    def test_introspector_decorator(self):\n        inst = self._makeOne()\n        default = inst.introspector\n        self.assertTrue(hasattr(default, 'add'))\n        self.assertEqual(inst.introspector, inst.registry.introspector)\n        introspector = object()\n        inst.introspector = introspector\n        new = inst.introspector\n        self.assertTrue(new is introspector)\n        self.assertEqual(inst.introspector, inst.registry.introspector)\n        del inst.introspector\n        default = inst.introspector\n        self.assertFalse(default is new)\n        self.assertTrue(hasattr(default, 'add'))\n\n    def test_make_wsgi_app(self):\n        import pyramid.config\n        from pyramid.router import Router\n        from pyramid.interfaces import IApplicationCreated\n        manager = DummyThreadLocalManager()\n        config = self._makeOne()\n        subscriber = self._registerEventListener(config, IApplicationCreated)\n        config.manager = manager\n        app = config.make_wsgi_app()\n        self.assertEqual(app.__class__, Router)\n        self.assertEqual(manager.pushed['registry'], config.registry)\n        self.assertEqual(manager.pushed['request'], None)\n        self.assertTrue(manager.popped)\n        self.assertEqual(pyramid.config.global_registries.last, app.registry)\n        self.assertEqual(len(subscriber), 1)\n        self.assertTrue(IApplicationCreated.providedBy(subscriber[0]))\n        pyramid.config.global_registries.empty()\n\n    def test_include_with_dotted_name(self):\n        from pyramid.tests import test_config\n        config = self._makeOne()\n        config.include('pyramid.tests.test_config.dummy_include')\n        after = config.action_state\n        actions = after.actions\n        self.assertEqual(len(actions), 1)\n        action = after.actions[0]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_include_with_python_callable(self):\n        from pyramid.tests import test_config\n        config = self._makeOne()\n        config.include(dummy_include)\n        after = config.action_state\n        actions = after.actions\n        self.assertEqual(len(actions), 1)\n        action = actions[0]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_include_with_module_defaults_to_includeme(self):\n        from pyramid.tests import test_config\n        config = self._makeOne()\n        config.include('pyramid.tests.test_config')\n        after = config.action_state\n        actions = after.actions\n        self.assertEqual(len(actions), 1)\n        action = actions[0]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_include_with_module_defaults_to_includeme_missing(self):\n        from pyramid.exceptions import ConfigurationError\n        config = self._makeOne()\n        self.assertRaises(ConfigurationError, config.include, 'pyramid.tests')\n\n    def test_include_with_route_prefix(self):\n        root_config = self._makeOne(autocommit=True)\n        def dummy_subapp(config):\n            self.assertEqual(config.route_prefix, 'root')\n        root_config.include(dummy_subapp, route_prefix='root')\n\n    def test_include_with_nested_route_prefix(self):\n        root_config = self._makeOne(autocommit=True, route_prefix='root')\n        def dummy_subapp2(config):\n            self.assertEqual(config.route_prefix, 'root/nested')\n        def dummy_subapp3(config):\n            self.assertEqual(config.route_prefix, 'root/nested/nested2')\n            config.include(dummy_subapp4)\n        def dummy_subapp4(config):\n            self.assertEqual(config.route_prefix, 'root/nested/nested2')\n        def dummy_subapp(config):\n            self.assertEqual(config.route_prefix, 'root/nested')\n            config.include(dummy_subapp2)\n            config.include(dummy_subapp3, route_prefix='nested2')\n\n        root_config.include(dummy_subapp, route_prefix='nested')\n\n    def test_include_with_missing_source_file(self):\n        from pyramid.exceptions import ConfigurationError\n        import inspect\n        config = self._makeOne()\n        class DummyInspect(object):\n            def getmodule(self, c):\n                return inspect.getmodule(c)\n            def getsourcefile(self, c):\n                return None\n        config.inspect = DummyInspect()\n        try:\n            config.include('pyramid.tests.test_config.dummy_include')\n        except ConfigurationError as e:\n            self.assertEqual(\n                e.args[0], \n                \"No source file for module 'pyramid.tests.test_config' (.py \"\n                \"file must exist, refusing to use orphan .pyc or .pyo file).\")\n        else: # pragma: no cover\n            raise AssertionError\n\n    def test_include_constant_root_package(self):\n        from pyramid import tests\n        from pyramid.tests import test_config\n        config = self._makeOne(root_package=tests)\n        results = {}\n        def include(config):\n            results['package'] = config.package\n            results['root_package'] = config.root_package\n        config.include(include)\n        self.assertEqual(results['root_package'], tests)\n        self.assertEqual(results['package'], test_config)\n\n    def test_include_threadlocals_active(self):\n        from pyramid.tests import test_config\n        from pyramid.threadlocal import get_current_registry\n        stack = []\n        def include(config):\n            stack.append(get_current_registry())\n        config = self._makeOne()\n        config.include(include)\n        self.assertTrue(stack[0] is config.registry)\n\n    def test_action_branching_kw_is_None(self):\n        config = self._makeOne(autocommit=True)\n        self.assertEqual(config.action('discrim'), None)\n\n    def test_action_branching_kw_is_not_None(self):\n        config = self._makeOne(autocommit=True)\n        self.assertEqual(config.action('discrim', kw={'a':1}), None)\n\n    def test_action_autocommit_with_introspectables(self):\n        from pyramid.util import ActionInfo\n        config = self._makeOne(autocommit=True)\n        intr = DummyIntrospectable()\n        config.action('discrim', introspectables=(intr,))\n        self.assertEqual(len(intr.registered), 1)\n        self.assertEqual(intr.registered[0][0], config.introspector)\n        self.assertEqual(intr.registered[0][1].__class__, ActionInfo)\n\n    def test_action_autocommit_with_introspectables_introspection_off(self):\n        config = self._makeOne(autocommit=True)\n        config.introspection = False\n        intr = DummyIntrospectable()\n        config.action('discrim', introspectables=(intr,))\n        self.assertEqual(len(intr.registered), 0)\n        \n    def test_action_branching_nonautocommit_with_config_info(self):\n        config = self._makeOne(autocommit=False)\n        config.info = 'abc'\n        state = DummyActionState()\n        state.autocommit = False\n        config.action_state = state\n        config.action('discrim', kw={'a':1})\n        self.assertEqual(\n            state.actions,\n            [((),\n             {'args': (),\n             'callable': None,\n             'discriminator': 'discrim',\n             'includepath': (),\n             'info': 'abc',\n             'introspectables': (),\n             'kw': {'a': 1},\n             'order': 0})])\n\n    def test_action_branching_nonautocommit_without_config_info(self):\n        config = self._makeOne(autocommit=False)\n        config.info = ''\n        config._ainfo = ['z']\n        state = DummyActionState()\n        config.action_state = state\n        state.autocommit = False\n        config.action('discrim', kw={'a':1})\n        self.assertEqual(\n            state.actions,\n            [((),\n             {'args': (),\n             'callable': None,\n             'discriminator': 'discrim',\n             'includepath': (),\n             'info': 'z',\n             'introspectables': (),\n             'kw': {'a': 1},\n             'order': 0})])\n\n    def test_action_branching_nonautocommit_with_introspectables(self):\n        config = self._makeOne(autocommit=False)\n        config.info = ''\n        config._ainfo = []\n        state = DummyActionState()\n        config.action_state = state\n        state.autocommit = False\n        intr = DummyIntrospectable()\n        config.action('discrim', introspectables=(intr,))\n        self.assertEqual(\n            state.actions[0][1]['introspectables'], (intr,))\n\n    def test_action_nonautocommit_with_introspectables_introspection_off(self):\n        config = self._makeOne(autocommit=False)\n        config.info = ''\n        config._ainfo = []\n        config.introspection = False\n        state = DummyActionState()\n        config.action_state = state\n        state.autocommit = False\n        intr = DummyIntrospectable()\n        config.action('discrim', introspectables=(intr,))\n        self.assertEqual(\n            state.actions[0][1]['introspectables'], ())\n        \n    def test_scan_integration(self):\n        from zope.interface import alsoProvides\n        from pyramid.interfaces import IRequest\n        from pyramid.view import render_view_to_response\n        import pyramid.tests.test_config.pkgs.scannable as package\n        config = self._makeOne(autocommit=True)\n        config.scan(package)\n\n        ctx = DummyContext()\n        req = DummyRequest()\n        alsoProvides(req, IRequest)\n        req.registry = config.registry\n\n        req.method = 'GET'\n        result = render_view_to_response(ctx, req, '')\n        self.assertEqual(result, 'grokked')\n\n        req.method = 'POST'\n        result = render_view_to_response(ctx, req, '')\n        self.assertEqual(result, 'grokked_post')\n\n        result= render_view_to_response(ctx, req, 'grokked_class')\n        self.assertEqual(result, 'grokked_class')\n\n        result= render_view_to_response(ctx, req, 'grokked_instance')\n        self.assertEqual(result, 'grokked_instance')\n\n        result= render_view_to_response(ctx, req, 'oldstyle_grokked_class')\n        self.assertEqual(result, 'oldstyle_grokked_class')\n\n        req.method = 'GET'\n        result = render_view_to_response(ctx, req, 'another')\n        self.assertEqual(result, 'another_grokked')\n\n        req.method = 'POST'\n        result = render_view_to_response(ctx, req, 'another')\n        self.assertEqual(result, 'another_grokked_post')\n\n        result= render_view_to_response(ctx, req, 'another_grokked_class')\n        self.assertEqual(result, 'another_grokked_class')\n\n        result= render_view_to_response(ctx, req, 'another_grokked_instance')\n        self.assertEqual(result, 'another_grokked_instance')\n\n        result= render_view_to_response(ctx, req,\n                                        'another_oldstyle_grokked_class')\n        self.assertEqual(result, 'another_oldstyle_grokked_class')\n\n        result = render_view_to_response(ctx, req, 'stacked1')\n        self.assertEqual(result, 'stacked')\n\n        result = render_view_to_response(ctx, req, 'stacked2')\n        self.assertEqual(result, 'stacked')\n\n        result = render_view_to_response(ctx, req, 'another_stacked1')\n        self.assertEqual(result, 'another_stacked')\n\n        result = render_view_to_response(ctx, req, 'another_stacked2')\n        self.assertEqual(result, 'another_stacked')\n\n        result = render_view_to_response(ctx, req, 'stacked_class1')\n        self.assertEqual(result, 'stacked_class')\n\n        result = render_view_to_response(ctx, req, 'stacked_class2')\n        self.assertEqual(result, 'stacked_class')\n\n        result = render_view_to_response(ctx, req, 'another_stacked_class1')\n        self.assertEqual(result, 'another_stacked_class')\n\n        result = render_view_to_response(ctx, req, 'another_stacked_class2')\n        self.assertEqual(result, 'another_stacked_class')\n\n        # NB: on Jython, a class without an __init__ apparently accepts\n        # any number of arguments without raising a TypeError, so the next\n        # assertion may fail there.  We don't support Jython at the moment,\n        # this is just a note to a future self.\n\n        self.assertRaises(TypeError,\n                          render_view_to_response, ctx, req, 'basemethod')\n\n        result = render_view_to_response(ctx, req, 'method1')\n        self.assertEqual(result, 'method1')\n\n        result = render_view_to_response(ctx, req, 'method2')\n        self.assertEqual(result, 'method2')\n\n        result = render_view_to_response(ctx, req, 'stacked_method1')\n        self.assertEqual(result, 'stacked_method')\n\n        result = render_view_to_response(ctx, req, 'stacked_method2')\n        self.assertEqual(result, 'stacked_method')\n\n        result = render_view_to_response(ctx, req, 'subpackage_init')\n        self.assertEqual(result, 'subpackage_init')\n\n        result = render_view_to_response(ctx, req, 'subpackage_notinit')\n        self.assertEqual(result, 'subpackage_notinit')\n\n        result = render_view_to_response(ctx, req, 'subsubpackage_init')\n        self.assertEqual(result, 'subsubpackage_init')\n\n        result = render_view_to_response(ctx, req, 'pod_notinit')\n        self.assertEqual(result, None)\n\n    def test_scan_integration_with_ignore(self):\n        from zope.interface import alsoProvides\n        from pyramid.interfaces import IRequest\n        from pyramid.view import render_view_to_response\n        import pyramid.tests.test_config.pkgs.scannable as package\n        config = self._makeOne(autocommit=True)\n        config.scan(package, \n                    ignore='pyramid.tests.test_config.pkgs.scannable.another')\n\n        ctx = DummyContext()\n        req = DummyRequest()\n        alsoProvides(req, IRequest)\n        req.registry = config.registry\n\n        req.method = 'GET'\n        result = render_view_to_response(ctx, req, '')\n        self.assertEqual(result, 'grokked')\n\n        # ignored\n        v = render_view_to_response(ctx, req, 'another_stacked_class2')\n        self.assertEqual(v, None)\n        \n    def test_scan_integration_dottedname_package(self):\n        from zope.interface import alsoProvides\n        from pyramid.interfaces import IRequest\n        from pyramid.view import render_view_to_response\n        config = self._makeOne(autocommit=True)\n        config.scan('pyramid.tests.test_config.pkgs.scannable')\n\n        ctx = DummyContext()\n        req = DummyRequest()\n        alsoProvides(req, IRequest)\n        req.registry = config.registry\n\n        req.method = 'GET'\n        result = render_view_to_response(ctx, req, '')\n        self.assertEqual(result, 'grokked')\n\n    def test_scan_integration_with_extra_kw(self):\n        config = self._makeOne(autocommit=True)\n        config.scan('pyramid.tests.test_config.pkgs.scanextrakw', a=1)\n        self.assertEqual(config.a, 1)\n\n    def test_scan_integration_with_onerror(self):\n        # fancy sys.path manipulation here to appease \"setup.py test\" which\n        # fails miserably when it can't import something in the package\n        import sys\n        try:\n            here = os.path.dirname(__file__)\n            path = os.path.join(here, 'path')\n            sys.path.append(path)\n            config = self._makeOne(autocommit=True)\n            class FooException(Exception):\n                pass\n            def onerror(name):\n                raise FooException\n            self.assertRaises(FooException, config.scan, 'scanerror',\n                              onerror=onerror)\n        finally:\n            sys.path.remove(path)\n\n    def test_scan_integration_conflict(self):\n        from pyramid.tests.test_config.pkgs import selfscan\n        from pyramid.config import Configurator\n        c = Configurator()\n        c.scan(selfscan)\n        c.scan(selfscan)\n        try:\n            c.commit()\n        except ConfigurationConflictError as why:\n            def scanconflicts(e):\n                conflicts = e._conflicts.values()\n                for conflict in conflicts:\n                    for confinst in conflict:\n                        yield confinst.src\n            which = list(scanconflicts(why))\n            self.assertEqual(len(which), 4)\n            self.assertTrue(\"@view_config(renderer='string')\" in which)\n            self.assertTrue(\"@view_config(name='two', renderer='string')\" in\n                            which)\n\n    @skip_on('py3')\n    def test_hook_zca(self):\n        from zope.component import getSiteManager\n        def foo():\n            '123'\n        try:\n            config = self._makeOne()\n            config.hook_zca()\n            config.begin()\n            sm = getSiteManager()\n            self.assertEqual(sm, config.registry)\n        finally:\n            getSiteManager.reset()\n\n    @skip_on('py3')\n    def test_unhook_zca(self):\n        from zope.component import getSiteManager\n        def foo():\n            '123'\n        try:\n            getSiteManager.sethook(foo)\n            config = self._makeOne()\n            config.unhook_zca()\n            sm = getSiteManager()\n            self.assertNotEqual(sm, '123')\n        finally:\n            getSiteManager.reset()\n\n    def test_commit_conflict_simple(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        config.add_view(view1)\n        config.add_view(view2)\n        self.assertRaises(ConfigurationConflictError, config.commit)\n\n    def test_commit_conflict_resolved_with_include(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        def includeme(config):\n            config.add_view(view2)\n        config.add_view(view1)\n        config.include(includeme)\n        config.commit()\n        registeredview = self._getViewCallable(config)\n        self.assertEqual(registeredview.__name__, 'view1')\n\n    def test_commit_conflict_with_two_includes(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        def includeme1(config):\n            config.add_view(view1)\n        def includeme2(config):\n            config.add_view(view2)\n        config.include(includeme1)\n        config.include(includeme2)\n        try:\n            config.commit()\n        except ConfigurationConflictError as why:\n            c1, c2 = _conflictFunctions(why)\n            self.assertEqual(c1, 'includeme1')\n            self.assertEqual(c2, 'includeme2')\n        else: #pragma: no cover\n            raise AssertionError\n\n    def test_commit_conflict_resolved_with_two_includes_and_local(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        def view3(request): pass\n        def includeme1(config):\n            config.add_view(view1)\n        def includeme2(config):\n            config.add_view(view2)\n        config.include(includeme1)\n        config.include(includeme2)\n        config.add_view(view3)\n        config.commit()\n        registeredview = self._getViewCallable(config)\n        self.assertEqual(registeredview.__name__, 'view3')\n\n    def test_autocommit_no_conflicts(self):\n        from pyramid.renderers import null_renderer\n        config = self._makeOne(autocommit=True)\n        def view1(request): pass\n        def view2(request): pass\n        def view3(request): pass\n        config.add_view(view1, renderer=null_renderer)\n        config.add_view(view2, renderer=null_renderer)\n        config.add_view(view3, renderer=null_renderer)\n        config.commit()\n        registeredview = self._getViewCallable(config)\n        self.assertEqual(registeredview.__name__, 'view3')\n\n    def test_conflict_set_notfound_view(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        config.set_notfound_view(view1)\n        config.set_notfound_view(view2)\n        try:\n            config.commit()\n        except ConfigurationConflictError as why:\n            c1, c2 = _conflictFunctions(why)\n            self.assertEqual(c1, 'test_conflict_set_notfound_view')\n            self.assertEqual(c2, 'test_conflict_set_notfound_view')\n        else: # pragma: no cover\n            raise AssertionError\n\n    def test_conflict_set_forbidden_view(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        config.set_forbidden_view(view1)\n        config.set_forbidden_view(view2)\n        try:\n            config.commit()\n        except ConfigurationConflictError as why:\n            c1, c2 = _conflictFunctions(why)\n            self.assertEqual(c1, 'test_conflict_set_forbidden_view')\n            self.assertEqual(c2, 'test_conflict_set_forbidden_view')\n        else: # pragma: no cover\n            raise AssertionError\n\n    def test___getattr__missing_when_directives_exist(self):\n        config = self._makeOne()\n        directives = {}\n        config.registry._directives = directives\n        self.assertRaises(AttributeError, config.__getattr__, 'wontexist')\n\n    def test___getattr__missing_when_directives_dont_exist(self):\n        config = self._makeOne()\n        self.assertRaises(AttributeError, config.__getattr__, 'wontexist')\n\n    def test___getattr__matches(self):\n        config = self._makeOne()\n        def foo(config): pass\n        directives = {'foo':(foo, True)}\n        config.registry._directives = directives\n        foo_meth = config.foo\n        self.assertTrue(getattr(foo_meth, im_func).__docobj__ is foo)\n\n    def test___getattr__matches_no_action_wrap(self):\n        config = self._makeOne()\n        def foo(config): pass\n        directives = {'foo':(foo, False)}\n        config.registry._directives = directives\n        foo_meth = config.foo\n        self.assertTrue(getattr(foo_meth, im_func) is foo)\n\nclass TestConfigurator_add_directive(unittest.TestCase):\n\n    def setUp(self):\n        from pyramid.config import Configurator\n        self.config = Configurator()\n\n    def test_extend_with_dotted_name(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n            'dummy_extend', 'pyramid.tests.test_config.dummy_extend')\n        self.assertTrue(hasattr(config, 'dummy_extend'))\n        config.dummy_extend('discrim')\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_add_directive_with_partial(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n                'dummy_partial', 'pyramid.tests.test_config.dummy_partial')\n        self.assertTrue(hasattr(config, 'dummy_partial'))\n        config.dummy_partial()\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'partial')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_add_directive_with_custom_callable(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n                'dummy_callable', 'pyramid.tests.test_config.dummy_callable')\n        self.assertTrue(hasattr(config, 'dummy_callable'))\n        config.dummy_callable('discrim')\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_extend_with_python_callable(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n            'dummy_extend', dummy_extend)\n        self.assertTrue(hasattr(config, 'dummy_extend'))\n        config.dummy_extend('discrim')\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_extend_same_name_doesnt_conflict(self):\n        config = self.config\n        config.add_directive(\n            'dummy_extend', dummy_extend)\n        config.add_directive(\n            'dummy_extend', dummy_extend2)\n        self.assertTrue(hasattr(config, 'dummy_extend'))\n        config.dummy_extend('discrim')\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], config.registry)\n\n    def test_extend_action_method_successful(self):\n        config = self.config\n        config.add_directive(\n            'dummy_extend', dummy_extend)\n        config.dummy_extend('discrim')\n        config.dummy_extend('discrim')\n        self.assertRaises(ConfigurationConflictError, config.commit)\n\n    def test_directive_persists_across_configurator_creations(self):\n        config = self.config\n        config.add_directive('dummy_extend', dummy_extend)\n        config2 = config.with_package('pyramid.tests')\n        config2.dummy_extend('discrim')\n        after = config2.action_state\n        actions = after.actions\n        self.assertEqual(len(actions), 1)\n        action = actions[0]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], config2.package)\n\nclass TestConfigurator__add_predicate(unittest.TestCase):\n    def _makeOne(self):\n        from pyramid.config import Configurator\n        return Configurator()\n\n    def test_factory_as_object(self):\n        config = self._makeOne()\n\n        def _fakeAction(discriminator, callable=None, args=(), kw=None,\n                        order=0, introspectables=(), **extra):\n            self.assertEqual(len(introspectables), 1)\n            self.assertEqual(introspectables[0]['name'], 'testing')\n            self.assertEqual(introspectables[0]['factory'], DummyPredicate)\n\n        config.action = _fakeAction\n        config._add_predicate('route', 'testing', DummyPredicate)\n\n    def test_factory_as_dotted_name(self):\n        config = self._makeOne()\n\n        def _fakeAction(discriminator, callable=None, args=(),\n                        kw=None, order=0, introspectables=(), **extra):\n            self.assertEqual(len(introspectables), 1)\n            self.assertEqual(introspectables[0]['name'], 'testing')\n            self.assertEqual(introspectables[0]['factory'], DummyPredicate)\n\n        config.action = _fakeAction\n        config._add_predicate(\n            'route',\n            'testing',\n            'pyramid.tests.test_config.test_init.DummyPredicate'\n            )\n        \nclass TestActionState(unittest.TestCase):\n    def _makeOne(self):\n        from pyramid.config import ActionState\n        return ActionState()\n    \n    def test_it(self):\n        c = self._makeOne()\n        self.assertEqual(c.actions, [])\n\n    def test_action_simple(self):\n        from pyramid.tests.test_config import dummyfactory as f\n        c = self._makeOne()\n        c.actions = []\n        c.action(1, f, (1,), {'x':1})\n        self.assertEqual(\n            c.actions,\n            [{'args': (1,),\n             'callable': f,\n             'discriminator': 1,\n             'includepath': (),\n             'info': None,\n             'introspectables': (),\n             'kw': {'x': 1},\n             'order': 0}])\n        c.action(None)\n        self.assertEqual(\n            c.actions,\n            [{'args': (1,),\n             'callable': f,\n             'discriminator': 1,\n             'includepath': (),\n             'info': None,\n             'introspectables': (),\n             'kw': {'x': 1},\n             'order': 0},\n\n             {'args': (),\n             'callable': None,\n             'discriminator': None,\n             'includepath': (),\n             'info': None,\n             'introspectables': (),\n             'kw': {},\n             'order': 0},])\n\n    def test_action_with_includepath(self):\n        c = self._makeOne()\n        c.actions = []\n        c.action(None, includepath=('abc',))\n        self.assertEqual(\n            c.actions,\n            [{'args': (),\n             'callable': None,\n             'discriminator': None,\n             'includepath': ('abc',),\n             'info': None,\n             'introspectables': (),\n             'kw': {},\n             'order': 0}])\n\n    def test_action_with_info(self):\n        c = self._makeOne()\n        c.action(None, info='abc')\n        self.assertEqual(\n            c.actions,\n            [{'args': (),\n             'callable': None,\n             'discriminator': None,\n             'includepath': (),\n             'info': 'abc',\n             'introspectables': (),\n             'kw': {},\n             'order': 0}])\n\n    def test_action_with_includepath_and_info(self):\n        c = self._makeOne()\n        c.action(None, includepath=('spec',), info='bleh')\n        self.assertEqual(\n            c.actions,\n            [{'args': (),\n             'callable': None,\n             'discriminator': None,\n             'includepath': ('spec',),\n             'info': 'bleh',\n             'introspectables': (),\n             'kw': {},\n             'order': 0}])\n\n    def test_action_with_order(self):\n        c = self._makeOne()\n        c.actions = []\n        c.action(None, order=99999)\n        self.assertEqual(\n            c.actions,\n            [{'args': (),\n             'callable': None,\n             'discriminator': None,\n             'includepath': (),\n             'info': None,\n             'introspectables': (),\n             'kw': {},\n             'order': 99999}])\n\n    def test_action_with_introspectables(self):\n        c = self._makeOne()\n        c.actions = []\n        intr = DummyIntrospectable()\n        c.action(None, introspectables=(intr,))\n        self.assertEqual(\n            c.actions,\n            [{'args': (),\n             'callable': None,\n             'discriminator': None,\n             'includepath': (),\n             'info': None,\n             'introspectables': (intr,),\n             'kw': {},\n             'order': 0}])\n\n    def test_processSpec(self):\n        c = self._makeOne()\n        self.assertTrue(c.processSpec('spec'))\n        self.assertFalse(c.processSpec('spec'))\n\n    def test_execute_actions_tuples(self):\n        output = []\n        def f(*a, **k):\n            output.append((a, k))\n        c = self._makeOne()\n        c.actions = [\n            (1, f, (1,)),\n            (1, f, (11,), {}, ('x', )),\n            (2, f, (2,)),\n            (None, None),\n            ]\n        c.execute_actions()\n        self.assertEqual(output,  [((1,), {}), ((2,), {})])\n\n    def test_execute_actions_dicts(self):\n        output = []\n        def f(*a, **k):\n            output.append((a, k))\n        c = self._makeOne()\n        c.actions = [\n            {'discriminator':1, 'callable':f, 'args':(1,), 'kw':{},\n             'order':0, 'includepath':(), 'info':None,\n             'introspectables':()},\n            {'discriminator':1, 'callable':f, 'args':(11,), 'kw':{},\n             'includepath':('x',), 'order': 0, 'info':None,\n             'introspectables':()},\n            {'discriminator':2, 'callable':f, 'args':(2,), 'kw':{},\n             'order':0, 'includepath':(), 'info':None,\n             'introspectables':()},\n            {'discriminator':None, 'callable':None, 'args':(), 'kw':{},\n             'order':0, 'includepath':(), 'info':None,\n             'introspectables':()},\n            ]\n        c.execute_actions()\n        self.assertEqual(output,  [((1,), {}), ((2,), {})])\n\n    def test_execute_actions_with_introspectables(self):\n        output = []\n        def f(*a, **k):\n            output.append((a, k))\n        c = self._makeOne()\n        intr = DummyIntrospectable()\n        c.actions = [\n            {'discriminator':1, 'callable':f, 'args':(1,), 'kw':{},\n             'order':0, 'includepath':(), 'info':None,\n             'introspectables':(intr,)},\n            ]\n        introspector = object()\n        c.execute_actions(introspector=introspector)\n        self.assertEqual(output,  [((1,), {})])\n        self.assertEqual(intr.registered, [(introspector, None)])\n\n    def test_execute_actions_with_introspectable_no_callable(self):\n        c = self._makeOne()\n        intr = DummyIntrospectable()\n        c.actions = [\n            {'discriminator':1, 'callable':None, 'args':(1,), 'kw':{},\n             'order':0, 'includepath':(), 'info':None,\n             'introspectables':(intr,)},\n            ]\n        introspector = object()\n        c.execute_actions(introspector=introspector)\n        self.assertEqual(intr.registered, [(introspector, None)])\n\n    def test_execute_actions_error(self):\n        output = []\n        def f(*a, **k):\n            output.append(('f', a, k))\n        def bad():\n            raise NotImplementedError\n        c = self._makeOne()\n        c.actions = [\n            (1, f, (1,)),\n            (1, f, (11,), {}, ('x', )),\n            (2, f, (2,)),\n            (3, bad, (), {}, (), 'oops')\n            ]\n        self.assertRaises(ConfigurationExecutionError, c.execute_actions)\n        self.assertEqual(output, [('f', (1,), {}), ('f', (2,), {})])\n\n    def test_reentrant_action(self):\n        output = []\n        c = self._makeOne()\n        def f(*a, **k):\n            output.append(('f', a, k))\n            c.actions.append((3, g, (8,), {}))\n        def g(*a, **k):\n            output.append(('g', a, k))\n        c.actions = [\n            (1, f, (1,)),\n        ]\n        c.execute_actions()\n        self.assertEqual(output, [('f', (1,), {}), ('g', (8,), {})])\n\n    def test_reentrant_action_with_deferred_discriminator(self):\n        # see https://github.com/Pylons/pyramid/issues/2697\n        from pyramid.registry import Deferred\n        output = []\n        c = self._makeOne()\n        def f(*a, **k):\n            output.append(('f', a, k))\n            c.actions.append((4, g, (4,), {}, (), None, 2))\n        def g(*a, **k):\n            output.append(('g', a, k))\n        def h(*a, **k):\n            output.append(('h', a, k))\n        def discrim():\n            self.assertEqual(output, [('f', (1,), {}), ('g', (2,), {})])\n            return 3\n        d = Deferred(discrim)\n        c.actions = [\n            (d, h, (3,), {}, (), None, 1), # order 1\n            (1, f, (1,)), # order 0\n            (2, g, (2,)), # order 0\n        ]\n        c.execute_actions()\n        self.assertEqual(output, [\n            ('f', (1,), {}), ('g', (2,), {}), ('h', (3,), {}), ('g', (4,), {})])\n\n    def test_reentrant_action_error(self):\n        from pyramid.exceptions import ConfigurationError\n        c = self._makeOne()\n        def f(*a, **k):\n            c.actions.append((3, g, (8,), {}, (), None, -1))\n        def g(*a, **k): pass\n        c.actions = [\n            (1, f, (1,)),\n        ]\n        self.assertRaises(ConfigurationError, c.execute_actions)\n\n    def test_reentrant_action_without_clear(self):\n        c = self._makeOne()\n        def f(*a, **k):\n            c.actions.append((3, g, (8,)))\n        def g(*a, **k): pass\n        c.actions = [\n            (1, f, (1,)),\n        ]\n        c.execute_actions(clear=False)\n        self.assertEqual(c.actions, [\n            (1, f, (1,)),\n            (3, g, (8,)),\n        ])\n\n    def test_executing_conflicting_action_across_orders(self):\n        from pyramid.exceptions import ConfigurationConflictError\n        c = self._makeOne()\n        def f(*a, **k): pass\n        def g(*a, **k): pass\n        c.actions = [\n            (1, f, (1,), {}, (), None, -1),\n            (1, g, (2,)),\n        ]\n        self.assertRaises(ConfigurationConflictError, c.execute_actions)\n\n    def test_executing_conflicting_action_across_reentrant_orders(self):\n        from pyramid.exceptions import ConfigurationConflictError\n        c = self._makeOne()\n        def f(*a, **k):\n            c.actions.append((1, g, (8,)))\n        def g(*a, **k): pass\n        c.actions = [\n            (1, f, (1,), {}, (), None, -1),\n        ]\n        self.assertRaises(ConfigurationConflictError, c.execute_actions)\n\nclass Test_reentrant_action_functional(unittest.TestCase):\n    def _makeConfigurator(self, *arg, **kw):\n        from pyramid.config import Configurator\n        config = Configurator(*arg, **kw)\n        return config\n\n    def test_functional(self):\n        def add_auto_route(config, name, view):\n               def register():\n                   config.add_view(route_name=name, view=view)\n                   config.add_route(name, '/' + name)\n               config.action(\n                   ('auto route', name), register, order=-30\n                   )\n        config = self._makeConfigurator()\n        config.add_directive('add_auto_route', add_auto_route)\n        def my_view(request): return request.response\n        config.add_auto_route('foo', my_view)\n        config.commit()\n        from pyramid.interfaces import IRoutesMapper\n        mapper = config.registry.getUtility(IRoutesMapper)\n        routes = mapper.get_routes()\n        route = routes[0]\n        self.assertEqual(len(routes), 1)\n        self.assertEqual(route.name, 'foo')\n        self.assertEqual(route.path, '/foo')\n\n    def test_deferred_discriminator(self):\n        # see https://github.com/Pylons/pyramid/issues/2697\n        from pyramid.config import PHASE0_CONFIG\n        config = self._makeConfigurator()\n        def deriver(view, info): return view\n        deriver.options = ('foo',)\n        config.add_view_deriver(deriver, 'foo_view')\n        # add_view uses a deferred discriminator and will fail if executed\n        # prior to add_view_deriver executing its action\n        config.add_view(lambda r: r.response, name='', foo=1)\n        def dummy_action():\n            # trigger a re-entrant action\n            config.action(None, lambda: None)\n        config.action(None, dummy_action, order=PHASE0_CONFIG)\n        config.commit()\n\nclass Test_resolveConflicts(unittest.TestCase):\n    def _callFUT(self, actions):\n        from pyramid.config import resolveConflicts\n        return resolveConflicts(actions)\n\n    def test_it_success_tuples(self):\n        from pyramid.tests.test_config import dummyfactory as f\n        result = self._callFUT([\n            (None, f),\n            (1, f, (1,), {}, (), 'first'),\n            (1, f, (2,), {}, ('x',), 'second'),\n            (1, f, (3,), {}, ('y',), 'third'),\n            (4, f, (4,), {}, ('y',), 'should be last', 99999),\n            (3, f, (3,), {}, ('y',)),\n            (None, f, (5,), {}, ('y',)),\n            ])\n        result = list(result)\n        self.assertEqual(\n            result,\n            [{'info': None,\n              'args': (),\n              'callable': f,\n              'introspectables': (),\n              'kw': {},\n              'discriminator': None,\n              'includepath': (),\n              'order': 0},\n\n              {'info': 'first',\n               'args': (1,),\n               'callable': f,\n               'introspectables': (),\n               'kw': {},\n               'discriminator': 1,\n               'includepath': (),\n               'order': 0},\n\n               {'info': None,\n                'args': (3,),\n                'callable': f,\n                'introspectables': (),\n                'kw': {},\n                'discriminator': 3,\n                'includepath': ('y',),\n                'order': 0},\n\n                {'info': None,\n                 'args': (5,),\n                 'callable': f,\n                 'introspectables': (),\n                 'kw': {},\n                 'discriminator': None,\n                 'includepath': ('y',),\n                 'order': 0},\n\n                 {'info': 'should be last',\n                  'args': (4,),\n                  'callable': f,\n                  'introspectables': (),\n                  'kw': {},\n                  'discriminator': 4,\n                  'includepath': ('y',),\n                  'order': 99999}\n                  ]\n                  )\n\n    def test_it_success_dicts(self):\n        from pyramid.tests.test_config import dummyfactory as f\n        result = self._callFUT([\n            (None, f),\n            (1, f, (1,), {}, (), 'first'),\n            (1, f, (2,), {}, ('x',), 'second'),\n            (1, f, (3,), {}, ('y',), 'third'),\n            (4, f, (4,), {}, ('y',), 'should be last', 99999),\n            (3, f, (3,), {}, ('y',)),\n            (None, f, (5,), {}, ('y',)),\n            ])\n        result = list(result)\n        self.assertEqual(\n            result,\n            [{'info': None,\n              'args': (),\n              'callable': f,\n              'introspectables': (),\n              'kw': {},\n              'discriminator': None,\n              'includepath': (),\n              'order': 0},\n\n              {'info': 'first',\n               'args': (1,),\n               'callable': f,\n               'introspectables': (),\n               'kw': {},\n               'discriminator': 1,\n               'includepath': (),\n               'order': 0},\n\n               {'info': None,\n                'args': (3,),\n                'callable': f,\n                'introspectables': (),\n                'kw': {},\n                'discriminator': 3,\n                'includepath': ('y',),\n                'order': 0},\n\n                {'info': None,\n                 'args': (5,),\n                 'callable': f,\n                 'introspectables': (),\n                 'kw': {},\n                 'discriminator': None,\n                 'includepath': ('y',),\n                 'order': 0},\n\n                 {'info': 'should be last',\n                  'args': (4,),\n                  'callable': f,\n                  'introspectables': (),\n                  'kw': {},\n                  'discriminator': 4,\n                  'includepath': ('y',),\n                  'order': 99999}\n                  ]\n                  )\n\n    def test_it_conflict(self):\n        from pyramid.tests.test_config import dummyfactory as f\n        result = self._callFUT([\n            (None, f),\n            (1, f, (2,), {}, ('x',), 'eek'),     # will conflict\n            (1, f, (3,), {}, ('y',), 'ack'),     # will conflict\n            (4, f, (4,), {}, ('y',)),\n            (3, f, (3,), {}, ('y',)),\n            (None, f, (5,), {}, ('y',)),\n            ])\n        self.assertRaises(ConfigurationConflictError, list, result)\n\n    def test_it_with_actions_grouped_by_order(self):\n        from pyramid.tests.test_config import dummyfactory as f\n        result = self._callFUT([\n            (None, f),                                 # X\n            (1, f, (1,), {}, (), 'third', 10),         # X\n            (1, f, (2,), {}, ('x',), 'fourth', 10),\n            (1, f, (3,), {}, ('y',), 'fifth', 10),\n            (2, f, (1,), {}, (), 'sixth', 10),         # X\n            (3, f, (1,), {}, (), 'seventh', 10),       # X\n            (5, f, (4,), {}, ('y',), 'eighth', 99999), # X\n            (4, f, (3,), {}, (), 'first', 5),          # X\n            (4, f, (5,), {}, ('y',), 'second', 5),\n            ])\n        result = list(result)\n        self.assertEqual(len(result), 6)\n        # resolved actions should be grouped by (order, i)\n        self.assertEqual(\n            result,\n            [{'info': None,\n              'args': (),\n              'callable': f,\n              'introspectables': (),\n              'kw': {},\n              'discriminator': None,\n              'includepath': (),\n              'order': 0},\n\n              {'info': 'first',\n               'args': (3,),\n               'callable': f,\n               'introspectables': (),\n               'kw': {},\n               'discriminator': 4,\n               'includepath': (),\n               'order': 5},\n\n               {'info': 'third',\n                'args': (1,),\n                'callable': f,\n                'introspectables': (),\n                'kw': {},\n                'discriminator': 1,\n                'includepath': (),\n                'order': 10},\n\n               {'info': 'sixth',\n                'args': (1,),\n                'callable': f,\n                'introspectables': (),\n                'kw': {},\n                'discriminator': 2,\n                'includepath': (),\n                'order': 10},\n\n               {'info': 'seventh',\n                'args': (1,),\n                'callable': f,\n                'introspectables': (),\n                'kw': {},\n                'discriminator': 3,\n                'includepath': (),\n                'order': 10},\n\n                 {'info': 'eighth',\n                  'args': (4,),\n                  'callable': f,\n                  'introspectables': (),\n                  'kw': {},\n                  'discriminator': 5,\n                  'includepath': ('y',),\n                  'order': 99999}\n                  ]\n                  )\n\n    def test_override_success_across_orders(self):\n        from pyramid.tests.test_config import dummyfactory as f\n        result = self._callFUT([\n            (1, f, (2,), {}, ('x',), 'eek', 0),\n            (1, f, (3,), {}, ('x', 'y'), 'ack', 10),\n            ])\n        result = list(result)\n        self.assertEqual(result, [\n            {'info': 'eek',\n            'args': (2,),\n            'callable': f,\n            'introspectables': (),\n            'kw': {},\n            'discriminator': 1,\n            'includepath': ('x',),\n            'order': 0},\n        ])\n\n    def test_conflicts_across_orders(self):\n        from pyramid.tests.test_config import dummyfactory as f\n        result = self._callFUT([\n            (1, f, (2,), {}, ('x', 'y'), 'eek', 0),\n            (1, f, (3,), {}, ('x'), 'ack', 10),\n            ])\n        self.assertRaises(ConfigurationConflictError, list, result)\n\nclass TestGlobalRegistriesIntegration(unittest.TestCase):\n    def setUp(self):\n        from pyramid.config import global_registries\n        global_registries.empty()\n\n    tearDown = setUp\n\n    def _makeConfigurator(self, *arg, **kw):\n        from pyramid.config import Configurator\n        config = Configurator(*arg, **kw)\n        return config\n\n    def test_global_registries_empty(self):\n        from pyramid.config import global_registries\n        self.assertEqual(global_registries.last, None)\n\n    def test_global_registries(self):\n        from pyramid.config import global_registries\n        config1 = self._makeConfigurator()\n        config1.make_wsgi_app()\n        self.assertEqual(global_registries.last, config1.registry)\n        config2 = self._makeConfigurator()\n        config2.make_wsgi_app()\n        self.assertEqual(global_registries.last, config2.registry)\n        self.assertEqual(list(global_registries),\n                         [config1.registry, config2.registry])\n        global_registries.remove(config2.registry)\n        self.assertEqual(global_registries.last, config1.registry)\n\nclass DummyRequest:\n    subpath = ()\n    matchdict = None\n    request_iface = IRequest\n    def __init__(self, environ=None):\n        if environ is None:\n            environ = {}\n        self.environ = environ\n        self.params = {}\n        self.cookies = {}\n\nclass DummyThreadLocalManager(object):\n    def __init__(self):\n        self.pushed = {'registry': None, 'request': None}\n        self.popped = False\n    def push(self, d):\n        self.pushed = d\n    def get(self):\n        return self.pushed\n    def pop(self):\n        self.popped = True\n\nfrom zope.interface import implementer\n@implementer(IDummy)\nclass DummyEvent:\n    pass\n\nclass DummyRegistry(object):\n    def __init__(self, adaptation=None, util=None):\n        self.utilities = []\n        self.adapters = []\n        self.adaptation = adaptation\n        self.util = util\n    def subscribers(self, events, name):\n        self.events = events\n        return events\n    def registerUtility(self, *arg, **kw):\n        self.utilities.append((arg, kw))\n    def registerAdapter(self, *arg, **kw):\n        self.adapters.append((arg, kw))\n    def queryAdapter(self, *arg, **kw):\n        return self.adaptation\n    def queryUtility(self, *arg, **kw):\n        return self.util\n\nfrom zope.interface import Interface\nclass IOther(Interface):\n    pass\n\ndef _conflictFunctions(e):\n    conflicts = e._conflicts.values()\n    for conflict in conflicts:\n        for confinst in conflict:\n            yield confinst.function\n\nclass DummyActionState(object):\n    autocommit = False\n    info = ''\n    def __init__(self):\n        self.actions = []\n    def action(self, *arg, **kw):\n        self.actions.append((arg, kw))\n\nclass DummyIntrospectable(object):\n    def __init__(self):\n        self.registered = []\n    def register(self, introspector, action_info):\n        self.registered.append((introspector, action_info))\n        \nclass DummyPredicate(object):\n    pass\n",
            "header": {
                "file": {
                    "path": "pyramid/tests/test_config/test_init.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "0d5413d16",
                "new_commit_hash": "53c601537",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/pyramid/tests/test_config/test_init.py"
            },
            "plus_file": {
                "path": "b/pyramid/tests/test_config/test_init.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 817,
                            "length": 6
                        },
                        "new_range": {
                            "start": 817,
                            "length": 16
                        },
                        "section": "pyramid.tests.test_config.dummy_include2\"\"\","
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        self.assertEqual(results['root_package'], tests)",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual(results['package'], test_config)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def test_include_threadlocals_active(self):",
                                "type": "added"
                            },
                            {
                                "content": "        from pyramid.tests import test_config",
                                "type": "added"
                            },
                            {
                                "content": "        from pyramid.threadlocal import get_current_registry",
                                "type": "added"
                            },
                            {
                                "content": "        stack = []",
                                "type": "added"
                            },
                            {
                                "content": "        def include(config):",
                                "type": "added"
                            },
                            {
                                "content": "            stack.append(get_current_registry())",
                                "type": "added"
                            },
                            {
                                "content": "        config = self._makeOne()",
                                "type": "added"
                            },
                            {
                                "content": "        config.include(include)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertTrue(stack[0] is config.registry)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    def test_action_branching_kw_is_None(self):",
                                "type": "context"
                            },
                            {
                                "content": "        config = self._makeOne(autocommit=True)",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual(config.action('discrim'), None)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "pyramid/tests/test_config/test_init.py",
                            "type": "class",
                            "name": "ConfiguratorTests",
                            "content": "class ConfiguratorTests(unittest.TestCase):\n    def _makeOne(self, *arg, **kw):\n        from pyramid.config import Configurator\n        config = Configurator(*arg, **kw)\n        return config\n\n    def _getViewCallable(self, config, ctx_iface=None, request_iface=None,\n                         name='', exception_view=False):\n        from zope.interface import Interface\n        from pyramid.interfaces import IRequest\n        from pyramid.interfaces import IView\n        from pyramid.interfaces import IViewClassifier\n        from pyramid.interfaces import IExceptionViewClassifier\n        if exception_view: # pragma: no cover\n            classifier = IExceptionViewClassifier\n        else:\n            classifier = IViewClassifier\n        if ctx_iface is None:\n            ctx_iface = Interface\n        if request_iface is None:\n            request_iface = IRequest\n        return config.registry.adapters.lookup(\n            (classifier, request_iface, ctx_iface), IView, name=name,\n            default=None)\n\n    def _registerEventListener(self, config, event_iface=None):\n        if event_iface is None: # pragma: no cover\n            from zope.interface import Interface\n            event_iface = Interface\n        L = []\n        def subscriber(*event):\n            L.extend(event)\n        config.registry.registerHandler(subscriber, (event_iface,))\n        return L\n\n    def _makeRequest(self, config):\n        request = DummyRequest()\n        request.registry = config.registry\n        return request\n\n    def test_ctor_no_registry(self):\n        import sys\n        from pyramid.interfaces import ISettings\n        from pyramid.config import Configurator\n        from pyramid.interfaces import IRendererFactory\n        config = Configurator()\n        this_pkg = sys.modules['pyramid.tests.test_config']\n        self.assertTrue(config.registry.getUtility(ISettings))\n        self.assertEqual(config.package, this_pkg)\n        config.commit()\n        self.assertTrue(config.registry.getUtility(IRendererFactory, 'json'))\n        self.assertTrue(config.registry.getUtility(IRendererFactory, 'string'))\n\n    def test_begin(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        config.manager = manager\n        config.begin()\n        self.assertEqual(manager.pushed,\n                         {'registry':config.registry, 'request':None})\n        self.assertEqual(manager.popped, False)\n\n    def test_begin_with_request(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        request = object()\n        manager = DummyThreadLocalManager()\n        config.manager = manager\n        config.begin(request=request)\n        self.assertEqual(manager.pushed,\n                         {'registry':config.registry, 'request':request})\n        self.assertEqual(manager.popped, False)\n\n    def test_begin_overrides_request(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        req = object()\n        # set it up for auto-propagation\n        pushed = {'registry': config.registry, 'request': None}\n        manager.pushed = pushed\n        config.manager = manager\n        config.begin(req)\n        self.assertTrue(manager.pushed is not pushed)\n        self.assertEqual(manager.pushed['request'], req)\n        self.assertEqual(manager.pushed['registry'], config.registry)\n\n    def test_begin_propagates_request_for_same_registry(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        req = object()\n        pushed = {'registry': config.registry, 'request': req}\n        manager.pushed = pushed\n        config.manager = manager\n        config.begin()\n        self.assertTrue(manager.pushed is not pushed)\n        self.assertEqual(manager.pushed['request'], req)\n        self.assertEqual(manager.pushed['registry'], config.registry)\n\n    def test_begin_does_not_propagate_request_for_diff_registry(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        req = object()\n        pushed = {'registry': object(), 'request': req}\n        manager.pushed = pushed\n        config.manager = manager\n        config.begin()\n        self.assertTrue(manager.pushed is not pushed)\n        self.assertEqual(manager.pushed['request'], None)\n        self.assertEqual(manager.pushed['registry'], config.registry)\n\n    def test_end(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        pushed = manager.pushed\n        config.manager = manager\n        config.end()\n        self.assertEqual(manager.pushed, pushed)\n        self.assertEqual(manager.popped, True)\n\n    def test_ctor_with_package_registry(self):\n        import sys\n        from pyramid.config import Configurator\n        pkg = sys.modules['pyramid']\n        config = Configurator(package=pkg)\n        self.assertEqual(config.package, pkg)\n\n    def test_ctor_noreg_custom_settings(self):\n        from pyramid.interfaces import ISettings\n        settings = {'reload_templates':True,\n                    'mysetting':True}\n        config = self._makeOne(settings=settings)\n        settings = config.registry.getUtility(ISettings)\n        self.assertEqual(settings['reload_templates'], True)\n        self.assertEqual(settings['debug_authorization'], False)\n        self.assertEqual(settings['mysetting'], True)\n\n    def test_ctor_noreg_debug_logger_None_default(self):\n        from pyramid.interfaces import IDebugLogger\n        config = self._makeOne()\n        logger = config.registry.getUtility(IDebugLogger)\n        self.assertEqual(logger.name, 'pyramid.tests.test_config')\n\n    def test_ctor_noreg_debug_logger_non_None(self):\n        from pyramid.interfaces import IDebugLogger\n        logger = object()\n        config = self._makeOne(debug_logger=logger)\n        result = config.registry.getUtility(IDebugLogger)\n        self.assertEqual(logger, result)\n\n    def test_ctor_authentication_policy(self):\n        from pyramid.interfaces import IAuthenticationPolicy\n        policy = object()\n        config = self._makeOne(authentication_policy=policy)\n        config.commit()\n        result = config.registry.getUtility(IAuthenticationPolicy)\n        self.assertEqual(policy, result)\n\n    def test_ctor_authorization_policy_only(self):\n        policy = object()\n        config = self._makeOne(authorization_policy=policy)\n        self.assertRaises(ConfigurationExecutionError, config.commit)\n\n    def test_ctor_no_root_factory(self):\n        from pyramid.interfaces import IRootFactory\n        config = self._makeOne()\n        self.assertEqual(config.registry.queryUtility(IRootFactory), None)\n        config.commit()\n        self.assertEqual(config.registry.queryUtility(IRootFactory), None)\n\n    def test_ctor_with_root_factory(self):\n        from pyramid.interfaces import IRootFactory\n        factory = object()\n        config = self._makeOne(root_factory=factory)\n        self.assertEqual(config.registry.queryUtility(IRootFactory), None)\n        config.commit()\n        self.assertEqual(config.registry.queryUtility(IRootFactory), factory)\n\n    def test_ctor_alternate_renderers(self):\n        from pyramid.interfaces import IRendererFactory\n        renderer = object()\n        config = self._makeOne(renderers=[('yeah', renderer)])\n        config.commit()\n        self.assertEqual(config.registry.getUtility(IRendererFactory, 'yeah'),\n                         renderer)\n\n    def test_ctor_default_renderers(self):\n        from pyramid.interfaces import IRendererFactory\n        from pyramid.renderers import json_renderer_factory\n        config = self._makeOne()\n        self.assertEqual(config.registry.getUtility(IRendererFactory, 'json'),\n                         json_renderer_factory)\n\n    def test_ctor_default_permission(self):\n        from pyramid.interfaces import IDefaultPermission\n        config = self._makeOne(default_permission='view')\n        config.commit()\n        self.assertEqual(config.registry.getUtility(IDefaultPermission), 'view')\n\n    def test_ctor_session_factory(self):\n        from pyramid.interfaces import ISessionFactory\n        factory = object()\n        config = self._makeOne(session_factory=factory)\n        self.assertEqual(config.registry.queryUtility(ISessionFactory), None)\n        config.commit()\n        self.assertEqual(config.registry.getUtility(ISessionFactory), factory)\n\n    def test_ctor_default_view_mapper(self):\n        from pyramid.interfaces import IViewMapperFactory\n        mapper = object()\n        config = self._makeOne(default_view_mapper=mapper)\n        config.commit()\n        self.assertEqual(config.registry.getUtility(IViewMapperFactory),\n                         mapper)\n\n    def test_ctor_httpexception_view_default(self):\n        from pyramid.interfaces import IExceptionResponse\n        from pyramid.httpexceptions import default_exceptionresponse_view\n        from pyramid.interfaces import IRequest\n        config = self._makeOne()\n        view = self._getViewCallable(config,\n                                     ctx_iface=IExceptionResponse,\n                                     request_iface=IRequest)\n        self.assertTrue(view.__wraps__ is default_exceptionresponse_view)\n\n    def test_ctor_exceptionresponse_view_None(self):\n        from pyramid.interfaces import IExceptionResponse\n        from pyramid.interfaces import IRequest\n        config = self._makeOne(exceptionresponse_view=None)\n        view = self._getViewCallable(config,\n                                     ctx_iface=IExceptionResponse,\n                                     request_iface=IRequest)\n        self.assertTrue(view is None)\n\n    def test_ctor_exceptionresponse_view_custom(self):\n        from pyramid.interfaces import IExceptionResponse\n        from pyramid.interfaces import IRequest\n        def exceptionresponse_view(context, request): pass\n        config = self._makeOne(exceptionresponse_view=exceptionresponse_view)\n        view = self._getViewCallable(config,\n                                     ctx_iface=IExceptionResponse,\n                                     request_iface=IRequest)\n        self.assertTrue(view.__wraps__ is exceptionresponse_view)\n\n    def test_ctor_with_introspection(self):\n        config = self._makeOne(introspection=False)\n        self.assertEqual(config.introspection, False)\n\n    def test_ctor_default_webob_response_adapter_registered(self):\n        from webob import Response as WebobResponse\n        response = WebobResponse()\n        from pyramid.interfaces import IResponse\n        config = self._makeOne(autocommit=True)\n        result = config.registry.queryAdapter(response, IResponse)\n        self.assertEqual(result, response)\n        \n    def test_with_package_module(self):\n        from pyramid.tests.test_config import test_init\n        import pyramid.tests\n        config = self._makeOne()\n        newconfig = config.with_package(test_init)\n        self.assertEqual(newconfig.package, pyramid.tests.test_config)\n\n    def test_with_package_package(self):\n        import pyramid.tests.test_config\n        config = self._makeOne()\n        newconfig = config.with_package(pyramid.tests.test_config)\n        self.assertEqual(newconfig.package, pyramid.tests.test_config)\n\n    def test_with_package(self):\n        import pyramid.tests\n        config = self._makeOne()\n        config.basepath = 'basepath'\n        config.info = 'info'\n        config.includepath = ('spec',)\n        config.autocommit = True\n        config.route_prefix = 'prefix'\n        newconfig = config.with_package(pyramid.tests)\n        self.assertEqual(newconfig.package, pyramid.tests)\n        self.assertEqual(newconfig.registry, config.registry)\n        self.assertEqual(newconfig.autocommit, True)\n        self.assertEqual(newconfig.route_prefix, 'prefix')\n        self.assertEqual(newconfig.info, 'info')\n        self.assertEqual(newconfig.basepath, 'basepath')\n        self.assertEqual(newconfig.includepath, ('spec',))\n\n    def test_maybe_dotted_string_success(self):\n        import pyramid.tests.test_config\n        config = self._makeOne()\n        result = config.maybe_dotted('pyramid.tests.test_config')\n        self.assertEqual(result, pyramid.tests.test_config)\n\n    def test_maybe_dotted_string_fail(self):\n        config = self._makeOne()\n        self.assertRaises(ImportError, config.maybe_dotted, 'cant.be.found')\n\n    def test_maybe_dotted_notstring_success(self):\n        import pyramid.tests.test_config\n        config = self._makeOne()\n        result = config.maybe_dotted(pyramid.tests.test_config)\n        self.assertEqual(result, pyramid.tests.test_config)\n\n    def test_absolute_asset_spec_already_absolute(self):\n        import pyramid.tests.test_config\n        config = self._makeOne(package=pyramid.tests.test_config)\n        result = config.absolute_asset_spec('already:absolute')\n        self.assertEqual(result, 'already:absolute')\n\n    def test_absolute_asset_spec_notastring(self):\n        import pyramid.tests.test_config\n        config = self._makeOne(package=pyramid.tests.test_config)\n        result = config.absolute_asset_spec(None)\n        self.assertEqual(result, None)\n\n    def test_absolute_asset_spec_relative(self):\n        import pyramid.tests.test_config\n        config = self._makeOne(package=pyramid.tests.test_config)\n        result = config.absolute_asset_spec('files')\n        self.assertEqual(result, 'pyramid.tests.test_config:files')\n\n    def test__fix_registry_has_listeners(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config._fix_registry()\n        self.assertEqual(reg.has_listeners, True)\n\n    def test__fix_registry_notify(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config._fix_registry()\n        self.assertEqual(reg.notify(1), None)\n        self.assertEqual(reg.events, (1,))\n\n    def test__fix_registry_queryAdapterOrSelf(self):\n        from zope.interface import Interface\n        from zope.interface import implementer\n        class IFoo(Interface):\n            pass\n        @implementer(IFoo)\n        class Foo(object):\n            pass\n        class Bar(object):\n            pass\n        adaptation = ()\n        foo = Foo()\n        bar = Bar()\n        reg = DummyRegistry(adaptation)\n        config = self._makeOne(reg)\n        config._fix_registry()\n        self.assertTrue(reg.queryAdapterOrSelf(foo, IFoo) is foo)\n        self.assertTrue(reg.queryAdapterOrSelf(bar, IFoo) is adaptation)\n\n    def test__fix_registry_registerSelfAdapter(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config._fix_registry()\n        reg.registerSelfAdapter('required', 'provided', name='abc')\n        self.assertEqual(len(reg.adapters), 1)\n        args, kw = reg.adapters[0]\n        self.assertEqual(args[0]('abc'), 'abc')\n        self.assertEqual(kw,\n                         {'info': '', 'provided': 'provided',\n                          'required': 'required', 'name': 'abc', 'event': True})\n\n    def test__fix_registry_adds__lock(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config._fix_registry()\n        self.assertTrue(hasattr(reg, '_lock'))\n\n    def test__fix_registry_adds_clear_view_lookup_cache(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        self.assertFalse(hasattr(reg, '_clear_view_lookup_cache'))\n        config._fix_registry()\n        self.assertFalse(hasattr(reg, '_view_lookup_cache'))\n        reg._clear_view_lookup_cache()\n        self.assertEqual(reg._view_lookup_cache, {})\n\n    def test_setup_registry_calls_fix_registry(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config.add_view = lambda *arg, **kw: False\n        config._add_tween = lambda *arg, **kw: False\n        config.setup_registry()\n        self.assertEqual(reg.has_listeners, True)\n\n    def test_setup_registry_registers_default_exceptionresponse_views(self):\n        from webob.exc import WSGIHTTPException\n        from pyramid.interfaces import IExceptionResponse\n        from pyramid.view import default_exceptionresponse_view\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        views = []\n        config.add_view = lambda *arg, **kw: views.append((arg, kw))\n        config.add_default_view_predicates = lambda *arg: None\n        config._add_tween = lambda *arg, **kw: False\n        config.setup_registry()\n        self.assertEqual(views[0], ((default_exceptionresponse_view,),\n                                    {'context':IExceptionResponse}))\n        self.assertEqual(views[1], ((default_exceptionresponse_view,),\n                                    {'context':WSGIHTTPException}))\n\n    def test_setup_registry_registers_default_view_predicates(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        vp_called = []\n        config.add_view = lambda *arg, **kw: None\n        config.add_default_view_predicates = lambda *arg: vp_called.append(True)\n        config._add_tween = lambda *arg, **kw: False\n        config.setup_registry()\n        self.assertTrue(vp_called)\n\n    def test_setup_registry_registers_default_webob_iresponse_adapter(self):\n        from webob import Response\n        from pyramid.interfaces import IResponse\n        config = self._makeOne()\n        config.setup_registry()\n        response = Response()\n        self.assertTrue(\n            config.registry.queryAdapter(response, IResponse) is response)\n\n    def test_setup_registry_explicit_notfound_trumps_iexceptionresponse(self):\n        from pyramid.renderers import null_renderer\n        from zope.interface import implementedBy\n        from pyramid.interfaces import IRequest\n        from pyramid.httpexceptions import HTTPNotFound\n        from pyramid.registry import Registry\n        reg = Registry()\n        config = self._makeOne(reg, autocommit=True)\n        config.setup_registry() # registers IExceptionResponse default view\n        def myview(context, request):\n            return 'OK'\n        config.add_view(myview, context=HTTPNotFound, renderer=null_renderer)\n        request = self._makeRequest(config)\n        view = self._getViewCallable(config,\n                                     ctx_iface=implementedBy(HTTPNotFound),\n                                     request_iface=IRequest)\n        result = view(None, request)\n        self.assertEqual(result, 'OK')\n\n    def test_setup_registry_custom_settings(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import ISettings\n        settings = {'reload_templates':True,\n                    'mysetting':True}\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(settings=settings)\n        settings = reg.getUtility(ISettings)\n        self.assertEqual(settings['reload_templates'], True)\n        self.assertEqual(settings['debug_authorization'], False)\n        self.assertEqual(settings['mysetting'], True)\n\n    def test_setup_registry_debug_logger_None_default(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDebugLogger\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry()\n        logger = reg.getUtility(IDebugLogger)\n        self.assertEqual(logger.name, 'pyramid.tests.test_config')\n\n    def test_setup_registry_debug_logger_non_None(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDebugLogger\n        logger = object()\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(debug_logger=logger)\n        result = reg.getUtility(IDebugLogger)\n        self.assertEqual(logger, result)\n\n    def test_setup_registry_debug_logger_name(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDebugLogger\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(debug_logger='foo')\n        result = reg.getUtility(IDebugLogger)\n        self.assertEqual(result.name, 'foo')\n\n    def test_setup_registry_authentication_policy(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IAuthenticationPolicy\n        policy = object()\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(authentication_policy=policy)\n        config.commit()\n        result = reg.getUtility(IAuthenticationPolicy)\n        self.assertEqual(policy, result)\n\n    def test_setup_registry_authentication_policy_dottedname(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IAuthenticationPolicy\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(authentication_policy='pyramid.tests.test_config')\n        config.commit()\n        result = reg.getUtility(IAuthenticationPolicy)\n        import pyramid.tests.test_config\n        self.assertEqual(result, pyramid.tests.test_config)\n\n    def test_setup_registry_authorization_policy_dottedname(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IAuthorizationPolicy\n        reg = Registry()\n        config = self._makeOne(reg)\n        dummy = object()\n        config.setup_registry(authentication_policy=dummy,\n                              authorization_policy='pyramid.tests.test_config')\n        config.commit()\n        result = reg.getUtility(IAuthorizationPolicy)\n        import pyramid.tests.test_config\n        self.assertEqual(result, pyramid.tests.test_config)\n\n    def test_setup_registry_authorization_policy_only(self):\n        from pyramid.registry import Registry\n        policy = object()\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(authorization_policy=policy)\n        config = self.assertRaises(ConfigurationExecutionError, config.commit)\n\n    def test_setup_registry_no_default_root_factory(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRootFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry()\n        config.commit()\n        self.assertEqual(reg.queryUtility(IRootFactory), None)\n\n    def test_setup_registry_dottedname_root_factory(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRootFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        import pyramid.tests.test_config\n        config.setup_registry(root_factory='pyramid.tests.test_config')\n        self.assertEqual(reg.queryUtility(IRootFactory), None)\n        config.commit()\n        self.assertEqual(reg.getUtility(IRootFactory),\n                         pyramid.tests.test_config)\n\n    def test_setup_registry_locale_negotiator_dottedname(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import ILocaleNegotiator\n        reg = Registry()\n        config = self._makeOne(reg)\n        import pyramid.tests.test_config\n        config.setup_registry(locale_negotiator='pyramid.tests.test_config')\n        self.assertEqual(reg.queryUtility(ILocaleNegotiator), None)\n        config.commit()\n        utility = reg.getUtility(ILocaleNegotiator)\n        self.assertEqual(utility, pyramid.tests.test_config)\n\n    def test_setup_registry_locale_negotiator(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import ILocaleNegotiator\n        reg = Registry()\n        config = self._makeOne(reg)\n        negotiator = object()\n        config.setup_registry(locale_negotiator=negotiator)\n        self.assertEqual(reg.queryUtility(ILocaleNegotiator), None)\n        config.commit()\n        utility = reg.getUtility(ILocaleNegotiator)\n        self.assertEqual(utility, negotiator)\n\n    def test_setup_registry_request_factory(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRequestFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        factory = object()\n        config.setup_registry(request_factory=factory)\n        self.assertEqual(reg.queryUtility(IRequestFactory), None)\n        config.commit()\n        utility = reg.getUtility(IRequestFactory)\n        self.assertEqual(utility, factory)\n\n    def test_setup_registry_response_factory(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IResponseFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        factory = lambda r: object()\n        config.setup_registry(response_factory=factory)\n        self.assertEqual(reg.queryUtility(IResponseFactory), None)\n        config.commit()\n        utility = reg.getUtility(IResponseFactory)\n        self.assertEqual(utility, factory)\n\n    def test_setup_registry_request_factory_dottedname(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRequestFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        import pyramid.tests.test_config\n        config.setup_registry(request_factory='pyramid.tests.test_config')\n        self.assertEqual(reg.queryUtility(IRequestFactory), None)\n        config.commit()\n        utility = reg.getUtility(IRequestFactory)\n        self.assertEqual(utility, pyramid.tests.test_config)\n\n    def test_setup_registry_alternate_renderers(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRendererFactory\n        renderer = object()\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(renderers=[('yeah', renderer)])\n        config.commit()\n        self.assertEqual(reg.getUtility(IRendererFactory, 'yeah'),\n                         renderer)\n\n    def test_setup_registry_default_permission(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDefaultPermission\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(default_permission='view')\n        config.commit()\n        self.assertEqual(reg.getUtility(IDefaultPermission), 'view')\n\n    def test_setup_registry_includes(self):\n        from pyramid.registry import Registry\n        reg = Registry()\n        config = self._makeOne(reg)\n        settings = {\n            'pyramid.includes':\n\"\"\"pyramid.tests.test_config.dummy_include\npyramid.tests.test_config.dummy_include2\"\"\",\n        }\n        config.setup_registry(settings=settings)\n        self.assertTrue(reg.included)\n        self.assertTrue(reg.also_included)\n\n    def test_setup_registry_includes_spaces(self):\n        from pyramid.registry import Registry\n        reg = Registry()\n        config = self._makeOne(reg)\n        settings = {\n            'pyramid.includes':\n\"\"\"pyramid.tests.test_config.dummy_include pyramid.tests.test_config.dummy_include2\"\"\",\n        }\n        config.setup_registry(settings=settings)\n        self.assertTrue(reg.included)\n        self.assertTrue(reg.also_included)\n\n    def test_setup_registry_tweens(self):\n        from pyramid.interfaces import ITweens\n        from pyramid.registry import Registry\n        reg = Registry()\n        config = self._makeOne(reg)\n        settings = {\n            'pyramid.tweens':\n                    'pyramid.tests.test_config.dummy_tween_factory'\n        }\n        config.setup_registry(settings=settings)\n        config.commit()\n        tweens = config.registry.getUtility(ITweens)\n        self.assertEqual(\n            tweens.explicit,\n            [('pyramid.tests.test_config.dummy_tween_factory',\n              dummy_tween_factory)])\n\n    def test_introspector_decorator(self):\n        inst = self._makeOne()\n        default = inst.introspector\n        self.assertTrue(hasattr(default, 'add'))\n        self.assertEqual(inst.introspector, inst.registry.introspector)\n        introspector = object()\n        inst.introspector = introspector\n        new = inst.introspector\n        self.assertTrue(new is introspector)\n        self.assertEqual(inst.introspector, inst.registry.introspector)\n        del inst.introspector\n        default = inst.introspector\n        self.assertFalse(default is new)\n        self.assertTrue(hasattr(default, 'add'))\n\n    def test_make_wsgi_app(self):\n        import pyramid.config\n        from pyramid.router import Router\n        from pyramid.interfaces import IApplicationCreated\n        manager = DummyThreadLocalManager()\n        config = self._makeOne()\n        subscriber = self._registerEventListener(config, IApplicationCreated)\n        config.manager = manager\n        app = config.make_wsgi_app()\n        self.assertEqual(app.__class__, Router)\n        self.assertEqual(manager.pushed['registry'], config.registry)\n        self.assertEqual(manager.pushed['request'], None)\n        self.assertTrue(manager.popped)\n        self.assertEqual(pyramid.config.global_registries.last, app.registry)\n        self.assertEqual(len(subscriber), 1)\n        self.assertTrue(IApplicationCreated.providedBy(subscriber[0]))\n        pyramid.config.global_registries.empty()\n\n    def test_include_with_dotted_name(self):\n        from pyramid.tests import test_config\n        config = self._makeOne()\n        config.include('pyramid.tests.test_config.dummy_include')\n        after = config.action_state\n        actions = after.actions\n        self.assertEqual(len(actions), 1)\n        action = after.actions[0]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_include_with_python_callable(self):\n        from pyramid.tests import test_config\n        config = self._makeOne()\n        config.include(dummy_include)\n        after = config.action_state\n        actions = after.actions\n        self.assertEqual(len(actions), 1)\n        action = actions[0]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_include_with_module_defaults_to_includeme(self):\n        from pyramid.tests import test_config\n        config = self._makeOne()\n        config.include('pyramid.tests.test_config')\n        after = config.action_state\n        actions = after.actions\n        self.assertEqual(len(actions), 1)\n        action = actions[0]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_include_with_module_defaults_to_includeme_missing(self):\n        from pyramid.exceptions import ConfigurationError\n        config = self._makeOne()\n        self.assertRaises(ConfigurationError, config.include, 'pyramid.tests')\n\n    def test_include_with_route_prefix(self):\n        root_config = self._makeOne(autocommit=True)\n        def dummy_subapp(config):\n            self.assertEqual(config.route_prefix, 'root')\n        root_config.include(dummy_subapp, route_prefix='root')\n\n    def test_include_with_nested_route_prefix(self):\n        root_config = self._makeOne(autocommit=True, route_prefix='root')\n        def dummy_subapp2(config):\n            self.assertEqual(config.route_prefix, 'root/nested')\n        def dummy_subapp3(config):\n            self.assertEqual(config.route_prefix, 'root/nested/nested2')\n            config.include(dummy_subapp4)\n        def dummy_subapp4(config):\n            self.assertEqual(config.route_prefix, 'root/nested/nested2')\n        def dummy_subapp(config):\n            self.assertEqual(config.route_prefix, 'root/nested')\n            config.include(dummy_subapp2)\n            config.include(dummy_subapp3, route_prefix='nested2')\n\n        root_config.include(dummy_subapp, route_prefix='nested')\n\n    def test_include_with_missing_source_file(self):\n        from pyramid.exceptions import ConfigurationError\n        import inspect\n        config = self._makeOne()\n        class DummyInspect(object):\n            def getmodule(self, c):\n                return inspect.getmodule(c)\n            def getsourcefile(self, c):\n                return None\n        config.inspect = DummyInspect()\n        try:\n            config.include('pyramid.tests.test_config.dummy_include')\n        except ConfigurationError as e:\n            self.assertEqual(\n                e.args[0], \n                \"No source file for module 'pyramid.tests.test_config' (.py \"\n                \"file must exist, refusing to use orphan .pyc or .pyo file).\")\n        else: # pragma: no cover\n            raise AssertionError\n\n    def test_include_constant_root_package(self):\n        from pyramid import tests\n        from pyramid.tests import test_config\n        config = self._makeOne(root_package=tests)\n        results = {}\n        def include(config):\n            results['package'] = config.package\n            results['root_package'] = config.root_package\n        config.include(include)\n        self.assertEqual(results['root_package'], tests)\n        self.assertEqual(results['package'], test_config)\n\n    def test_include_threadlocals_active(self):\n        from pyramid.tests import test_config\n        from pyramid.threadlocal import get_current_registry\n        stack = []\n        def include(config):\n            stack.append(get_current_registry())\n        config = self._makeOne()\n        config.include(include)\n        self.assertTrue(stack[0] is config.registry)\n\n    def test_action_branching_kw_is_None(self):\n        config = self._makeOne(autocommit=True)\n        self.assertEqual(config.action('discrim'), None)\n\n    def test_action_branching_kw_is_not_None(self):\n        config = self._makeOne(autocommit=True)\n        self.assertEqual(config.action('discrim', kw={'a':1}), None)\n\n    def test_action_autocommit_with_introspectables(self):\n        from pyramid.util import ActionInfo\n        config = self._makeOne(autocommit=True)\n        intr = DummyIntrospectable()\n        config.action('discrim', introspectables=(intr,))\n        self.assertEqual(len(intr.registered), 1)\n        self.assertEqual(intr.registered[0][0], config.introspector)\n        self.assertEqual(intr.registered[0][1].__class__, ActionInfo)\n\n    def test_action_autocommit_with_introspectables_introspection_off(self):\n        config = self._makeOne(autocommit=True)\n        config.introspection = False\n        intr = DummyIntrospectable()\n        config.action('discrim', introspectables=(intr,))\n        self.assertEqual(len(intr.registered), 0)\n        \n    def test_action_branching_nonautocommit_with_config_info(self):\n        config = self._makeOne(autocommit=False)\n        config.info = 'abc'\n        state = DummyActionState()\n        state.autocommit = False\n        config.action_state = state\n        config.action('discrim', kw={'a':1})\n        self.assertEqual(\n            state.actions,\n            [((),\n             {'args': (),\n             'callable': None,\n             'discriminator': 'discrim',\n             'includepath': (),\n             'info': 'abc',\n             'introspectables': (),\n             'kw': {'a': 1},\n             'order': 0})])\n\n    def test_action_branching_nonautocommit_without_config_info(self):\n        config = self._makeOne(autocommit=False)\n        config.info = ''\n        config._ainfo = ['z']\n        state = DummyActionState()\n        config.action_state = state\n        state.autocommit = False\n        config.action('discrim', kw={'a':1})\n        self.assertEqual(\n            state.actions,\n            [((),\n             {'args': (),\n             'callable': None,\n             'discriminator': 'discrim',\n             'includepath': (),\n             'info': 'z',\n             'introspectables': (),\n             'kw': {'a': 1},\n             'order': 0})])\n\n    def test_action_branching_nonautocommit_with_introspectables(self):\n        config = self._makeOne(autocommit=False)\n        config.info = ''\n        config._ainfo = []\n        state = DummyActionState()\n        config.action_state = state\n        state.autocommit = False\n        intr = DummyIntrospectable()\n        config.action('discrim', introspectables=(intr,))\n        self.assertEqual(\n            state.actions[0][1]['introspectables'], (intr,))\n\n    def test_action_nonautocommit_with_introspectables_introspection_off(self):\n        config = self._makeOne(autocommit=False)\n        config.info = ''\n        config._ainfo = []\n        config.introspection = False\n        state = DummyActionState()\n        config.action_state = state\n        state.autocommit = False\n        intr = DummyIntrospectable()\n        config.action('discrim', introspectables=(intr,))\n        self.assertEqual(\n            state.actions[0][1]['introspectables'], ())\n        \n    def test_scan_integration(self):\n        from zope.interface import alsoProvides\n        from pyramid.interfaces import IRequest\n        from pyramid.view import render_view_to_response\n        import pyramid.tests.test_config.pkgs.scannable as package\n        config = self._makeOne(autocommit=True)\n        config.scan(package)\n\n        ctx = DummyContext()\n        req = DummyRequest()\n        alsoProvides(req, IRequest)\n        req.registry = config.registry\n\n        req.method = 'GET'\n        result = render_view_to_response(ctx, req, '')\n        self.assertEqual(result, 'grokked')\n\n        req.method = 'POST'\n        result = render_view_to_response(ctx, req, '')\n        self.assertEqual(result, 'grokked_post')\n\n        result= render_view_to_response(ctx, req, 'grokked_class')\n        self.assertEqual(result, 'grokked_class')\n\n        result= render_view_to_response(ctx, req, 'grokked_instance')\n        self.assertEqual(result, 'grokked_instance')\n\n        result= render_view_to_response(ctx, req, 'oldstyle_grokked_class')\n        self.assertEqual(result, 'oldstyle_grokked_class')\n\n        req.method = 'GET'\n        result = render_view_to_response(ctx, req, 'another')\n        self.assertEqual(result, 'another_grokked')\n\n        req.method = 'POST'\n        result = render_view_to_response(ctx, req, 'another')\n        self.assertEqual(result, 'another_grokked_post')\n\n        result= render_view_to_response(ctx, req, 'another_grokked_class')\n        self.assertEqual(result, 'another_grokked_class')\n\n        result= render_view_to_response(ctx, req, 'another_grokked_instance')\n        self.assertEqual(result, 'another_grokked_instance')\n\n        result= render_view_to_response(ctx, req,\n                                        'another_oldstyle_grokked_class')\n        self.assertEqual(result, 'another_oldstyle_grokked_class')\n\n        result = render_view_to_response(ctx, req, 'stacked1')\n        self.assertEqual(result, 'stacked')\n\n        result = render_view_to_response(ctx, req, 'stacked2')\n        self.assertEqual(result, 'stacked')\n\n        result = render_view_to_response(ctx, req, 'another_stacked1')\n        self.assertEqual(result, 'another_stacked')\n\n        result = render_view_to_response(ctx, req, 'another_stacked2')\n        self.assertEqual(result, 'another_stacked')\n\n        result = render_view_to_response(ctx, req, 'stacked_class1')\n        self.assertEqual(result, 'stacked_class')\n\n        result = render_view_to_response(ctx, req, 'stacked_class2')\n        self.assertEqual(result, 'stacked_class')\n\n        result = render_view_to_response(ctx, req, 'another_stacked_class1')\n        self.assertEqual(result, 'another_stacked_class')\n\n        result = render_view_to_response(ctx, req, 'another_stacked_class2')\n        self.assertEqual(result, 'another_stacked_class')\n\n        # NB: on Jython, a class without an __init__ apparently accepts\n        # any number of arguments without raising a TypeError, so the next\n        # assertion may fail there.  We don't support Jython at the moment,\n        # this is just a note to a future self.\n\n        self.assertRaises(TypeError,\n                          render_view_to_response, ctx, req, 'basemethod')\n\n        result = render_view_to_response(ctx, req, 'method1')\n        self.assertEqual(result, 'method1')\n\n        result = render_view_to_response(ctx, req, 'method2')\n        self.assertEqual(result, 'method2')\n\n        result = render_view_to_response(ctx, req, 'stacked_method1')\n        self.assertEqual(result, 'stacked_method')\n\n        result = render_view_to_response(ctx, req, 'stacked_method2')\n        self.assertEqual(result, 'stacked_method')\n\n        result = render_view_to_response(ctx, req, 'subpackage_init')\n        self.assertEqual(result, 'subpackage_init')\n\n        result = render_view_to_response(ctx, req, 'subpackage_notinit')\n        self.assertEqual(result, 'subpackage_notinit')\n\n        result = render_view_to_response(ctx, req, 'subsubpackage_init')\n        self.assertEqual(result, 'subsubpackage_init')\n\n        result = render_view_to_response(ctx, req, 'pod_notinit')\n        self.assertEqual(result, None)\n\n    def test_scan_integration_with_ignore(self):\n        from zope.interface import alsoProvides\n        from pyramid.interfaces import IRequest\n        from pyramid.view import render_view_to_response\n        import pyramid.tests.test_config.pkgs.scannable as package\n        config = self._makeOne(autocommit=True)\n        config.scan(package, \n                    ignore='pyramid.tests.test_config.pkgs.scannable.another')\n\n        ctx = DummyContext()\n        req = DummyRequest()\n        alsoProvides(req, IRequest)\n        req.registry = config.registry\n\n        req.method = 'GET'\n        result = render_view_to_response(ctx, req, '')\n        self.assertEqual(result, 'grokked')\n\n        # ignored\n        v = render_view_to_response(ctx, req, 'another_stacked_class2')\n        self.assertEqual(v, None)\n        \n    def test_scan_integration_dottedname_package(self):\n        from zope.interface import alsoProvides\n        from pyramid.interfaces import IRequest\n        from pyramid.view import render_view_to_response\n        config = self._makeOne(autocommit=True)\n        config.scan('pyramid.tests.test_config.pkgs.scannable')\n\n        ctx = DummyContext()\n        req = DummyRequest()\n        alsoProvides(req, IRequest)\n        req.registry = config.registry\n\n        req.method = 'GET'\n        result = render_view_to_response(ctx, req, '')\n        self.assertEqual(result, 'grokked')\n\n    def test_scan_integration_with_extra_kw(self):\n        config = self._makeOne(autocommit=True)\n        config.scan('pyramid.tests.test_config.pkgs.scanextrakw', a=1)\n        self.assertEqual(config.a, 1)\n\n    def test_scan_integration_with_onerror(self):\n        # fancy sys.path manipulation here to appease \"setup.py test\" which\n        # fails miserably when it can't import something in the package\n        import sys\n        try:\n            here = os.path.dirname(__file__)\n            path = os.path.join(here, 'path')\n            sys.path.append(path)\n            config = self._makeOne(autocommit=True)\n            class FooException(Exception):\n                pass\n            def onerror(name):\n                raise FooException\n            self.assertRaises(FooException, config.scan, 'scanerror',\n                              onerror=onerror)\n        finally:\n            sys.path.remove(path)\n\n    def test_scan_integration_conflict(self):\n        from pyramid.tests.test_config.pkgs import selfscan\n        from pyramid.config import Configurator\n        c = Configurator()\n        c.scan(selfscan)\n        c.scan(selfscan)\n        try:\n            c.commit()\n        except ConfigurationConflictError as why:\n            def scanconflicts(e):\n                conflicts = e._conflicts.values()\n                for conflict in conflicts:\n                    for confinst in conflict:\n                        yield confinst.src\n            which = list(scanconflicts(why))\n            self.assertEqual(len(which), 4)\n            self.assertTrue(\"@view_config(renderer='string')\" in which)\n            self.assertTrue(\"@view_config(name='two', renderer='string')\" in\n                            which)\n\n    @skip_on('py3')\n    def test_hook_zca(self):\n        from zope.component import getSiteManager\n        def foo():\n            '123'\n        try:\n            config = self._makeOne()\n            config.hook_zca()\n            config.begin()\n            sm = getSiteManager()\n            self.assertEqual(sm, config.registry)\n        finally:\n            getSiteManager.reset()\n\n    @skip_on('py3')\n    def test_unhook_zca(self):\n        from zope.component import getSiteManager\n        def foo():\n            '123'\n        try:\n            getSiteManager.sethook(foo)\n            config = self._makeOne()\n            config.unhook_zca()\n            sm = getSiteManager()\n            self.assertNotEqual(sm, '123')\n        finally:\n            getSiteManager.reset()\n\n    def test_commit_conflict_simple(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        config.add_view(view1)\n        config.add_view(view2)\n        self.assertRaises(ConfigurationConflictError, config.commit)\n\n    def test_commit_conflict_resolved_with_include(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        def includeme(config):\n            config.add_view(view2)\n        config.add_view(view1)\n        config.include(includeme)\n        config.commit()\n        registeredview = self._getViewCallable(config)\n        self.assertEqual(registeredview.__name__, 'view1')\n\n    def test_commit_conflict_with_two_includes(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        def includeme1(config):\n            config.add_view(view1)\n        def includeme2(config):\n            config.add_view(view2)\n        config.include(includeme1)\n        config.include(includeme2)\n        try:\n            config.commit()\n        except ConfigurationConflictError as why:\n            c1, c2 = _conflictFunctions(why)\n            self.assertEqual(c1, 'includeme1')\n            self.assertEqual(c2, 'includeme2')\n        else: #pragma: no cover\n            raise AssertionError\n\n    def test_commit_conflict_resolved_with_two_includes_and_local(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        def view3(request): pass\n        def includeme1(config):\n            config.add_view(view1)\n        def includeme2(config):\n            config.add_view(view2)\n        config.include(includeme1)\n        config.include(includeme2)\n        config.add_view(view3)\n        config.commit()\n        registeredview = self._getViewCallable(config)\n        self.assertEqual(registeredview.__name__, 'view3')\n\n    def test_autocommit_no_conflicts(self):\n        from pyramid.renderers import null_renderer\n        config = self._makeOne(autocommit=True)\n        def view1(request): pass\n        def view2(request): pass\n        def view3(request): pass\n        config.add_view(view1, renderer=null_renderer)\n        config.add_view(view2, renderer=null_renderer)\n        config.add_view(view3, renderer=null_renderer)\n        config.commit()\n        registeredview = self._getViewCallable(config)\n        self.assertEqual(registeredview.__name__, 'view3')\n\n    def test_conflict_set_notfound_view(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        config.set_notfound_view(view1)\n        config.set_notfound_view(view2)\n        try:\n            config.commit()\n        except ConfigurationConflictError as why:\n            c1, c2 = _conflictFunctions(why)\n            self.assertEqual(c1, 'test_conflict_set_notfound_view')\n            self.assertEqual(c2, 'test_conflict_set_notfound_view')\n        else: # pragma: no cover\n            raise AssertionError\n\n    def test_conflict_set_forbidden_view(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        config.set_forbidden_view(view1)\n        config.set_forbidden_view(view2)\n        try:\n            config.commit()\n        except ConfigurationConflictError as why:\n            c1, c2 = _conflictFunctions(why)\n            self.assertEqual(c1, 'test_conflict_set_forbidden_view')\n            self.assertEqual(c2, 'test_conflict_set_forbidden_view')\n        else: # pragma: no cover\n            raise AssertionError\n\n    def test___getattr__missing_when_directives_exist(self):\n        config = self._makeOne()\n        directives = {}\n        config.registry._directives = directives\n        self.assertRaises(AttributeError, config.__getattr__, 'wontexist')\n\n    def test___getattr__missing_when_directives_dont_exist(self):\n        config = self._makeOne()\n        self.assertRaises(AttributeError, config.__getattr__, 'wontexist')\n\n    def test___getattr__matches(self):\n        config = self._makeOne()\n        def foo(config): pass\n        directives = {'foo':(foo, True)}\n        config.registry._directives = directives\n        foo_meth = config.foo\n        self.assertTrue(getattr(foo_meth, im_func).__docobj__ is foo)\n\n    def test___getattr__matches_no_action_wrap(self):\n        config = self._makeOne()\n        def foo(config): pass\n        directives = {'foo':(foo, False)}\n        config.registry._directives = directives\n        foo_meth = config.foo\n        self.assertTrue(getattr(foo_meth, im_func) is foo)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 20,
                            "end_lineno": 1253,
                            "parent": null
                        }
                    ],
                    "added_entities": [
                        {
                            "file_name": "pyramid/tests/test_config/test_init.py",
                            "type": "method",
                            "name": "ConfiguratorTests.test_include_threadlocals_active",
                            "content": "class ConfiguratorTests(unittest.TestCase):\n    def _makeOne(self, *arg, **kw):\n        from pyramid.config import Configurator\n        config = Configurator(*arg, **kw)\n        return config\n\n    def _getViewCallable(self, config, ctx_iface=None, request_iface=None,\n                         name='', exception_view=False):\n        from zope.interface import Interface\n        from pyramid.interfaces import IRequest\n        from pyramid.interfaces import IView\n        from pyramid.interfaces import IViewClassifier\n        from pyramid.interfaces import IExceptionViewClassifier\n        if exception_view: # pragma: no cover\n            classifier = IExceptionViewClassifier\n        else:\n            classifier = IViewClassifier\n        if ctx_iface is None:\n            ctx_iface = Interface\n        if request_iface is None:\n            request_iface = IRequest\n        return config.registry.adapters.lookup(\n            (classifier, request_iface, ctx_iface), IView, name=name,\n            default=None)\n\n    def _registerEventListener(self, config, event_iface=None):\n        if event_iface is None: # pragma: no cover\n            from zope.interface import Interface\n            event_iface = Interface\n        L = []\n        def subscriber(*event):\n            L.extend(event)\n        config.registry.registerHandler(subscriber, (event_iface,))\n        return L\n\n    def _makeRequest(self, config):\n        request = DummyRequest()\n        request.registry = config.registry\n        return request\n\n    def test_ctor_no_registry(self):\n        import sys\n        from pyramid.interfaces import ISettings\n        from pyramid.config import Configurator\n        from pyramid.interfaces import IRendererFactory\n        config = Configurator()\n        this_pkg = sys.modules['pyramid.tests.test_config']\n        self.assertTrue(config.registry.getUtility(ISettings))\n        self.assertEqual(config.package, this_pkg)\n        config.commit()\n        self.assertTrue(config.registry.getUtility(IRendererFactory, 'json'))\n        self.assertTrue(config.registry.getUtility(IRendererFactory, 'string'))\n\n    def test_begin(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        config.manager = manager\n        config.begin()\n        self.assertEqual(manager.pushed,\n                         {'registry':config.registry, 'request':None})\n        self.assertEqual(manager.popped, False)\n\n    def test_begin_with_request(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        request = object()\n        manager = DummyThreadLocalManager()\n        config.manager = manager\n        config.begin(request=request)\n        self.assertEqual(manager.pushed,\n                         {'registry':config.registry, 'request':request})\n        self.assertEqual(manager.popped, False)\n\n    def test_begin_overrides_request(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        req = object()\n        # set it up for auto-propagation\n        pushed = {'registry': config.registry, 'request': None}\n        manager.pushed = pushed\n        config.manager = manager\n        config.begin(req)\n        self.assertTrue(manager.pushed is not pushed)\n        self.assertEqual(manager.pushed['request'], req)\n        self.assertEqual(manager.pushed['registry'], config.registry)\n\n    def test_begin_propagates_request_for_same_registry(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        req = object()\n        pushed = {'registry': config.registry, 'request': req}\n        manager.pushed = pushed\n        config.manager = manager\n        config.begin()\n        self.assertTrue(manager.pushed is not pushed)\n        self.assertEqual(manager.pushed['request'], req)\n        self.assertEqual(manager.pushed['registry'], config.registry)\n\n    def test_begin_does_not_propagate_request_for_diff_registry(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        req = object()\n        pushed = {'registry': object(), 'request': req}\n        manager.pushed = pushed\n        config.manager = manager\n        config.begin()\n        self.assertTrue(manager.pushed is not pushed)\n        self.assertEqual(manager.pushed['request'], None)\n        self.assertEqual(manager.pushed['registry'], config.registry)\n\n    def test_end(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        pushed = manager.pushed\n        config.manager = manager\n        config.end()\n        self.assertEqual(manager.pushed, pushed)\n        self.assertEqual(manager.popped, True)\n\n    def test_ctor_with_package_registry(self):\n        import sys\n        from pyramid.config import Configurator\n        pkg = sys.modules['pyramid']\n        config = Configurator(package=pkg)\n        self.assertEqual(config.package, pkg)\n\n    def test_ctor_noreg_custom_settings(self):\n        from pyramid.interfaces import ISettings\n        settings = {'reload_templates':True,\n                    'mysetting':True}\n        config = self._makeOne(settings=settings)\n        settings = config.registry.getUtility(ISettings)\n        self.assertEqual(settings['reload_templates'], True)\n        self.assertEqual(settings['debug_authorization'], False)\n        self.assertEqual(settings['mysetting'], True)\n\n    def test_ctor_noreg_debug_logger_None_default(self):\n        from pyramid.interfaces import IDebugLogger\n        config = self._makeOne()\n        logger = config.registry.getUtility(IDebugLogger)\n        self.assertEqual(logger.name, 'pyramid.tests.test_config')\n\n    def test_ctor_noreg_debug_logger_non_None(self):\n        from pyramid.interfaces import IDebugLogger\n        logger = object()\n        config = self._makeOne(debug_logger=logger)\n        result = config.registry.getUtility(IDebugLogger)\n        self.assertEqual(logger, result)\n\n    def test_ctor_authentication_policy(self):\n        from pyramid.interfaces import IAuthenticationPolicy\n        policy = object()\n        config = self._makeOne(authentication_policy=policy)\n        config.commit()\n        result = config.registry.getUtility(IAuthenticationPolicy)\n        self.assertEqual(policy, result)\n\n    def test_ctor_authorization_policy_only(self):\n        policy = object()\n        config = self._makeOne(authorization_policy=policy)\n        self.assertRaises(ConfigurationExecutionError, config.commit)\n\n    def test_ctor_no_root_factory(self):\n        from pyramid.interfaces import IRootFactory\n        config = self._makeOne()\n        self.assertEqual(config.registry.queryUtility(IRootFactory), None)\n        config.commit()\n        self.assertEqual(config.registry.queryUtility(IRootFactory), None)\n\n    def test_ctor_with_root_factory(self):\n        from pyramid.interfaces import IRootFactory\n        factory = object()\n        config = self._makeOne(root_factory=factory)\n        self.assertEqual(config.registry.queryUtility(IRootFactory), None)\n        config.commit()\n        self.assertEqual(config.registry.queryUtility(IRootFactory), factory)\n\n    def test_ctor_alternate_renderers(self):\n        from pyramid.interfaces import IRendererFactory\n        renderer = object()\n        config = self._makeOne(renderers=[('yeah', renderer)])\n        config.commit()\n        self.assertEqual(config.registry.getUtility(IRendererFactory, 'yeah'),\n                         renderer)\n\n    def test_ctor_default_renderers(self):\n        from pyramid.interfaces import IRendererFactory\n        from pyramid.renderers import json_renderer_factory\n        config = self._makeOne()\n        self.assertEqual(config.registry.getUtility(IRendererFactory, 'json'),\n                         json_renderer_factory)\n\n    def test_ctor_default_permission(self):\n        from pyramid.interfaces import IDefaultPermission\n        config = self._makeOne(default_permission='view')\n        config.commit()\n        self.assertEqual(config.registry.getUtility(IDefaultPermission), 'view')\n\n    def test_ctor_session_factory(self):\n        from pyramid.interfaces import ISessionFactory\n        factory = object()\n        config = self._makeOne(session_factory=factory)\n        self.assertEqual(config.registry.queryUtility(ISessionFactory), None)\n        config.commit()\n        self.assertEqual(config.registry.getUtility(ISessionFactory), factory)\n\n    def test_ctor_default_view_mapper(self):\n        from pyramid.interfaces import IViewMapperFactory\n        mapper = object()\n        config = self._makeOne(default_view_mapper=mapper)\n        config.commit()\n        self.assertEqual(config.registry.getUtility(IViewMapperFactory),\n                         mapper)\n\n    def test_ctor_httpexception_view_default(self):\n        from pyramid.interfaces import IExceptionResponse\n        from pyramid.httpexceptions import default_exceptionresponse_view\n        from pyramid.interfaces import IRequest\n        config = self._makeOne()\n        view = self._getViewCallable(config,\n                                     ctx_iface=IExceptionResponse,\n                                     request_iface=IRequest)\n        self.assertTrue(view.__wraps__ is default_exceptionresponse_view)\n\n    def test_ctor_exceptionresponse_view_None(self):\n        from pyramid.interfaces import IExceptionResponse\n        from pyramid.interfaces import IRequest\n        config = self._makeOne(exceptionresponse_view=None)\n        view = self._getViewCallable(config,\n                                     ctx_iface=IExceptionResponse,\n                                     request_iface=IRequest)\n        self.assertTrue(view is None)\n\n    def test_ctor_exceptionresponse_view_custom(self):\n        from pyramid.interfaces import IExceptionResponse\n        from pyramid.interfaces import IRequest\n        def exceptionresponse_view(context, request): pass\n        config = self._makeOne(exceptionresponse_view=exceptionresponse_view)\n        view = self._getViewCallable(config,\n                                     ctx_iface=IExceptionResponse,\n                                     request_iface=IRequest)\n        self.assertTrue(view.__wraps__ is exceptionresponse_view)\n\n    def test_ctor_with_introspection(self):\n        config = self._makeOne(introspection=False)\n        self.assertEqual(config.introspection, False)\n\n    def test_ctor_default_webob_response_adapter_registered(self):\n        from webob import Response as WebobResponse\n        response = WebobResponse()\n        from pyramid.interfaces import IResponse\n        config = self._makeOne(autocommit=True)\n        result = config.registry.queryAdapter(response, IResponse)\n        self.assertEqual(result, response)\n        \n    def test_with_package_module(self):\n        from pyramid.tests.test_config import test_init\n        import pyramid.tests\n        config = self._makeOne()\n        newconfig = config.with_package(test_init)\n        self.assertEqual(newconfig.package, pyramid.tests.test_config)\n\n    def test_with_package_package(self):\n        import pyramid.tests.test_config\n        config = self._makeOne()\n        newconfig = config.with_package(pyramid.tests.test_config)\n        self.assertEqual(newconfig.package, pyramid.tests.test_config)\n\n    def test_with_package(self):\n        import pyramid.tests\n        config = self._makeOne()\n        config.basepath = 'basepath'\n        config.info = 'info'\n        config.includepath = ('spec',)\n        config.autocommit = True\n        config.route_prefix = 'prefix'\n        newconfig = config.with_package(pyramid.tests)\n        self.assertEqual(newconfig.package, pyramid.tests)\n        self.assertEqual(newconfig.registry, config.registry)\n        self.assertEqual(newconfig.autocommit, True)\n        self.assertEqual(newconfig.route_prefix, 'prefix')\n        self.assertEqual(newconfig.info, 'info')\n        self.assertEqual(newconfig.basepath, 'basepath')\n        self.assertEqual(newconfig.includepath, ('spec',))\n\n    def test_maybe_dotted_string_success(self):\n        import pyramid.tests.test_config\n        config = self._makeOne()\n        result = config.maybe_dotted('pyramid.tests.test_config')\n        self.assertEqual(result, pyramid.tests.test_config)\n\n    def test_maybe_dotted_string_fail(self):\n        config = self._makeOne()\n        self.assertRaises(ImportError, config.maybe_dotted, 'cant.be.found')\n\n    def test_maybe_dotted_notstring_success(self):\n        import pyramid.tests.test_config\n        config = self._makeOne()\n        result = config.maybe_dotted(pyramid.tests.test_config)\n        self.assertEqual(result, pyramid.tests.test_config)\n\n    def test_absolute_asset_spec_already_absolute(self):\n        import pyramid.tests.test_config\n        config = self._makeOne(package=pyramid.tests.test_config)\n        result = config.absolute_asset_spec('already:absolute')\n        self.assertEqual(result, 'already:absolute')\n\n    def test_absolute_asset_spec_notastring(self):\n        import pyramid.tests.test_config\n        config = self._makeOne(package=pyramid.tests.test_config)\n        result = config.absolute_asset_spec(None)\n        self.assertEqual(result, None)\n\n    def test_absolute_asset_spec_relative(self):\n        import pyramid.tests.test_config\n        config = self._makeOne(package=pyramid.tests.test_config)\n        result = config.absolute_asset_spec('files')\n        self.assertEqual(result, 'pyramid.tests.test_config:files')\n\n    def test__fix_registry_has_listeners(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config._fix_registry()\n        self.assertEqual(reg.has_listeners, True)\n\n    def test__fix_registry_notify(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config._fix_registry()\n        self.assertEqual(reg.notify(1), None)\n        self.assertEqual(reg.events, (1,))\n\n    def test__fix_registry_queryAdapterOrSelf(self):\n        from zope.interface import Interface\n        from zope.interface import implementer\n        class IFoo(Interface):\n            pass\n        @implementer(IFoo)\n        class Foo(object):\n            pass\n        class Bar(object):\n            pass\n        adaptation = ()\n        foo = Foo()\n        bar = Bar()\n        reg = DummyRegistry(adaptation)\n        config = self._makeOne(reg)\n        config._fix_registry()\n        self.assertTrue(reg.queryAdapterOrSelf(foo, IFoo) is foo)\n        self.assertTrue(reg.queryAdapterOrSelf(bar, IFoo) is adaptation)\n\n    def test__fix_registry_registerSelfAdapter(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config._fix_registry()\n        reg.registerSelfAdapter('required', 'provided', name='abc')\n        self.assertEqual(len(reg.adapters), 1)\n        args, kw = reg.adapters[0]\n        self.assertEqual(args[0]('abc'), 'abc')\n        self.assertEqual(kw,\n                         {'info': '', 'provided': 'provided',\n                          'required': 'required', 'name': 'abc', 'event': True})\n\n    def test__fix_registry_adds__lock(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config._fix_registry()\n        self.assertTrue(hasattr(reg, '_lock'))\n\n    def test__fix_registry_adds_clear_view_lookup_cache(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        self.assertFalse(hasattr(reg, '_clear_view_lookup_cache'))\n        config._fix_registry()\n        self.assertFalse(hasattr(reg, '_view_lookup_cache'))\n        reg._clear_view_lookup_cache()\n        self.assertEqual(reg._view_lookup_cache, {})\n\n    def test_setup_registry_calls_fix_registry(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config.add_view = lambda *arg, **kw: False\n        config._add_tween = lambda *arg, **kw: False\n        config.setup_registry()\n        self.assertEqual(reg.has_listeners, True)\n\n    def test_setup_registry_registers_default_exceptionresponse_views(self):\n        from webob.exc import WSGIHTTPException\n        from pyramid.interfaces import IExceptionResponse\n        from pyramid.view import default_exceptionresponse_view\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        views = []\n        config.add_view = lambda *arg, **kw: views.append((arg, kw))\n        config.add_default_view_predicates = lambda *arg: None\n        config._add_tween = lambda *arg, **kw: False\n        config.setup_registry()\n        self.assertEqual(views[0], ((default_exceptionresponse_view,),\n                                    {'context':IExceptionResponse}))\n        self.assertEqual(views[1], ((default_exceptionresponse_view,),\n                                    {'context':WSGIHTTPException}))\n\n    def test_setup_registry_registers_default_view_predicates(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        vp_called = []\n        config.add_view = lambda *arg, **kw: None\n        config.add_default_view_predicates = lambda *arg: vp_called.append(True)\n        config._add_tween = lambda *arg, **kw: False\n        config.setup_registry()\n        self.assertTrue(vp_called)\n\n    def test_setup_registry_registers_default_webob_iresponse_adapter(self):\n        from webob import Response\n        from pyramid.interfaces import IResponse\n        config = self._makeOne()\n        config.setup_registry()\n        response = Response()\n        self.assertTrue(\n            config.registry.queryAdapter(response, IResponse) is response)\n\n    def test_setup_registry_explicit_notfound_trumps_iexceptionresponse(self):\n        from pyramid.renderers import null_renderer\n        from zope.interface import implementedBy\n        from pyramid.interfaces import IRequest\n        from pyramid.httpexceptions import HTTPNotFound\n        from pyramid.registry import Registry\n        reg = Registry()\n        config = self._makeOne(reg, autocommit=True)\n        config.setup_registry() # registers IExceptionResponse default view\n        def myview(context, request):\n            return 'OK'\n        config.add_view(myview, context=HTTPNotFound, renderer=null_renderer)\n        request = self._makeRequest(config)\n        view = self._getViewCallable(config,\n                                     ctx_iface=implementedBy(HTTPNotFound),\n                                     request_iface=IRequest)\n        result = view(None, request)\n        self.assertEqual(result, 'OK')\n\n    def test_setup_registry_custom_settings(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import ISettings\n        settings = {'reload_templates':True,\n                    'mysetting':True}\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(settings=settings)\n        settings = reg.getUtility(ISettings)\n        self.assertEqual(settings['reload_templates'], True)\n        self.assertEqual(settings['debug_authorization'], False)\n        self.assertEqual(settings['mysetting'], True)\n\n    def test_setup_registry_debug_logger_None_default(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDebugLogger\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry()\n        logger = reg.getUtility(IDebugLogger)\n        self.assertEqual(logger.name, 'pyramid.tests.test_config')\n\n    def test_setup_registry_debug_logger_non_None(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDebugLogger\n        logger = object()\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(debug_logger=logger)\n        result = reg.getUtility(IDebugLogger)\n        self.assertEqual(logger, result)\n\n    def test_setup_registry_debug_logger_name(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDebugLogger\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(debug_logger='foo')\n        result = reg.getUtility(IDebugLogger)\n        self.assertEqual(result.name, 'foo')\n\n    def test_setup_registry_authentication_policy(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IAuthenticationPolicy\n        policy = object()\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(authentication_policy=policy)\n        config.commit()\n        result = reg.getUtility(IAuthenticationPolicy)\n        self.assertEqual(policy, result)\n\n    def test_setup_registry_authentication_policy_dottedname(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IAuthenticationPolicy\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(authentication_policy='pyramid.tests.test_config')\n        config.commit()\n        result = reg.getUtility(IAuthenticationPolicy)\n        import pyramid.tests.test_config\n        self.assertEqual(result, pyramid.tests.test_config)\n\n    def test_setup_registry_authorization_policy_dottedname(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IAuthorizationPolicy\n        reg = Registry()\n        config = self._makeOne(reg)\n        dummy = object()\n        config.setup_registry(authentication_policy=dummy,\n                              authorization_policy='pyramid.tests.test_config')\n        config.commit()\n        result = reg.getUtility(IAuthorizationPolicy)\n        import pyramid.tests.test_config\n        self.assertEqual(result, pyramid.tests.test_config)\n\n    def test_setup_registry_authorization_policy_only(self):\n        from pyramid.registry import Registry\n        policy = object()\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(authorization_policy=policy)\n        config = self.assertRaises(ConfigurationExecutionError, config.commit)\n\n    def test_setup_registry_no_default_root_factory(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRootFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry()\n        config.commit()\n        self.assertEqual(reg.queryUtility(IRootFactory), None)\n\n    def test_setup_registry_dottedname_root_factory(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRootFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        import pyramid.tests.test_config\n        config.setup_registry(root_factory='pyramid.tests.test_config')\n        self.assertEqual(reg.queryUtility(IRootFactory), None)\n        config.commit()\n        self.assertEqual(reg.getUtility(IRootFactory),\n                         pyramid.tests.test_config)\n\n    def test_setup_registry_locale_negotiator_dottedname(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import ILocaleNegotiator\n        reg = Registry()\n        config = self._makeOne(reg)\n        import pyramid.tests.test_config\n        config.setup_registry(locale_negotiator='pyramid.tests.test_config')\n        self.assertEqual(reg.queryUtility(ILocaleNegotiator), None)\n        config.commit()\n        utility = reg.getUtility(ILocaleNegotiator)\n        self.assertEqual(utility, pyramid.tests.test_config)\n\n    def test_setup_registry_locale_negotiator(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import ILocaleNegotiator\n        reg = Registry()\n        config = self._makeOne(reg)\n        negotiator = object()\n        config.setup_registry(locale_negotiator=negotiator)\n        self.assertEqual(reg.queryUtility(ILocaleNegotiator), None)\n        config.commit()\n        utility = reg.getUtility(ILocaleNegotiator)\n        self.assertEqual(utility, negotiator)\n\n    def test_setup_registry_request_factory(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRequestFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        factory = object()\n        config.setup_registry(request_factory=factory)\n        self.assertEqual(reg.queryUtility(IRequestFactory), None)\n        config.commit()\n        utility = reg.getUtility(IRequestFactory)\n        self.assertEqual(utility, factory)\n\n    def test_setup_registry_response_factory(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IResponseFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        factory = lambda r: object()\n        config.setup_registry(response_factory=factory)\n        self.assertEqual(reg.queryUtility(IResponseFactory), None)\n        config.commit()\n        utility = reg.getUtility(IResponseFactory)\n        self.assertEqual(utility, factory)\n\n    def test_setup_registry_request_factory_dottedname(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRequestFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        import pyramid.tests.test_config\n        config.setup_registry(request_factory='pyramid.tests.test_config')\n        self.assertEqual(reg.queryUtility(IRequestFactory), None)\n        config.commit()\n        utility = reg.getUtility(IRequestFactory)\n        self.assertEqual(utility, pyramid.tests.test_config)\n\n    def test_setup_registry_alternate_renderers(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRendererFactory\n        renderer = object()\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(renderers=[('yeah', renderer)])\n        config.commit()\n        self.assertEqual(reg.getUtility(IRendererFactory, 'yeah'),\n                         renderer)\n\n    def test_setup_registry_default_permission(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDefaultPermission\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(default_permission='view')\n        config.commit()\n        self.assertEqual(reg.getUtility(IDefaultPermission), 'view')\n\n    def test_setup_registry_includes(self):\n        from pyramid.registry import Registry\n        reg = Registry()\n        config = self._makeOne(reg)\n        settings = {\n            'pyramid.includes':\n\"\"\"pyramid.tests.test_config.dummy_include\npyramid.tests.test_config.dummy_include2\"\"\",\n        }\n        config.setup_registry(settings=settings)\n        self.assertTrue(reg.included)\n        self.assertTrue(reg.also_included)\n\n    def test_setup_registry_includes_spaces(self):\n        from pyramid.registry import Registry\n        reg = Registry()\n        config = self._makeOne(reg)\n        settings = {\n            'pyramid.includes':\n\"\"\"pyramid.tests.test_config.dummy_include pyramid.tests.test_config.dummy_include2\"\"\",\n        }\n        config.setup_registry(settings=settings)\n        self.assertTrue(reg.included)\n        self.assertTrue(reg.also_included)\n\n    def test_setup_registry_tweens(self):\n        from pyramid.interfaces import ITweens\n        from pyramid.registry import Registry\n        reg = Registry()\n        config = self._makeOne(reg)\n        settings = {\n            'pyramid.tweens':\n                    'pyramid.tests.test_config.dummy_tween_factory'\n        }\n        config.setup_registry(settings=settings)\n        config.commit()\n        tweens = config.registry.getUtility(ITweens)\n        self.assertEqual(\n            tweens.explicit,\n            [('pyramid.tests.test_config.dummy_tween_factory',\n              dummy_tween_factory)])\n\n    def test_introspector_decorator(self):\n        inst = self._makeOne()\n        default = inst.introspector\n        self.assertTrue(hasattr(default, 'add'))\n        self.assertEqual(inst.introspector, inst.registry.introspector)\n        introspector = object()\n        inst.introspector = introspector\n        new = inst.introspector\n        self.assertTrue(new is introspector)\n        self.assertEqual(inst.introspector, inst.registry.introspector)\n        del inst.introspector\n        default = inst.introspector\n        self.assertFalse(default is new)\n        self.assertTrue(hasattr(default, 'add'))\n\n    def test_make_wsgi_app(self):\n        import pyramid.config\n        from pyramid.router import Router\n        from pyramid.interfaces import IApplicationCreated\n        manager = DummyThreadLocalManager()\n        config = self._makeOne()\n        subscriber = self._registerEventListener(config, IApplicationCreated)\n        config.manager = manager\n        app = config.make_wsgi_app()\n        self.assertEqual(app.__class__, Router)\n        self.assertEqual(manager.pushed['registry'], config.registry)\n        self.assertEqual(manager.pushed['request'], None)\n        self.assertTrue(manager.popped)\n        self.assertEqual(pyramid.config.global_registries.last, app.registry)\n        self.assertEqual(len(subscriber), 1)\n        self.assertTrue(IApplicationCreated.providedBy(subscriber[0]))\n        pyramid.config.global_registries.empty()\n\n    def test_include_with_dotted_name(self):\n        from pyramid.tests import test_config\n        config = self._makeOne()\n        config.include('pyramid.tests.test_config.dummy_include')\n        after = config.action_state\n        actions = after.actions\n        self.assertEqual(len(actions), 1)\n        action = after.actions[0]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_include_with_python_callable(self):\n        from pyramid.tests import test_config\n        config = self._makeOne()\n        config.include(dummy_include)\n        after = config.action_state\n        actions = after.actions\n        self.assertEqual(len(actions), 1)\n        action = actions[0]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_include_with_module_defaults_to_includeme(self):\n        from pyramid.tests import test_config\n        config = self._makeOne()\n        config.include('pyramid.tests.test_config')\n        after = config.action_state\n        actions = after.actions\n        self.assertEqual(len(actions), 1)\n        action = actions[0]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_include_with_module_defaults_to_includeme_missing(self):\n        from pyramid.exceptions import ConfigurationError\n        config = self._makeOne()\n        self.assertRaises(ConfigurationError, config.include, 'pyramid.tests')\n\n    def test_include_with_route_prefix(self):\n        root_config = self._makeOne(autocommit=True)\n        def dummy_subapp(config):\n            self.assertEqual(config.route_prefix, 'root')\n        root_config.include(dummy_subapp, route_prefix='root')\n\n    def test_include_with_nested_route_prefix(self):\n        root_config = self._makeOne(autocommit=True, route_prefix='root')\n        def dummy_subapp2(config):\n            self.assertEqual(config.route_prefix, 'root/nested')\n        def dummy_subapp3(config):\n            self.assertEqual(config.route_prefix, 'root/nested/nested2')\n            config.include(dummy_subapp4)\n        def dummy_subapp4(config):\n            self.assertEqual(config.route_prefix, 'root/nested/nested2')\n        def dummy_subapp(config):\n            self.assertEqual(config.route_prefix, 'root/nested')\n            config.include(dummy_subapp2)\n            config.include(dummy_subapp3, route_prefix='nested2')\n\n        root_config.include(dummy_subapp, route_prefix='nested')\n\n    def test_include_with_missing_source_file(self):\n        from pyramid.exceptions import ConfigurationError\n        import inspect\n        config = self._makeOne()\n        class DummyInspect(object):\n            def getmodule(self, c):\n                return inspect.getmodule(c)\n            def getsourcefile(self, c):\n                return None\n        config.inspect = DummyInspect()\n        try:\n            config.include('pyramid.tests.test_config.dummy_include')\n        except ConfigurationError as e:\n            self.assertEqual(\n                e.args[0], \n                \"No source file for module 'pyramid.tests.test_config' (.py \"\n                \"file must exist, refusing to use orphan .pyc or .pyo file).\")\n        else: # pragma: no cover\n            raise AssertionError\n\n    def test_include_constant_root_package(self):\n        from pyramid import tests\n        from pyramid.tests import test_config\n        config = self._makeOne(root_package=tests)\n        results = {}\n        def include(config):\n            results['package'] = config.package\n            results['root_package'] = config.root_package\n        config.include(include)\n        self.assertEqual(results['root_package'], tests)\n        self.assertEqual(results['package'], test_config)\n\n    def test_include_threadlocals_active(self):\n        from pyramid.tests import test_config\n        from pyramid.threadlocal import get_current_registry\n        stack = []\n        def include(config):\n            stack.append(get_current_registry())\n        config = self._makeOne()\n        config.include(include)\n        self.assertTrue(stack[0] is config.registry)\n\n    def test_action_branching_kw_is_None(self):\n        config = self._makeOne(autocommit=True)\n        self.assertEqual(config.action('discrim'), None)\n\n    def test_action_branching_kw_is_not_None(self):\n        config = self._makeOne(autocommit=True)\n        self.assertEqual(config.action('discrim', kw={'a':1}), None)\n\n    def test_action_autocommit_with_introspectables(self):\n        from pyramid.util import ActionInfo\n        config = self._makeOne(autocommit=True)\n        intr = DummyIntrospectable()\n        config.action('discrim', introspectables=(intr,))\n        self.assertEqual(len(intr.registered), 1)\n        self.assertEqual(intr.registered[0][0], config.introspector)\n        self.assertEqual(intr.registered[0][1].__class__, ActionInfo)\n\n    def test_action_autocommit_with_introspectables_introspection_off(self):\n        config = self._makeOne(autocommit=True)\n        config.introspection = False\n        intr = DummyIntrospectable()\n        config.action('discrim', introspectables=(intr,))\n        self.assertEqual(len(intr.registered), 0)\n        \n    def test_action_branching_nonautocommit_with_config_info(self):\n        config = self._makeOne(autocommit=False)\n        config.info = 'abc'\n        state = DummyActionState()\n        state.autocommit = False\n        config.action_state = state\n        config.action('discrim', kw={'a':1})\n        self.assertEqual(\n            state.actions,\n            [((),\n             {'args': (),\n             'callable': None,\n             'discriminator': 'discrim',\n             'includepath': (),\n             'info': 'abc',\n             'introspectables': (),\n             'kw': {'a': 1},\n             'order': 0})])\n\n    def test_action_branching_nonautocommit_without_config_info(self):\n        config = self._makeOne(autocommit=False)\n        config.info = ''\n        config._ainfo = ['z']\n        state = DummyActionState()\n        config.action_state = state\n        state.autocommit = False\n        config.action('discrim', kw={'a':1})\n        self.assertEqual(\n            state.actions,\n            [((),\n             {'args': (),\n             'callable': None,\n             'discriminator': 'discrim',\n             'includepath': (),\n             'info': 'z',\n             'introspectables': (),\n             'kw': {'a': 1},\n             'order': 0})])\n\n    def test_action_branching_nonautocommit_with_introspectables(self):\n        config = self._makeOne(autocommit=False)\n        config.info = ''\n        config._ainfo = []\n        state = DummyActionState()\n        config.action_state = state\n        state.autocommit = False\n        intr = DummyIntrospectable()\n        config.action('discrim', introspectables=(intr,))\n        self.assertEqual(\n            state.actions[0][1]['introspectables'], (intr,))\n\n    def test_action_nonautocommit_with_introspectables_introspection_off(self):\n        config = self._makeOne(autocommit=False)\n        config.info = ''\n        config._ainfo = []\n        config.introspection = False\n        state = DummyActionState()\n        config.action_state = state\n        state.autocommit = False\n        intr = DummyIntrospectable()\n        config.action('discrim', introspectables=(intr,))\n        self.assertEqual(\n            state.actions[0][1]['introspectables'], ())\n        \n    def test_scan_integration(self):\n        from zope.interface import alsoProvides\n        from pyramid.interfaces import IRequest\n        from pyramid.view import render_view_to_response\n        import pyramid.tests.test_config.pkgs.scannable as package\n        config = self._makeOne(autocommit=True)\n        config.scan(package)\n\n        ctx = DummyContext()\n        req = DummyRequest()\n        alsoProvides(req, IRequest)\n        req.registry = config.registry\n\n        req.method = 'GET'\n        result = render_view_to_response(ctx, req, '')\n        self.assertEqual(result, 'grokked')\n\n        req.method = 'POST'\n        result = render_view_to_response(ctx, req, '')\n        self.assertEqual(result, 'grokked_post')\n\n        result= render_view_to_response(ctx, req, 'grokked_class')\n        self.assertEqual(result, 'grokked_class')\n\n        result= render_view_to_response(ctx, req, 'grokked_instance')\n        self.assertEqual(result, 'grokked_instance')\n\n        result= render_view_to_response(ctx, req, 'oldstyle_grokked_class')\n        self.assertEqual(result, 'oldstyle_grokked_class')\n\n        req.method = 'GET'\n        result = render_view_to_response(ctx, req, 'another')\n        self.assertEqual(result, 'another_grokked')\n\n        req.method = 'POST'\n        result = render_view_to_response(ctx, req, 'another')\n        self.assertEqual(result, 'another_grokked_post')\n\n        result= render_view_to_response(ctx, req, 'another_grokked_class')\n        self.assertEqual(result, 'another_grokked_class')\n\n        result= render_view_to_response(ctx, req, 'another_grokked_instance')\n        self.assertEqual(result, 'another_grokked_instance')\n\n        result= render_view_to_response(ctx, req,\n                                        'another_oldstyle_grokked_class')\n        self.assertEqual(result, 'another_oldstyle_grokked_class')\n\n        result = render_view_to_response(ctx, req, 'stacked1')\n        self.assertEqual(result, 'stacked')\n\n        result = render_view_to_response(ctx, req, 'stacked2')\n        self.assertEqual(result, 'stacked')\n\n        result = render_view_to_response(ctx, req, 'another_stacked1')\n        self.assertEqual(result, 'another_stacked')\n\n        result = render_view_to_response(ctx, req, 'another_stacked2')\n        self.assertEqual(result, 'another_stacked')\n\n        result = render_view_to_response(ctx, req, 'stacked_class1')\n        self.assertEqual(result, 'stacked_class')\n\n        result = render_view_to_response(ctx, req, 'stacked_class2')\n        self.assertEqual(result, 'stacked_class')\n\n        result = render_view_to_response(ctx, req, 'another_stacked_class1')\n        self.assertEqual(result, 'another_stacked_class')\n\n        result = render_view_to_response(ctx, req, 'another_stacked_class2')\n        self.assertEqual(result, 'another_stacked_class')\n\n        # NB: on Jython, a class without an __init__ apparently accepts\n        # any number of arguments without raising a TypeError, so the next\n        # assertion may fail there.  We don't support Jython at the moment,\n        # this is just a note to a future self.\n\n        self.assertRaises(TypeError,\n                          render_view_to_response, ctx, req, 'basemethod')\n\n        result = render_view_to_response(ctx, req, 'method1')\n        self.assertEqual(result, 'method1')\n\n        result = render_view_to_response(ctx, req, 'method2')\n        self.assertEqual(result, 'method2')\n\n        result = render_view_to_response(ctx, req, 'stacked_method1')\n        self.assertEqual(result, 'stacked_method')\n\n        result = render_view_to_response(ctx, req, 'stacked_method2')\n        self.assertEqual(result, 'stacked_method')\n\n        result = render_view_to_response(ctx, req, 'subpackage_init')\n        self.assertEqual(result, 'subpackage_init')\n\n        result = render_view_to_response(ctx, req, 'subpackage_notinit')\n        self.assertEqual(result, 'subpackage_notinit')\n\n        result = render_view_to_response(ctx, req, 'subsubpackage_init')\n        self.assertEqual(result, 'subsubpackage_init')\n\n        result = render_view_to_response(ctx, req, 'pod_notinit')\n        self.assertEqual(result, None)\n\n    def test_scan_integration_with_ignore(self):\n        from zope.interface import alsoProvides\n        from pyramid.interfaces import IRequest\n        from pyramid.view import render_view_to_response\n        import pyramid.tests.test_config.pkgs.scannable as package\n        config = self._makeOne(autocommit=True)\n        config.scan(package, \n                    ignore='pyramid.tests.test_config.pkgs.scannable.another')\n\n        ctx = DummyContext()\n        req = DummyRequest()\n        alsoProvides(req, IRequest)\n        req.registry = config.registry\n\n        req.method = 'GET'\n        result = render_view_to_response(ctx, req, '')\n        self.assertEqual(result, 'grokked')\n\n        # ignored\n        v = render_view_to_response(ctx, req, 'another_stacked_class2')\n        self.assertEqual(v, None)\n        \n    def test_scan_integration_dottedname_package(self):\n        from zope.interface import alsoProvides\n        from pyramid.interfaces import IRequest\n        from pyramid.view import render_view_to_response\n        config = self._makeOne(autocommit=True)\n        config.scan('pyramid.tests.test_config.pkgs.scannable')\n\n        ctx = DummyContext()\n        req = DummyRequest()\n        alsoProvides(req, IRequest)\n        req.registry = config.registry\n\n        req.method = 'GET'\n        result = render_view_to_response(ctx, req, '')\n        self.assertEqual(result, 'grokked')\n\n    def test_scan_integration_with_extra_kw(self):\n        config = self._makeOne(autocommit=True)\n        config.scan('pyramid.tests.test_config.pkgs.scanextrakw', a=1)\n        self.assertEqual(config.a, 1)\n\n    def test_scan_integration_with_onerror(self):\n        # fancy sys.path manipulation here to appease \"setup.py test\" which\n        # fails miserably when it can't import something in the package\n        import sys\n        try:\n            here = os.path.dirname(__file__)\n            path = os.path.join(here, 'path')\n            sys.path.append(path)\n            config = self._makeOne(autocommit=True)\n            class FooException(Exception):\n                pass\n            def onerror(name):\n                raise FooException\n            self.assertRaises(FooException, config.scan, 'scanerror',\n                              onerror=onerror)\n        finally:\n            sys.path.remove(path)\n\n    def test_scan_integration_conflict(self):\n        from pyramid.tests.test_config.pkgs import selfscan\n        from pyramid.config import Configurator\n        c = Configurator()\n        c.scan(selfscan)\n        c.scan(selfscan)\n        try:\n            c.commit()\n        except ConfigurationConflictError as why:\n            def scanconflicts(e):\n                conflicts = e._conflicts.values()\n                for conflict in conflicts:\n                    for confinst in conflict:\n                        yield confinst.src\n            which = list(scanconflicts(why))\n            self.assertEqual(len(which), 4)\n            self.assertTrue(\"@view_config(renderer='string')\" in which)\n            self.assertTrue(\"@view_config(name='two', renderer='string')\" in\n                            which)\n\n    @skip_on('py3')\n    def test_hook_zca(self):\n        from zope.component import getSiteManager\n        def foo():\n            '123'\n        try:\n            config = self._makeOne()\n            config.hook_zca()\n            config.begin()\n            sm = getSiteManager()\n            self.assertEqual(sm, config.registry)\n        finally:\n            getSiteManager.reset()\n\n    @skip_on('py3')\n    def test_unhook_zca(self):\n        from zope.component import getSiteManager\n        def foo():\n            '123'\n        try:\n            getSiteManager.sethook(foo)\n            config = self._makeOne()\n            config.unhook_zca()\n            sm = getSiteManager()\n            self.assertNotEqual(sm, '123')\n        finally:\n            getSiteManager.reset()\n\n    def test_commit_conflict_simple(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        config.add_view(view1)\n        config.add_view(view2)\n        self.assertRaises(ConfigurationConflictError, config.commit)\n\n    def test_commit_conflict_resolved_with_include(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        def includeme(config):\n            config.add_view(view2)\n        config.add_view(view1)\n        config.include(includeme)\n        config.commit()\n        registeredview = self._getViewCallable(config)\n        self.assertEqual(registeredview.__name__, 'view1')\n\n    def test_commit_conflict_with_two_includes(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        def includeme1(config):\n            config.add_view(view1)\n        def includeme2(config):\n            config.add_view(view2)\n        config.include(includeme1)\n        config.include(includeme2)\n        try:\n            config.commit()\n        except ConfigurationConflictError as why:\n            c1, c2 = _conflictFunctions(why)\n            self.assertEqual(c1, 'includeme1')\n            self.assertEqual(c2, 'includeme2')\n        else: #pragma: no cover\n            raise AssertionError\n\n    def test_commit_conflict_resolved_with_two_includes_and_local(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        def view3(request): pass\n        def includeme1(config):\n            config.add_view(view1)\n        def includeme2(config):\n            config.add_view(view2)\n        config.include(includeme1)\n        config.include(includeme2)\n        config.add_view(view3)\n        config.commit()\n        registeredview = self._getViewCallable(config)\n        self.assertEqual(registeredview.__name__, 'view3')\n\n    def test_autocommit_no_conflicts(self):\n        from pyramid.renderers import null_renderer\n        config = self._makeOne(autocommit=True)\n        def view1(request): pass\n        def view2(request): pass\n        def view3(request): pass\n        config.add_view(view1, renderer=null_renderer)\n        config.add_view(view2, renderer=null_renderer)\n        config.add_view(view3, renderer=null_renderer)\n        config.commit()\n        registeredview = self._getViewCallable(config)\n        self.assertEqual(registeredview.__name__, 'view3')\n\n    def test_conflict_set_notfound_view(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        config.set_notfound_view(view1)\n        config.set_notfound_view(view2)\n        try:\n            config.commit()\n        except ConfigurationConflictError as why:\n            c1, c2 = _conflictFunctions(why)\n            self.assertEqual(c1, 'test_conflict_set_notfound_view')\n            self.assertEqual(c2, 'test_conflict_set_notfound_view')\n        else: # pragma: no cover\n            raise AssertionError\n\n    def test_conflict_set_forbidden_view(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        config.set_forbidden_view(view1)\n        config.set_forbidden_view(view2)\n        try:\n            config.commit()\n        except ConfigurationConflictError as why:\n            c1, c2 = _conflictFunctions(why)\n            self.assertEqual(c1, 'test_conflict_set_forbidden_view')\n            self.assertEqual(c2, 'test_conflict_set_forbidden_view')\n        else: # pragma: no cover\n            raise AssertionError\n\n    def test___getattr__missing_when_directives_exist(self):\n        config = self._makeOne()\n        directives = {}\n        config.registry._directives = directives\n        self.assertRaises(AttributeError, config.__getattr__, 'wontexist')\n\n    def test___getattr__missing_when_directives_dont_exist(self):\n        config = self._makeOne()\n        self.assertRaises(AttributeError, config.__getattr__, 'wontexist')\n\n    def test___getattr__matches(self):\n        config = self._makeOne()\n        def foo(config): pass\n        directives = {'foo':(foo, True)}\n        config.registry._directives = directives\n        foo_meth = config.foo\n        self.assertTrue(getattr(foo_meth, im_func).__docobj__ is foo)\n\n    def test___getattr__matches_no_action_wrap(self):\n        config = self._makeOne()\n        def foo(config): pass\n        directives = {'foo':(foo, False)}\n        config.registry._directives = directives\n        foo_meth = config.foo\n        self.assertTrue(getattr(foo_meth, im_func) is foo)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 820,
                            "end_lineno": 828,
                            "parent": {
                                "file_name": "pyramid/tests/test_config/test_init.py",
                                "type": "class",
                                "name": "ConfiguratorTests",
                                "content": "class ConfiguratorTests(unittest.TestCase):\n    def _makeOne(self, *arg, **kw):\n        from pyramid.config import Configurator\n        config = Configurator(*arg, **kw)\n        return config\n\n    def _getViewCallable(self, config, ctx_iface=None, request_iface=None,\n                         name='', exception_view=False):\n        from zope.interface import Interface\n        from pyramid.interfaces import IRequest\n        from pyramid.interfaces import IView\n        from pyramid.interfaces import IViewClassifier\n        from pyramid.interfaces import IExceptionViewClassifier\n        if exception_view: # pragma: no cover\n            classifier = IExceptionViewClassifier\n        else:\n            classifier = IViewClassifier\n        if ctx_iface is None:\n            ctx_iface = Interface\n        if request_iface is None:\n            request_iface = IRequest\n        return config.registry.adapters.lookup(\n            (classifier, request_iface, ctx_iface), IView, name=name,\n            default=None)\n\n    def _registerEventListener(self, config, event_iface=None):\n        if event_iface is None: # pragma: no cover\n            from zope.interface import Interface\n            event_iface = Interface\n        L = []\n        def subscriber(*event):\n            L.extend(event)\n        config.registry.registerHandler(subscriber, (event_iface,))\n        return L\n\n    def _makeRequest(self, config):\n        request = DummyRequest()\n        request.registry = config.registry\n        return request\n\n    def test_ctor_no_registry(self):\n        import sys\n        from pyramid.interfaces import ISettings\n        from pyramid.config import Configurator\n        from pyramid.interfaces import IRendererFactory\n        config = Configurator()\n        this_pkg = sys.modules['pyramid.tests.test_config']\n        self.assertTrue(config.registry.getUtility(ISettings))\n        self.assertEqual(config.package, this_pkg)\n        config.commit()\n        self.assertTrue(config.registry.getUtility(IRendererFactory, 'json'))\n        self.assertTrue(config.registry.getUtility(IRendererFactory, 'string'))\n\n    def test_begin(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        config.manager = manager\n        config.begin()\n        self.assertEqual(manager.pushed,\n                         {'registry':config.registry, 'request':None})\n        self.assertEqual(manager.popped, False)\n\n    def test_begin_with_request(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        request = object()\n        manager = DummyThreadLocalManager()\n        config.manager = manager\n        config.begin(request=request)\n        self.assertEqual(manager.pushed,\n                         {'registry':config.registry, 'request':request})\n        self.assertEqual(manager.popped, False)\n\n    def test_begin_overrides_request(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        req = object()\n        # set it up for auto-propagation\n        pushed = {'registry': config.registry, 'request': None}\n        manager.pushed = pushed\n        config.manager = manager\n        config.begin(req)\n        self.assertTrue(manager.pushed is not pushed)\n        self.assertEqual(manager.pushed['request'], req)\n        self.assertEqual(manager.pushed['registry'], config.registry)\n\n    def test_begin_propagates_request_for_same_registry(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        req = object()\n        pushed = {'registry': config.registry, 'request': req}\n        manager.pushed = pushed\n        config.manager = manager\n        config.begin()\n        self.assertTrue(manager.pushed is not pushed)\n        self.assertEqual(manager.pushed['request'], req)\n        self.assertEqual(manager.pushed['registry'], config.registry)\n\n    def test_begin_does_not_propagate_request_for_diff_registry(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        req = object()\n        pushed = {'registry': object(), 'request': req}\n        manager.pushed = pushed\n        config.manager = manager\n        config.begin()\n        self.assertTrue(manager.pushed is not pushed)\n        self.assertEqual(manager.pushed['request'], None)\n        self.assertEqual(manager.pushed['registry'], config.registry)\n\n    def test_end(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        pushed = manager.pushed\n        config.manager = manager\n        config.end()\n        self.assertEqual(manager.pushed, pushed)\n        self.assertEqual(manager.popped, True)\n\n    def test_ctor_with_package_registry(self):\n        import sys\n        from pyramid.config import Configurator\n        pkg = sys.modules['pyramid']\n        config = Configurator(package=pkg)\n        self.assertEqual(config.package, pkg)\n\n    def test_ctor_noreg_custom_settings(self):\n        from pyramid.interfaces import ISettings\n        settings = {'reload_templates':True,\n                    'mysetting':True}\n        config = self._makeOne(settings=settings)\n        settings = config.registry.getUtility(ISettings)\n        self.assertEqual(settings['reload_templates'], True)\n        self.assertEqual(settings['debug_authorization'], False)\n        self.assertEqual(settings['mysetting'], True)\n\n    def test_ctor_noreg_debug_logger_None_default(self):\n        from pyramid.interfaces import IDebugLogger\n        config = self._makeOne()\n        logger = config.registry.getUtility(IDebugLogger)\n        self.assertEqual(logger.name, 'pyramid.tests.test_config')\n\n    def test_ctor_noreg_debug_logger_non_None(self):\n        from pyramid.interfaces import IDebugLogger\n        logger = object()\n        config = self._makeOne(debug_logger=logger)\n        result = config.registry.getUtility(IDebugLogger)\n        self.assertEqual(logger, result)\n\n    def test_ctor_authentication_policy(self):\n        from pyramid.interfaces import IAuthenticationPolicy\n        policy = object()\n        config = self._makeOne(authentication_policy=policy)\n        config.commit()\n        result = config.registry.getUtility(IAuthenticationPolicy)\n        self.assertEqual(policy, result)\n\n    def test_ctor_authorization_policy_only(self):\n        policy = object()\n        config = self._makeOne(authorization_policy=policy)\n        self.assertRaises(ConfigurationExecutionError, config.commit)\n\n    def test_ctor_no_root_factory(self):\n        from pyramid.interfaces import IRootFactory\n        config = self._makeOne()\n        self.assertEqual(config.registry.queryUtility(IRootFactory), None)\n        config.commit()\n        self.assertEqual(config.registry.queryUtility(IRootFactory), None)\n\n    def test_ctor_with_root_factory(self):\n        from pyramid.interfaces import IRootFactory\n        factory = object()\n        config = self._makeOne(root_factory=factory)\n        self.assertEqual(config.registry.queryUtility(IRootFactory), None)\n        config.commit()\n        self.assertEqual(config.registry.queryUtility(IRootFactory), factory)\n\n    def test_ctor_alternate_renderers(self):\n        from pyramid.interfaces import IRendererFactory\n        renderer = object()\n        config = self._makeOne(renderers=[('yeah', renderer)])\n        config.commit()\n        self.assertEqual(config.registry.getUtility(IRendererFactory, 'yeah'),\n                         renderer)\n\n    def test_ctor_default_renderers(self):\n        from pyramid.interfaces import IRendererFactory\n        from pyramid.renderers import json_renderer_factory\n        config = self._makeOne()\n        self.assertEqual(config.registry.getUtility(IRendererFactory, 'json'),\n                         json_renderer_factory)\n\n    def test_ctor_default_permission(self):\n        from pyramid.interfaces import IDefaultPermission\n        config = self._makeOne(default_permission='view')\n        config.commit()\n        self.assertEqual(config.registry.getUtility(IDefaultPermission), 'view')\n\n    def test_ctor_session_factory(self):\n        from pyramid.interfaces import ISessionFactory\n        factory = object()\n        config = self._makeOne(session_factory=factory)\n        self.assertEqual(config.registry.queryUtility(ISessionFactory), None)\n        config.commit()\n        self.assertEqual(config.registry.getUtility(ISessionFactory), factory)\n\n    def test_ctor_default_view_mapper(self):\n        from pyramid.interfaces import IViewMapperFactory\n        mapper = object()\n        config = self._makeOne(default_view_mapper=mapper)\n        config.commit()\n        self.assertEqual(config.registry.getUtility(IViewMapperFactory),\n                         mapper)\n\n    def test_ctor_httpexception_view_default(self):\n        from pyramid.interfaces import IExceptionResponse\n        from pyramid.httpexceptions import default_exceptionresponse_view\n        from pyramid.interfaces import IRequest\n        config = self._makeOne()\n        view = self._getViewCallable(config,\n                                     ctx_iface=IExceptionResponse,\n                                     request_iface=IRequest)\n        self.assertTrue(view.__wraps__ is default_exceptionresponse_view)\n\n    def test_ctor_exceptionresponse_view_None(self):\n        from pyramid.interfaces import IExceptionResponse\n        from pyramid.interfaces import IRequest\n        config = self._makeOne(exceptionresponse_view=None)\n        view = self._getViewCallable(config,\n                                     ctx_iface=IExceptionResponse,\n                                     request_iface=IRequest)\n        self.assertTrue(view is None)\n\n    def test_ctor_exceptionresponse_view_custom(self):\n        from pyramid.interfaces import IExceptionResponse\n        from pyramid.interfaces import IRequest\n        def exceptionresponse_view(context, request): pass\n        config = self._makeOne(exceptionresponse_view=exceptionresponse_view)\n        view = self._getViewCallable(config,\n                                     ctx_iface=IExceptionResponse,\n                                     request_iface=IRequest)\n        self.assertTrue(view.__wraps__ is exceptionresponse_view)\n\n    def test_ctor_with_introspection(self):\n        config = self._makeOne(introspection=False)\n        self.assertEqual(config.introspection, False)\n\n    def test_ctor_default_webob_response_adapter_registered(self):\n        from webob import Response as WebobResponse\n        response = WebobResponse()\n        from pyramid.interfaces import IResponse\n        config = self._makeOne(autocommit=True)\n        result = config.registry.queryAdapter(response, IResponse)\n        self.assertEqual(result, response)\n        \n    def test_with_package_module(self):\n        from pyramid.tests.test_config import test_init\n        import pyramid.tests\n        config = self._makeOne()\n        newconfig = config.with_package(test_init)\n        self.assertEqual(newconfig.package, pyramid.tests.test_config)\n\n    def test_with_package_package(self):\n        import pyramid.tests.test_config\n        config = self._makeOne()\n        newconfig = config.with_package(pyramid.tests.test_config)\n        self.assertEqual(newconfig.package, pyramid.tests.test_config)\n\n    def test_with_package(self):\n        import pyramid.tests\n        config = self._makeOne()\n        config.basepath = 'basepath'\n        config.info = 'info'\n        config.includepath = ('spec',)\n        config.autocommit = True\n        config.route_prefix = 'prefix'\n        newconfig = config.with_package(pyramid.tests)\n        self.assertEqual(newconfig.package, pyramid.tests)\n        self.assertEqual(newconfig.registry, config.registry)\n        self.assertEqual(newconfig.autocommit, True)\n        self.assertEqual(newconfig.route_prefix, 'prefix')\n        self.assertEqual(newconfig.info, 'info')\n        self.assertEqual(newconfig.basepath, 'basepath')\n        self.assertEqual(newconfig.includepath, ('spec',))\n\n    def test_maybe_dotted_string_success(self):\n        import pyramid.tests.test_config\n        config = self._makeOne()\n        result = config.maybe_dotted('pyramid.tests.test_config')\n        self.assertEqual(result, pyramid.tests.test_config)\n\n    def test_maybe_dotted_string_fail(self):\n        config = self._makeOne()\n        self.assertRaises(ImportError, config.maybe_dotted, 'cant.be.found')\n\n    def test_maybe_dotted_notstring_success(self):\n        import pyramid.tests.test_config\n        config = self._makeOne()\n        result = config.maybe_dotted(pyramid.tests.test_config)\n        self.assertEqual(result, pyramid.tests.test_config)\n\n    def test_absolute_asset_spec_already_absolute(self):\n        import pyramid.tests.test_config\n        config = self._makeOne(package=pyramid.tests.test_config)\n        result = config.absolute_asset_spec('already:absolute')\n        self.assertEqual(result, 'already:absolute')\n\n    def test_absolute_asset_spec_notastring(self):\n        import pyramid.tests.test_config\n        config = self._makeOne(package=pyramid.tests.test_config)\n        result = config.absolute_asset_spec(None)\n        self.assertEqual(result, None)\n\n    def test_absolute_asset_spec_relative(self):\n        import pyramid.tests.test_config\n        config = self._makeOne(package=pyramid.tests.test_config)\n        result = config.absolute_asset_spec('files')\n        self.assertEqual(result, 'pyramid.tests.test_config:files')\n\n    def test__fix_registry_has_listeners(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config._fix_registry()\n        self.assertEqual(reg.has_listeners, True)\n\n    def test__fix_registry_notify(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config._fix_registry()\n        self.assertEqual(reg.notify(1), None)\n        self.assertEqual(reg.events, (1,))\n\n    def test__fix_registry_queryAdapterOrSelf(self):\n        from zope.interface import Interface\n        from zope.interface import implementer\n        class IFoo(Interface):\n            pass\n        @implementer(IFoo)\n        class Foo(object):\n            pass\n        class Bar(object):\n            pass\n        adaptation = ()\n        foo = Foo()\n        bar = Bar()\n        reg = DummyRegistry(adaptation)\n        config = self._makeOne(reg)\n        config._fix_registry()\n        self.assertTrue(reg.queryAdapterOrSelf(foo, IFoo) is foo)\n        self.assertTrue(reg.queryAdapterOrSelf(bar, IFoo) is adaptation)\n\n    def test__fix_registry_registerSelfAdapter(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config._fix_registry()\n        reg.registerSelfAdapter('required', 'provided', name='abc')\n        self.assertEqual(len(reg.adapters), 1)\n        args, kw = reg.adapters[0]\n        self.assertEqual(args[0]('abc'), 'abc')\n        self.assertEqual(kw,\n                         {'info': '', 'provided': 'provided',\n                          'required': 'required', 'name': 'abc', 'event': True})\n\n    def test__fix_registry_adds__lock(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config._fix_registry()\n        self.assertTrue(hasattr(reg, '_lock'))\n\n    def test__fix_registry_adds_clear_view_lookup_cache(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        self.assertFalse(hasattr(reg, '_clear_view_lookup_cache'))\n        config._fix_registry()\n        self.assertFalse(hasattr(reg, '_view_lookup_cache'))\n        reg._clear_view_lookup_cache()\n        self.assertEqual(reg._view_lookup_cache, {})\n\n    def test_setup_registry_calls_fix_registry(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config.add_view = lambda *arg, **kw: False\n        config._add_tween = lambda *arg, **kw: False\n        config.setup_registry()\n        self.assertEqual(reg.has_listeners, True)\n\n    def test_setup_registry_registers_default_exceptionresponse_views(self):\n        from webob.exc import WSGIHTTPException\n        from pyramid.interfaces import IExceptionResponse\n        from pyramid.view import default_exceptionresponse_view\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        views = []\n        config.add_view = lambda *arg, **kw: views.append((arg, kw))\n        config.add_default_view_predicates = lambda *arg: None\n        config._add_tween = lambda *arg, **kw: False\n        config.setup_registry()\n        self.assertEqual(views[0], ((default_exceptionresponse_view,),\n                                    {'context':IExceptionResponse}))\n        self.assertEqual(views[1], ((default_exceptionresponse_view,),\n                                    {'context':WSGIHTTPException}))\n\n    def test_setup_registry_registers_default_view_predicates(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        vp_called = []\n        config.add_view = lambda *arg, **kw: None\n        config.add_default_view_predicates = lambda *arg: vp_called.append(True)\n        config._add_tween = lambda *arg, **kw: False\n        config.setup_registry()\n        self.assertTrue(vp_called)\n\n    def test_setup_registry_registers_default_webob_iresponse_adapter(self):\n        from webob import Response\n        from pyramid.interfaces import IResponse\n        config = self._makeOne()\n        config.setup_registry()\n        response = Response()\n        self.assertTrue(\n            config.registry.queryAdapter(response, IResponse) is response)\n\n    def test_setup_registry_explicit_notfound_trumps_iexceptionresponse(self):\n        from pyramid.renderers import null_renderer\n        from zope.interface import implementedBy\n        from pyramid.interfaces import IRequest\n        from pyramid.httpexceptions import HTTPNotFound\n        from pyramid.registry import Registry\n        reg = Registry()\n        config = self._makeOne(reg, autocommit=True)\n        config.setup_registry() # registers IExceptionResponse default view\n        def myview(context, request):\n            return 'OK'\n        config.add_view(myview, context=HTTPNotFound, renderer=null_renderer)\n        request = self._makeRequest(config)\n        view = self._getViewCallable(config,\n                                     ctx_iface=implementedBy(HTTPNotFound),\n                                     request_iface=IRequest)\n        result = view(None, request)\n        self.assertEqual(result, 'OK')\n\n    def test_setup_registry_custom_settings(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import ISettings\n        settings = {'reload_templates':True,\n                    'mysetting':True}\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(settings=settings)\n        settings = reg.getUtility(ISettings)\n        self.assertEqual(settings['reload_templates'], True)\n        self.assertEqual(settings['debug_authorization'], False)\n        self.assertEqual(settings['mysetting'], True)\n\n    def test_setup_registry_debug_logger_None_default(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDebugLogger\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry()\n        logger = reg.getUtility(IDebugLogger)\n        self.assertEqual(logger.name, 'pyramid.tests.test_config')\n\n    def test_setup_registry_debug_logger_non_None(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDebugLogger\n        logger = object()\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(debug_logger=logger)\n        result = reg.getUtility(IDebugLogger)\n        self.assertEqual(logger, result)\n\n    def test_setup_registry_debug_logger_name(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDebugLogger\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(debug_logger='foo')\n        result = reg.getUtility(IDebugLogger)\n        self.assertEqual(result.name, 'foo')\n\n    def test_setup_registry_authentication_policy(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IAuthenticationPolicy\n        policy = object()\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(authentication_policy=policy)\n        config.commit()\n        result = reg.getUtility(IAuthenticationPolicy)\n        self.assertEqual(policy, result)\n\n    def test_setup_registry_authentication_policy_dottedname(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IAuthenticationPolicy\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(authentication_policy='pyramid.tests.test_config')\n        config.commit()\n        result = reg.getUtility(IAuthenticationPolicy)\n        import pyramid.tests.test_config\n        self.assertEqual(result, pyramid.tests.test_config)\n\n    def test_setup_registry_authorization_policy_dottedname(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IAuthorizationPolicy\n        reg = Registry()\n        config = self._makeOne(reg)\n        dummy = object()\n        config.setup_registry(authentication_policy=dummy,\n                              authorization_policy='pyramid.tests.test_config')\n        config.commit()\n        result = reg.getUtility(IAuthorizationPolicy)\n        import pyramid.tests.test_config\n        self.assertEqual(result, pyramid.tests.test_config)\n\n    def test_setup_registry_authorization_policy_only(self):\n        from pyramid.registry import Registry\n        policy = object()\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(authorization_policy=policy)\n        config = self.assertRaises(ConfigurationExecutionError, config.commit)\n\n    def test_setup_registry_no_default_root_factory(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRootFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry()\n        config.commit()\n        self.assertEqual(reg.queryUtility(IRootFactory), None)\n\n    def test_setup_registry_dottedname_root_factory(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRootFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        import pyramid.tests.test_config\n        config.setup_registry(root_factory='pyramid.tests.test_config')\n        self.assertEqual(reg.queryUtility(IRootFactory), None)\n        config.commit()\n        self.assertEqual(reg.getUtility(IRootFactory),\n                         pyramid.tests.test_config)\n\n    def test_setup_registry_locale_negotiator_dottedname(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import ILocaleNegotiator\n        reg = Registry()\n        config = self._makeOne(reg)\n        import pyramid.tests.test_config\n        config.setup_registry(locale_negotiator='pyramid.tests.test_config')\n        self.assertEqual(reg.queryUtility(ILocaleNegotiator), None)\n        config.commit()\n        utility = reg.getUtility(ILocaleNegotiator)\n        self.assertEqual(utility, pyramid.tests.test_config)\n\n    def test_setup_registry_locale_negotiator(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import ILocaleNegotiator\n        reg = Registry()\n        config = self._makeOne(reg)\n        negotiator = object()\n        config.setup_registry(locale_negotiator=negotiator)\n        self.assertEqual(reg.queryUtility(ILocaleNegotiator), None)\n        config.commit()\n        utility = reg.getUtility(ILocaleNegotiator)\n        self.assertEqual(utility, negotiator)\n\n    def test_setup_registry_request_factory(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRequestFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        factory = object()\n        config.setup_registry(request_factory=factory)\n        self.assertEqual(reg.queryUtility(IRequestFactory), None)\n        config.commit()\n        utility = reg.getUtility(IRequestFactory)\n        self.assertEqual(utility, factory)\n\n    def test_setup_registry_response_factory(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IResponseFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        factory = lambda r: object()\n        config.setup_registry(response_factory=factory)\n        self.assertEqual(reg.queryUtility(IResponseFactory), None)\n        config.commit()\n        utility = reg.getUtility(IResponseFactory)\n        self.assertEqual(utility, factory)\n\n    def test_setup_registry_request_factory_dottedname(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRequestFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        import pyramid.tests.test_config\n        config.setup_registry(request_factory='pyramid.tests.test_config')\n        self.assertEqual(reg.queryUtility(IRequestFactory), None)\n        config.commit()\n        utility = reg.getUtility(IRequestFactory)\n        self.assertEqual(utility, pyramid.tests.test_config)\n\n    def test_setup_registry_alternate_renderers(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRendererFactory\n        renderer = object()\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(renderers=[('yeah', renderer)])\n        config.commit()\n        self.assertEqual(reg.getUtility(IRendererFactory, 'yeah'),\n                         renderer)\n\n    def test_setup_registry_default_permission(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDefaultPermission\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(default_permission='view')\n        config.commit()\n        self.assertEqual(reg.getUtility(IDefaultPermission), 'view')\n\n    def test_setup_registry_includes(self):\n        from pyramid.registry import Registry\n        reg = Registry()\n        config = self._makeOne(reg)\n        settings = {\n            'pyramid.includes':\n\"\"\"pyramid.tests.test_config.dummy_include\npyramid.tests.test_config.dummy_include2\"\"\",\n        }\n        config.setup_registry(settings=settings)\n        self.assertTrue(reg.included)\n        self.assertTrue(reg.also_included)\n\n    def test_setup_registry_includes_spaces(self):\n        from pyramid.registry import Registry\n        reg = Registry()\n        config = self._makeOne(reg)\n        settings = {\n            'pyramid.includes':\n\"\"\"pyramid.tests.test_config.dummy_include pyramid.tests.test_config.dummy_include2\"\"\",\n        }\n        config.setup_registry(settings=settings)\n        self.assertTrue(reg.included)\n        self.assertTrue(reg.also_included)\n\n    def test_setup_registry_tweens(self):\n        from pyramid.interfaces import ITweens\n        from pyramid.registry import Registry\n        reg = Registry()\n        config = self._makeOne(reg)\n        settings = {\n            'pyramid.tweens':\n                    'pyramid.tests.test_config.dummy_tween_factory'\n        }\n        config.setup_registry(settings=settings)\n        config.commit()\n        tweens = config.registry.getUtility(ITweens)\n        self.assertEqual(\n            tweens.explicit,\n            [('pyramid.tests.test_config.dummy_tween_factory',\n              dummy_tween_factory)])\n\n    def test_introspector_decorator(self):\n        inst = self._makeOne()\n        default = inst.introspector\n        self.assertTrue(hasattr(default, 'add'))\n        self.assertEqual(inst.introspector, inst.registry.introspector)\n        introspector = object()\n        inst.introspector = introspector\n        new = inst.introspector\n        self.assertTrue(new is introspector)\n        self.assertEqual(inst.introspector, inst.registry.introspector)\n        del inst.introspector\n        default = inst.introspector\n        self.assertFalse(default is new)\n        self.assertTrue(hasattr(default, 'add'))\n\n    def test_make_wsgi_app(self):\n        import pyramid.config\n        from pyramid.router import Router\n        from pyramid.interfaces import IApplicationCreated\n        manager = DummyThreadLocalManager()\n        config = self._makeOne()\n        subscriber = self._registerEventListener(config, IApplicationCreated)\n        config.manager = manager\n        app = config.make_wsgi_app()\n        self.assertEqual(app.__class__, Router)\n        self.assertEqual(manager.pushed['registry'], config.registry)\n        self.assertEqual(manager.pushed['request'], None)\n        self.assertTrue(manager.popped)\n        self.assertEqual(pyramid.config.global_registries.last, app.registry)\n        self.assertEqual(len(subscriber), 1)\n        self.assertTrue(IApplicationCreated.providedBy(subscriber[0]))\n        pyramid.config.global_registries.empty()\n\n    def test_include_with_dotted_name(self):\n        from pyramid.tests import test_config\n        config = self._makeOne()\n        config.include('pyramid.tests.test_config.dummy_include')\n        after = config.action_state\n        actions = after.actions\n        self.assertEqual(len(actions), 1)\n        action = after.actions[0]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_include_with_python_callable(self):\n        from pyramid.tests import test_config\n        config = self._makeOne()\n        config.include(dummy_include)\n        after = config.action_state\n        actions = after.actions\n        self.assertEqual(len(actions), 1)\n        action = actions[0]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_include_with_module_defaults_to_includeme(self):\n        from pyramid.tests import test_config\n        config = self._makeOne()\n        config.include('pyramid.tests.test_config')\n        after = config.action_state\n        actions = after.actions\n        self.assertEqual(len(actions), 1)\n        action = actions[0]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_include_with_module_defaults_to_includeme_missing(self):\n        from pyramid.exceptions import ConfigurationError\n        config = self._makeOne()\n        self.assertRaises(ConfigurationError, config.include, 'pyramid.tests')\n\n    def test_include_with_route_prefix(self):\n        root_config = self._makeOne(autocommit=True)\n        def dummy_subapp(config):\n            self.assertEqual(config.route_prefix, 'root')\n        root_config.include(dummy_subapp, route_prefix='root')\n\n    def test_include_with_nested_route_prefix(self):\n        root_config = self._makeOne(autocommit=True, route_prefix='root')\n        def dummy_subapp2(config):\n            self.assertEqual(config.route_prefix, 'root/nested')\n        def dummy_subapp3(config):\n            self.assertEqual(config.route_prefix, 'root/nested/nested2')\n            config.include(dummy_subapp4)\n        def dummy_subapp4(config):\n            self.assertEqual(config.route_prefix, 'root/nested/nested2')\n        def dummy_subapp(config):\n            self.assertEqual(config.route_prefix, 'root/nested')\n            config.include(dummy_subapp2)\n            config.include(dummy_subapp3, route_prefix='nested2')\n\n        root_config.include(dummy_subapp, route_prefix='nested')\n\n    def test_include_with_missing_source_file(self):\n        from pyramid.exceptions import ConfigurationError\n        import inspect\n        config = self._makeOne()\n        class DummyInspect(object):\n            def getmodule(self, c):\n                return inspect.getmodule(c)\n            def getsourcefile(self, c):\n                return None\n        config.inspect = DummyInspect()\n        try:\n            config.include('pyramid.tests.test_config.dummy_include')\n        except ConfigurationError as e:\n            self.assertEqual(\n                e.args[0], \n                \"No source file for module 'pyramid.tests.test_config' (.py \"\n                \"file must exist, refusing to use orphan .pyc or .pyo file).\")\n        else: # pragma: no cover\n            raise AssertionError\n\n    def test_include_constant_root_package(self):\n        from pyramid import tests\n        from pyramid.tests import test_config\n        config = self._makeOne(root_package=tests)\n        results = {}\n        def include(config):\n            results['package'] = config.package\n            results['root_package'] = config.root_package\n        config.include(include)\n        self.assertEqual(results['root_package'], tests)\n        self.assertEqual(results['package'], test_config)\n\n    def test_include_threadlocals_active(self):\n        from pyramid.tests import test_config\n        from pyramid.threadlocal import get_current_registry\n        stack = []\n        def include(config):\n            stack.append(get_current_registry())\n        config = self._makeOne()\n        config.include(include)\n        self.assertTrue(stack[0] is config.registry)\n\n    def test_action_branching_kw_is_None(self):\n        config = self._makeOne(autocommit=True)\n        self.assertEqual(config.action('discrim'), None)\n\n    def test_action_branching_kw_is_not_None(self):\n        config = self._makeOne(autocommit=True)\n        self.assertEqual(config.action('discrim', kw={'a':1}), None)\n\n    def test_action_autocommit_with_introspectables(self):\n        from pyramid.util import ActionInfo\n        config = self._makeOne(autocommit=True)\n        intr = DummyIntrospectable()\n        config.action('discrim', introspectables=(intr,))\n        self.assertEqual(len(intr.registered), 1)\n        self.assertEqual(intr.registered[0][0], config.introspector)\n        self.assertEqual(intr.registered[0][1].__class__, ActionInfo)\n\n    def test_action_autocommit_with_introspectables_introspection_off(self):\n        config = self._makeOne(autocommit=True)\n        config.introspection = False\n        intr = DummyIntrospectable()\n        config.action('discrim', introspectables=(intr,))\n        self.assertEqual(len(intr.registered), 0)\n        \n    def test_action_branching_nonautocommit_with_config_info(self):\n        config = self._makeOne(autocommit=False)\n        config.info = 'abc'\n        state = DummyActionState()\n        state.autocommit = False\n        config.action_state = state\n        config.action('discrim', kw={'a':1})\n        self.assertEqual(\n            state.actions,\n            [((),\n             {'args': (),\n             'callable': None,\n             'discriminator': 'discrim',\n             'includepath': (),\n             'info': 'abc',\n             'introspectables': (),\n             'kw': {'a': 1},\n             'order': 0})])\n\n    def test_action_branching_nonautocommit_without_config_info(self):\n        config = self._makeOne(autocommit=False)\n        config.info = ''\n        config._ainfo = ['z']\n        state = DummyActionState()\n        config.action_state = state\n        state.autocommit = False\n        config.action('discrim', kw={'a':1})\n        self.assertEqual(\n            state.actions,\n            [((),\n             {'args': (),\n             'callable': None,\n             'discriminator': 'discrim',\n             'includepath': (),\n             'info': 'z',\n             'introspectables': (),\n             'kw': {'a': 1},\n             'order': 0})])\n\n    def test_action_branching_nonautocommit_with_introspectables(self):\n        config = self._makeOne(autocommit=False)\n        config.info = ''\n        config._ainfo = []\n        state = DummyActionState()\n        config.action_state = state\n        state.autocommit = False\n        intr = DummyIntrospectable()\n        config.action('discrim', introspectables=(intr,))\n        self.assertEqual(\n            state.actions[0][1]['introspectables'], (intr,))\n\n    def test_action_nonautocommit_with_introspectables_introspection_off(self):\n        config = self._makeOne(autocommit=False)\n        config.info = ''\n        config._ainfo = []\n        config.introspection = False\n        state = DummyActionState()\n        config.action_state = state\n        state.autocommit = False\n        intr = DummyIntrospectable()\n        config.action('discrim', introspectables=(intr,))\n        self.assertEqual(\n            state.actions[0][1]['introspectables'], ())\n        \n    def test_scan_integration(self):\n        from zope.interface import alsoProvides\n        from pyramid.interfaces import IRequest\n        from pyramid.view import render_view_to_response\n        import pyramid.tests.test_config.pkgs.scannable as package\n        config = self._makeOne(autocommit=True)\n        config.scan(package)\n\n        ctx = DummyContext()\n        req = DummyRequest()\n        alsoProvides(req, IRequest)\n        req.registry = config.registry\n\n        req.method = 'GET'\n        result = render_view_to_response(ctx, req, '')\n        self.assertEqual(result, 'grokked')\n\n        req.method = 'POST'\n        result = render_view_to_response(ctx, req, '')\n        self.assertEqual(result, 'grokked_post')\n\n        result= render_view_to_response(ctx, req, 'grokked_class')\n        self.assertEqual(result, 'grokked_class')\n\n        result= render_view_to_response(ctx, req, 'grokked_instance')\n        self.assertEqual(result, 'grokked_instance')\n\n        result= render_view_to_response(ctx, req, 'oldstyle_grokked_class')\n        self.assertEqual(result, 'oldstyle_grokked_class')\n\n        req.method = 'GET'\n        result = render_view_to_response(ctx, req, 'another')\n        self.assertEqual(result, 'another_grokked')\n\n        req.method = 'POST'\n        result = render_view_to_response(ctx, req, 'another')\n        self.assertEqual(result, 'another_grokked_post')\n\n        result= render_view_to_response(ctx, req, 'another_grokked_class')\n        self.assertEqual(result, 'another_grokked_class')\n\n        result= render_view_to_response(ctx, req, 'another_grokked_instance')\n        self.assertEqual(result, 'another_grokked_instance')\n\n        result= render_view_to_response(ctx, req,\n                                        'another_oldstyle_grokked_class')\n        self.assertEqual(result, 'another_oldstyle_grokked_class')\n\n        result = render_view_to_response(ctx, req, 'stacked1')\n        self.assertEqual(result, 'stacked')\n\n        result = render_view_to_response(ctx, req, 'stacked2')\n        self.assertEqual(result, 'stacked')\n\n        result = render_view_to_response(ctx, req, 'another_stacked1')\n        self.assertEqual(result, 'another_stacked')\n\n        result = render_view_to_response(ctx, req, 'another_stacked2')\n        self.assertEqual(result, 'another_stacked')\n\n        result = render_view_to_response(ctx, req, 'stacked_class1')\n        self.assertEqual(result, 'stacked_class')\n\n        result = render_view_to_response(ctx, req, 'stacked_class2')\n        self.assertEqual(result, 'stacked_class')\n\n        result = render_view_to_response(ctx, req, 'another_stacked_class1')\n        self.assertEqual(result, 'another_stacked_class')\n\n        result = render_view_to_response(ctx, req, 'another_stacked_class2')\n        self.assertEqual(result, 'another_stacked_class')\n\n        # NB: on Jython, a class without an __init__ apparently accepts\n        # any number of arguments without raising a TypeError, so the next\n        # assertion may fail there.  We don't support Jython at the moment,\n        # this is just a note to a future self.\n\n        self.assertRaises(TypeError,\n                          render_view_to_response, ctx, req, 'basemethod')\n\n        result = render_view_to_response(ctx, req, 'method1')\n        self.assertEqual(result, 'method1')\n\n        result = render_view_to_response(ctx, req, 'method2')\n        self.assertEqual(result, 'method2')\n\n        result = render_view_to_response(ctx, req, 'stacked_method1')\n        self.assertEqual(result, 'stacked_method')\n\n        result = render_view_to_response(ctx, req, 'stacked_method2')\n        self.assertEqual(result, 'stacked_method')\n\n        result = render_view_to_response(ctx, req, 'subpackage_init')\n        self.assertEqual(result, 'subpackage_init')\n\n        result = render_view_to_response(ctx, req, 'subpackage_notinit')\n        self.assertEqual(result, 'subpackage_notinit')\n\n        result = render_view_to_response(ctx, req, 'subsubpackage_init')\n        self.assertEqual(result, 'subsubpackage_init')\n\n        result = render_view_to_response(ctx, req, 'pod_notinit')\n        self.assertEqual(result, None)\n\n    def test_scan_integration_with_ignore(self):\n        from zope.interface import alsoProvides\n        from pyramid.interfaces import IRequest\n        from pyramid.view import render_view_to_response\n        import pyramid.tests.test_config.pkgs.scannable as package\n        config = self._makeOne(autocommit=True)\n        config.scan(package, \n                    ignore='pyramid.tests.test_config.pkgs.scannable.another')\n\n        ctx = DummyContext()\n        req = DummyRequest()\n        alsoProvides(req, IRequest)\n        req.registry = config.registry\n\n        req.method = 'GET'\n        result = render_view_to_response(ctx, req, '')\n        self.assertEqual(result, 'grokked')\n\n        # ignored\n        v = render_view_to_response(ctx, req, 'another_stacked_class2')\n        self.assertEqual(v, None)\n        \n    def test_scan_integration_dottedname_package(self):\n        from zope.interface import alsoProvides\n        from pyramid.interfaces import IRequest\n        from pyramid.view import render_view_to_response\n        config = self._makeOne(autocommit=True)\n        config.scan('pyramid.tests.test_config.pkgs.scannable')\n\n        ctx = DummyContext()\n        req = DummyRequest()\n        alsoProvides(req, IRequest)\n        req.registry = config.registry\n\n        req.method = 'GET'\n        result = render_view_to_response(ctx, req, '')\n        self.assertEqual(result, 'grokked')\n\n    def test_scan_integration_with_extra_kw(self):\n        config = self._makeOne(autocommit=True)\n        config.scan('pyramid.tests.test_config.pkgs.scanextrakw', a=1)\n        self.assertEqual(config.a, 1)\n\n    def test_scan_integration_with_onerror(self):\n        # fancy sys.path manipulation here to appease \"setup.py test\" which\n        # fails miserably when it can't import something in the package\n        import sys\n        try:\n            here = os.path.dirname(__file__)\n            path = os.path.join(here, 'path')\n            sys.path.append(path)\n            config = self._makeOne(autocommit=True)\n            class FooException(Exception):\n                pass\n            def onerror(name):\n                raise FooException\n            self.assertRaises(FooException, config.scan, 'scanerror',\n                              onerror=onerror)\n        finally:\n            sys.path.remove(path)\n\n    def test_scan_integration_conflict(self):\n        from pyramid.tests.test_config.pkgs import selfscan\n        from pyramid.config import Configurator\n        c = Configurator()\n        c.scan(selfscan)\n        c.scan(selfscan)\n        try:\n            c.commit()\n        except ConfigurationConflictError as why:\n            def scanconflicts(e):\n                conflicts = e._conflicts.values()\n                for conflict in conflicts:\n                    for confinst in conflict:\n                        yield confinst.src\n            which = list(scanconflicts(why))\n            self.assertEqual(len(which), 4)\n            self.assertTrue(\"@view_config(renderer='string')\" in which)\n            self.assertTrue(\"@view_config(name='two', renderer='string')\" in\n                            which)\n\n    @skip_on('py3')\n    def test_hook_zca(self):\n        from zope.component import getSiteManager\n        def foo():\n            '123'\n        try:\n            config = self._makeOne()\n            config.hook_zca()\n            config.begin()\n            sm = getSiteManager()\n            self.assertEqual(sm, config.registry)\n        finally:\n            getSiteManager.reset()\n\n    @skip_on('py3')\n    def test_unhook_zca(self):\n        from zope.component import getSiteManager\n        def foo():\n            '123'\n        try:\n            getSiteManager.sethook(foo)\n            config = self._makeOne()\n            config.unhook_zca()\n            sm = getSiteManager()\n            self.assertNotEqual(sm, '123')\n        finally:\n            getSiteManager.reset()\n\n    def test_commit_conflict_simple(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        config.add_view(view1)\n        config.add_view(view2)\n        self.assertRaises(ConfigurationConflictError, config.commit)\n\n    def test_commit_conflict_resolved_with_include(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        def includeme(config):\n            config.add_view(view2)\n        config.add_view(view1)\n        config.include(includeme)\n        config.commit()\n        registeredview = self._getViewCallable(config)\n        self.assertEqual(registeredview.__name__, 'view1')\n\n    def test_commit_conflict_with_two_includes(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        def includeme1(config):\n            config.add_view(view1)\n        def includeme2(config):\n            config.add_view(view2)\n        config.include(includeme1)\n        config.include(includeme2)\n        try:\n            config.commit()\n        except ConfigurationConflictError as why:\n            c1, c2 = _conflictFunctions(why)\n            self.assertEqual(c1, 'includeme1')\n            self.assertEqual(c2, 'includeme2')\n        else: #pragma: no cover\n            raise AssertionError\n\n    def test_commit_conflict_resolved_with_two_includes_and_local(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        def view3(request): pass\n        def includeme1(config):\n            config.add_view(view1)\n        def includeme2(config):\n            config.add_view(view2)\n        config.include(includeme1)\n        config.include(includeme2)\n        config.add_view(view3)\n        config.commit()\n        registeredview = self._getViewCallable(config)\n        self.assertEqual(registeredview.__name__, 'view3')\n\n    def test_autocommit_no_conflicts(self):\n        from pyramid.renderers import null_renderer\n        config = self._makeOne(autocommit=True)\n        def view1(request): pass\n        def view2(request): pass\n        def view3(request): pass\n        config.add_view(view1, renderer=null_renderer)\n        config.add_view(view2, renderer=null_renderer)\n        config.add_view(view3, renderer=null_renderer)\n        config.commit()\n        registeredview = self._getViewCallable(config)\n        self.assertEqual(registeredview.__name__, 'view3')\n\n    def test_conflict_set_notfound_view(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        config.set_notfound_view(view1)\n        config.set_notfound_view(view2)\n        try:\n            config.commit()\n        except ConfigurationConflictError as why:\n            c1, c2 = _conflictFunctions(why)\n            self.assertEqual(c1, 'test_conflict_set_notfound_view')\n            self.assertEqual(c2, 'test_conflict_set_notfound_view')\n        else: # pragma: no cover\n            raise AssertionError\n\n    def test_conflict_set_forbidden_view(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        config.set_forbidden_view(view1)\n        config.set_forbidden_view(view2)\n        try:\n            config.commit()\n        except ConfigurationConflictError as why:\n            c1, c2 = _conflictFunctions(why)\n            self.assertEqual(c1, 'test_conflict_set_forbidden_view')\n            self.assertEqual(c2, 'test_conflict_set_forbidden_view')\n        else: # pragma: no cover\n            raise AssertionError\n\n    def test___getattr__missing_when_directives_exist(self):\n        config = self._makeOne()\n        directives = {}\n        config.registry._directives = directives\n        self.assertRaises(AttributeError, config.__getattr__, 'wontexist')\n\n    def test___getattr__missing_when_directives_dont_exist(self):\n        config = self._makeOne()\n        self.assertRaises(AttributeError, config.__getattr__, 'wontexist')\n\n    def test___getattr__matches(self):\n        config = self._makeOne()\n        def foo(config): pass\n        directives = {'foo':(foo, True)}\n        config.registry._directives = directives\n        foo_meth = config.foo\n        self.assertTrue(getattr(foo_meth, im_func).__docobj__ is foo)\n\n    def test___getattr__matches_no_action_wrap(self):\n        config = self._makeOne()\n        def foo(config): pass\n        directives = {'foo':(foo, False)}\n        config.registry._directives = directives\n        foo_meth = config.foo\n        self.assertTrue(getattr(foo_meth, im_func) is foo)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 20,
                                "end_lineno": 1253,
                                "parent": null
                            }
                        }
                    ],
                    "deleted_entities": []
                }
            ]
        }
    ],
    "old_commit_hash": "b536bd9db1c435586c476c6d03e3d314979af3ab^",
    "new_commit_hash": "b536bd9db1c435586c476c6d03e3d314979af3ab",
    "commit_message": "Merge pull request #2989 from mmerickel/threadlocal-include\n\npush threadlocals while executing config.include functions",
    "commit_date": "2017-04-02T16:35:06-05:00",
    "metadata": {}
}
{
    "repo_name": "pyramid",
    "new_commit_hash": "b536bd9db1c435586c476c6d03e3d314979af3ab",
    "test_file_codes": [
        "import unittest\n\nimport os\n\nfrom pyramid.compat import im_func\nfrom pyramid.testing import skip_on\n\nfrom pyramid.tests.test_config import dummy_tween_factory\nfrom pyramid.tests.test_config import dummy_include\nfrom pyramid.tests.test_config import dummy_extend\nfrom pyramid.tests.test_config import dummy_extend2\nfrom pyramid.tests.test_config import IDummy\nfrom pyramid.tests.test_config import DummyContext\n\nfrom pyramid.exceptions import ConfigurationExecutionError\nfrom pyramid.exceptions import ConfigurationConflictError\n\nfrom pyramid.interfaces import IRequest\n\nclass ConfiguratorTests(unittest.TestCase):\n    def _makeOne(self, *arg, **kw):\n        from pyramid.config import Configurator\n        config = Configurator(*arg, **kw)\n        return config\n\n    def _getViewCallable(self, config, ctx_iface=None, request_iface=None,\n                         name='', exception_view=False):\n        from zope.interface import Interface\n        from pyramid.interfaces import IRequest\n        from pyramid.interfaces import IView\n        from pyramid.interfaces import IViewClassifier\n        from pyramid.interfaces import IExceptionViewClassifier\n        if exception_view: # pragma: no cover\n            classifier = IExceptionViewClassifier\n        else:\n            classifier = IViewClassifier\n        if ctx_iface is None:\n            ctx_iface = Interface\n        if request_iface is None:\n            request_iface = IRequest\n        return config.registry.adapters.lookup(\n            (classifier, request_iface, ctx_iface), IView, name=name,\n            default=None)\n\n    def _registerEventListener(self, config, event_iface=None):\n        if event_iface is None: # pragma: no cover\n            from zope.interface import Interface\n            event_iface = Interface\n        L = []\n        def subscriber(*event):\n            L.extend(event)\n        config.registry.registerHandler(subscriber, (event_iface,))\n        return L\n\n    def _makeRequest(self, config):\n        request = DummyRequest()\n        request.registry = config.registry\n        return request\n\n    def test_ctor_no_registry(self):\n        import sys\n        from pyramid.interfaces import ISettings\n        from pyramid.config import Configurator\n        from pyramid.interfaces import IRendererFactory\n        config = Configurator()\n        this_pkg = sys.modules['pyramid.tests.test_config']\n        self.assertTrue(config.registry.getUtility(ISettings))\n        self.assertEqual(config.package, this_pkg)\n        config.commit()\n        self.assertTrue(config.registry.getUtility(IRendererFactory, 'json'))\n        self.assertTrue(config.registry.getUtility(IRendererFactory, 'string'))\n\n    def test_begin(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        config.manager = manager\n        config.begin()\n        self.assertEqual(manager.pushed,\n                         {'registry':config.registry, 'request':None})\n        self.assertEqual(manager.popped, False)\n\n    def test_begin_with_request(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        request = object()\n        manager = DummyThreadLocalManager()\n        config.manager = manager\n        config.begin(request=request)\n        self.assertEqual(manager.pushed,\n                         {'registry':config.registry, 'request':request})\n        self.assertEqual(manager.popped, False)\n\n    def test_begin_overrides_request(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        req = object()\n        # set it up for auto-propagation\n        pushed = {'registry': config.registry, 'request': None}\n        manager.pushed = pushed\n        config.manager = manager\n        config.begin(req)\n        self.assertTrue(manager.pushed is not pushed)\n        self.assertEqual(manager.pushed['request'], req)\n        self.assertEqual(manager.pushed['registry'], config.registry)\n\n    def test_begin_propagates_request_for_same_registry(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        req = object()\n        pushed = {'registry': config.registry, 'request': req}\n        manager.pushed = pushed\n        config.manager = manager\n        config.begin()\n        self.assertTrue(manager.pushed is not pushed)\n        self.assertEqual(manager.pushed['request'], req)\n        self.assertEqual(manager.pushed['registry'], config.registry)\n\n    def test_begin_does_not_propagate_request_for_diff_registry(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        req = object()\n        pushed = {'registry': object(), 'request': req}\n        manager.pushed = pushed\n        config.manager = manager\n        config.begin()\n        self.assertTrue(manager.pushed is not pushed)\n        self.assertEqual(manager.pushed['request'], None)\n        self.assertEqual(manager.pushed['registry'], config.registry)\n\n    def test_end(self):\n        from pyramid.config import Configurator\n        config = Configurator()\n        manager = DummyThreadLocalManager()\n        pushed = manager.pushed\n        config.manager = manager\n        config.end()\n        self.assertEqual(manager.pushed, pushed)\n        self.assertEqual(manager.popped, True)\n\n    def test_ctor_with_package_registry(self):\n        import sys\n        from pyramid.config import Configurator\n        pkg = sys.modules['pyramid']\n        config = Configurator(package=pkg)\n        self.assertEqual(config.package, pkg)\n\n    def test_ctor_noreg_custom_settings(self):\n        from pyramid.interfaces import ISettings\n        settings = {'reload_templates':True,\n                    'mysetting':True}\n        config = self._makeOne(settings=settings)\n        settings = config.registry.getUtility(ISettings)\n        self.assertEqual(settings['reload_templates'], True)\n        self.assertEqual(settings['debug_authorization'], False)\n        self.assertEqual(settings['mysetting'], True)\n\n    def test_ctor_noreg_debug_logger_None_default(self):\n        from pyramid.interfaces import IDebugLogger\n        config = self._makeOne()\n        logger = config.registry.getUtility(IDebugLogger)\n        self.assertEqual(logger.name, 'pyramid.tests.test_config')\n\n    def test_ctor_noreg_debug_logger_non_None(self):\n        from pyramid.interfaces import IDebugLogger\n        logger = object()\n        config = self._makeOne(debug_logger=logger)\n        result = config.registry.getUtility(IDebugLogger)\n        self.assertEqual(logger, result)\n\n    def test_ctor_authentication_policy(self):\n        from pyramid.interfaces import IAuthenticationPolicy\n        policy = object()\n        config = self._makeOne(authentication_policy=policy)\n        config.commit()\n        result = config.registry.getUtility(IAuthenticationPolicy)\n        self.assertEqual(policy, result)\n\n    def test_ctor_authorization_policy_only(self):\n        policy = object()\n        config = self._makeOne(authorization_policy=policy)\n        self.assertRaises(ConfigurationExecutionError, config.commit)\n\n    def test_ctor_no_root_factory(self):\n        from pyramid.interfaces import IRootFactory\n        config = self._makeOne()\n        self.assertEqual(config.registry.queryUtility(IRootFactory), None)\n        config.commit()\n        self.assertEqual(config.registry.queryUtility(IRootFactory), None)\n\n    def test_ctor_with_root_factory(self):\n        from pyramid.interfaces import IRootFactory\n        factory = object()\n        config = self._makeOne(root_factory=factory)\n        self.assertEqual(config.registry.queryUtility(IRootFactory), None)\n        config.commit()\n        self.assertEqual(config.registry.queryUtility(IRootFactory), factory)\n\n    def test_ctor_alternate_renderers(self):\n        from pyramid.interfaces import IRendererFactory\n        renderer = object()\n        config = self._makeOne(renderers=[('yeah', renderer)])\n        config.commit()\n        self.assertEqual(config.registry.getUtility(IRendererFactory, 'yeah'),\n                         renderer)\n\n    def test_ctor_default_renderers(self):\n        from pyramid.interfaces import IRendererFactory\n        from pyramid.renderers import json_renderer_factory\n        config = self._makeOne()\n        self.assertEqual(config.registry.getUtility(IRendererFactory, 'json'),\n                         json_renderer_factory)\n\n    def test_ctor_default_permission(self):\n        from pyramid.interfaces import IDefaultPermission\n        config = self._makeOne(default_permission='view')\n        config.commit()\n        self.assertEqual(config.registry.getUtility(IDefaultPermission), 'view')\n\n    def test_ctor_session_factory(self):\n        from pyramid.interfaces import ISessionFactory\n        factory = object()\n        config = self._makeOne(session_factory=factory)\n        self.assertEqual(config.registry.queryUtility(ISessionFactory), None)\n        config.commit()\n        self.assertEqual(config.registry.getUtility(ISessionFactory), factory)\n\n    def test_ctor_default_view_mapper(self):\n        from pyramid.interfaces import IViewMapperFactory\n        mapper = object()\n        config = self._makeOne(default_view_mapper=mapper)\n        config.commit()\n        self.assertEqual(config.registry.getUtility(IViewMapperFactory),\n                         mapper)\n\n    def test_ctor_httpexception_view_default(self):\n        from pyramid.interfaces import IExceptionResponse\n        from pyramid.httpexceptions import default_exceptionresponse_view\n        from pyramid.interfaces import IRequest\n        config = self._makeOne()\n        view = self._getViewCallable(config,\n                                     ctx_iface=IExceptionResponse,\n                                     request_iface=IRequest)\n        self.assertTrue(view.__wraps__ is default_exceptionresponse_view)\n\n    def test_ctor_exceptionresponse_view_None(self):\n        from pyramid.interfaces import IExceptionResponse\n        from pyramid.interfaces import IRequest\n        config = self._makeOne(exceptionresponse_view=None)\n        view = self._getViewCallable(config,\n                                     ctx_iface=IExceptionResponse,\n                                     request_iface=IRequest)\n        self.assertTrue(view is None)\n\n    def test_ctor_exceptionresponse_view_custom(self):\n        from pyramid.interfaces import IExceptionResponse\n        from pyramid.interfaces import IRequest\n        def exceptionresponse_view(context, request): pass\n        config = self._makeOne(exceptionresponse_view=exceptionresponse_view)\n        view = self._getViewCallable(config,\n                                     ctx_iface=IExceptionResponse,\n                                     request_iface=IRequest)\n        self.assertTrue(view.__wraps__ is exceptionresponse_view)\n\n    def test_ctor_with_introspection(self):\n        config = self._makeOne(introspection=False)\n        self.assertEqual(config.introspection, False)\n\n    def test_ctor_default_webob_response_adapter_registered(self):\n        from webob import Response as WebobResponse\n        response = WebobResponse()\n        from pyramid.interfaces import IResponse\n        config = self._makeOne(autocommit=True)\n        result = config.registry.queryAdapter(response, IResponse)\n        self.assertEqual(result, response)\n        \n    def test_with_package_module(self):\n        from pyramid.tests.test_config import test_init\n        import pyramid.tests\n        config = self._makeOne()\n        newconfig = config.with_package(test_init)\n        self.assertEqual(newconfig.package, pyramid.tests.test_config)\n\n    def test_with_package_package(self):\n        import pyramid.tests.test_config\n        config = self._makeOne()\n        newconfig = config.with_package(pyramid.tests.test_config)\n        self.assertEqual(newconfig.package, pyramid.tests.test_config)\n\n    def test_with_package(self):\n        import pyramid.tests\n        config = self._makeOne()\n        config.basepath = 'basepath'\n        config.info = 'info'\n        config.includepath = ('spec',)\n        config.autocommit = True\n        config.route_prefix = 'prefix'\n        newconfig = config.with_package(pyramid.tests)\n        self.assertEqual(newconfig.package, pyramid.tests)\n        self.assertEqual(newconfig.registry, config.registry)\n        self.assertEqual(newconfig.autocommit, True)\n        self.assertEqual(newconfig.route_prefix, 'prefix')\n        self.assertEqual(newconfig.info, 'info')\n        self.assertEqual(newconfig.basepath, 'basepath')\n        self.assertEqual(newconfig.includepath, ('spec',))\n\n    def test_maybe_dotted_string_success(self):\n        import pyramid.tests.test_config\n        config = self._makeOne()\n        result = config.maybe_dotted('pyramid.tests.test_config')\n        self.assertEqual(result, pyramid.tests.test_config)\n\n    def test_maybe_dotted_string_fail(self):\n        config = self._makeOne()\n        self.assertRaises(ImportError, config.maybe_dotted, 'cant.be.found')\n\n    def test_maybe_dotted_notstring_success(self):\n        import pyramid.tests.test_config\n        config = self._makeOne()\n        result = config.maybe_dotted(pyramid.tests.test_config)\n        self.assertEqual(result, pyramid.tests.test_config)\n\n    def test_absolute_asset_spec_already_absolute(self):\n        import pyramid.tests.test_config\n        config = self._makeOne(package=pyramid.tests.test_config)\n        result = config.absolute_asset_spec('already:absolute')\n        self.assertEqual(result, 'already:absolute')\n\n    def test_absolute_asset_spec_notastring(self):\n        import pyramid.tests.test_config\n        config = self._makeOne(package=pyramid.tests.test_config)\n        result = config.absolute_asset_spec(None)\n        self.assertEqual(result, None)\n\n    def test_absolute_asset_spec_relative(self):\n        import pyramid.tests.test_config\n        config = self._makeOne(package=pyramid.tests.test_config)\n        result = config.absolute_asset_spec('files')\n        self.assertEqual(result, 'pyramid.tests.test_config:files')\n\n    def test__fix_registry_has_listeners(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config._fix_registry()\n        self.assertEqual(reg.has_listeners, True)\n\n    def test__fix_registry_notify(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config._fix_registry()\n        self.assertEqual(reg.notify(1), None)\n        self.assertEqual(reg.events, (1,))\n\n    def test__fix_registry_queryAdapterOrSelf(self):\n        from zope.interface import Interface\n        from zope.interface import implementer\n        class IFoo(Interface):\n            pass\n        @implementer(IFoo)\n        class Foo(object):\n            pass\n        class Bar(object):\n            pass\n        adaptation = ()\n        foo = Foo()\n        bar = Bar()\n        reg = DummyRegistry(adaptation)\n        config = self._makeOne(reg)\n        config._fix_registry()\n        self.assertTrue(reg.queryAdapterOrSelf(foo, IFoo) is foo)\n        self.assertTrue(reg.queryAdapterOrSelf(bar, IFoo) is adaptation)\n\n    def test__fix_registry_registerSelfAdapter(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config._fix_registry()\n        reg.registerSelfAdapter('required', 'provided', name='abc')\n        self.assertEqual(len(reg.adapters), 1)\n        args, kw = reg.adapters[0]\n        self.assertEqual(args[0]('abc'), 'abc')\n        self.assertEqual(kw,\n                         {'info': '', 'provided': 'provided',\n                          'required': 'required', 'name': 'abc', 'event': True})\n\n    def test__fix_registry_adds__lock(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config._fix_registry()\n        self.assertTrue(hasattr(reg, '_lock'))\n\n    def test__fix_registry_adds_clear_view_lookup_cache(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        self.assertFalse(hasattr(reg, '_clear_view_lookup_cache'))\n        config._fix_registry()\n        self.assertFalse(hasattr(reg, '_view_lookup_cache'))\n        reg._clear_view_lookup_cache()\n        self.assertEqual(reg._view_lookup_cache, {})\n\n    def test_setup_registry_calls_fix_registry(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        config.add_view = lambda *arg, **kw: False\n        config._add_tween = lambda *arg, **kw: False\n        config.setup_registry()\n        self.assertEqual(reg.has_listeners, True)\n\n    def test_setup_registry_registers_default_exceptionresponse_views(self):\n        from webob.exc import WSGIHTTPException\n        from pyramid.interfaces import IExceptionResponse\n        from pyramid.view import default_exceptionresponse_view\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        views = []\n        config.add_view = lambda *arg, **kw: views.append((arg, kw))\n        config.add_default_view_predicates = lambda *arg: None\n        config._add_tween = lambda *arg, **kw: False\n        config.setup_registry()\n        self.assertEqual(views[0], ((default_exceptionresponse_view,),\n                                    {'context':IExceptionResponse}))\n        self.assertEqual(views[1], ((default_exceptionresponse_view,),\n                                    {'context':WSGIHTTPException}))\n\n    def test_setup_registry_registers_default_view_predicates(self):\n        reg = DummyRegistry()\n        config = self._makeOne(reg)\n        vp_called = []\n        config.add_view = lambda *arg, **kw: None\n        config.add_default_view_predicates = lambda *arg: vp_called.append(True)\n        config._add_tween = lambda *arg, **kw: False\n        config.setup_registry()\n        self.assertTrue(vp_called)\n\n    def test_setup_registry_registers_default_webob_iresponse_adapter(self):\n        from webob import Response\n        from pyramid.interfaces import IResponse\n        config = self._makeOne()\n        config.setup_registry()\n        response = Response()\n        self.assertTrue(\n            config.registry.queryAdapter(response, IResponse) is response)\n\n    def test_setup_registry_explicit_notfound_trumps_iexceptionresponse(self):\n        from pyramid.renderers import null_renderer\n        from zope.interface import implementedBy\n        from pyramid.interfaces import IRequest\n        from pyramid.httpexceptions import HTTPNotFound\n        from pyramid.registry import Registry\n        reg = Registry()\n        config = self._makeOne(reg, autocommit=True)\n        config.setup_registry() # registers IExceptionResponse default view\n        def myview(context, request):\n            return 'OK'\n        config.add_view(myview, context=HTTPNotFound, renderer=null_renderer)\n        request = self._makeRequest(config)\n        view = self._getViewCallable(config,\n                                     ctx_iface=implementedBy(HTTPNotFound),\n                                     request_iface=IRequest)\n        result = view(None, request)\n        self.assertEqual(result, 'OK')\n\n    def test_setup_registry_custom_settings(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import ISettings\n        settings = {'reload_templates':True,\n                    'mysetting':True}\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(settings=settings)\n        settings = reg.getUtility(ISettings)\n        self.assertEqual(settings['reload_templates'], True)\n        self.assertEqual(settings['debug_authorization'], False)\n        self.assertEqual(settings['mysetting'], True)\n\n    def test_setup_registry_debug_logger_None_default(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDebugLogger\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry()\n        logger = reg.getUtility(IDebugLogger)\n        self.assertEqual(logger.name, 'pyramid.tests.test_config')\n\n    def test_setup_registry_debug_logger_non_None(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDebugLogger\n        logger = object()\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(debug_logger=logger)\n        result = reg.getUtility(IDebugLogger)\n        self.assertEqual(logger, result)\n\n    def test_setup_registry_debug_logger_name(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDebugLogger\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(debug_logger='foo')\n        result = reg.getUtility(IDebugLogger)\n        self.assertEqual(result.name, 'foo')\n\n    def test_setup_registry_authentication_policy(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IAuthenticationPolicy\n        policy = object()\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(authentication_policy=policy)\n        config.commit()\n        result = reg.getUtility(IAuthenticationPolicy)\n        self.assertEqual(policy, result)\n\n    def test_setup_registry_authentication_policy_dottedname(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IAuthenticationPolicy\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(authentication_policy='pyramid.tests.test_config')\n        config.commit()\n        result = reg.getUtility(IAuthenticationPolicy)\n        import pyramid.tests.test_config\n        self.assertEqual(result, pyramid.tests.test_config)\n\n    def test_setup_registry_authorization_policy_dottedname(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IAuthorizationPolicy\n        reg = Registry()\n        config = self._makeOne(reg)\n        dummy = object()\n        config.setup_registry(authentication_policy=dummy,\n                              authorization_policy='pyramid.tests.test_config')\n        config.commit()\n        result = reg.getUtility(IAuthorizationPolicy)\n        import pyramid.tests.test_config\n        self.assertEqual(result, pyramid.tests.test_config)\n\n    def test_setup_registry_authorization_policy_only(self):\n        from pyramid.registry import Registry\n        policy = object()\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(authorization_policy=policy)\n        config = self.assertRaises(ConfigurationExecutionError, config.commit)\n\n    def test_setup_registry_no_default_root_factory(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRootFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry()\n        config.commit()\n        self.assertEqual(reg.queryUtility(IRootFactory), None)\n\n    def test_setup_registry_dottedname_root_factory(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRootFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        import pyramid.tests.test_config\n        config.setup_registry(root_factory='pyramid.tests.test_config')\n        self.assertEqual(reg.queryUtility(IRootFactory), None)\n        config.commit()\n        self.assertEqual(reg.getUtility(IRootFactory),\n                         pyramid.tests.test_config)\n\n    def test_setup_registry_locale_negotiator_dottedname(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import ILocaleNegotiator\n        reg = Registry()\n        config = self._makeOne(reg)\n        import pyramid.tests.test_config\n        config.setup_registry(locale_negotiator='pyramid.tests.test_config')\n        self.assertEqual(reg.queryUtility(ILocaleNegotiator), None)\n        config.commit()\n        utility = reg.getUtility(ILocaleNegotiator)\n        self.assertEqual(utility, pyramid.tests.test_config)\n\n    def test_setup_registry_locale_negotiator(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import ILocaleNegotiator\n        reg = Registry()\n        config = self._makeOne(reg)\n        negotiator = object()\n        config.setup_registry(locale_negotiator=negotiator)\n        self.assertEqual(reg.queryUtility(ILocaleNegotiator), None)\n        config.commit()\n        utility = reg.getUtility(ILocaleNegotiator)\n        self.assertEqual(utility, negotiator)\n\n    def test_setup_registry_request_factory(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRequestFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        factory = object()\n        config.setup_registry(request_factory=factory)\n        self.assertEqual(reg.queryUtility(IRequestFactory), None)\n        config.commit()\n        utility = reg.getUtility(IRequestFactory)\n        self.assertEqual(utility, factory)\n\n    def test_setup_registry_response_factory(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IResponseFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        factory = lambda r: object()\n        config.setup_registry(response_factory=factory)\n        self.assertEqual(reg.queryUtility(IResponseFactory), None)\n        config.commit()\n        utility = reg.getUtility(IResponseFactory)\n        self.assertEqual(utility, factory)\n\n    def test_setup_registry_request_factory_dottedname(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRequestFactory\n        reg = Registry()\n        config = self._makeOne(reg)\n        import pyramid.tests.test_config\n        config.setup_registry(request_factory='pyramid.tests.test_config')\n        self.assertEqual(reg.queryUtility(IRequestFactory), None)\n        config.commit()\n        utility = reg.getUtility(IRequestFactory)\n        self.assertEqual(utility, pyramid.tests.test_config)\n\n    def test_setup_registry_alternate_renderers(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IRendererFactory\n        renderer = object()\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(renderers=[('yeah', renderer)])\n        config.commit()\n        self.assertEqual(reg.getUtility(IRendererFactory, 'yeah'),\n                         renderer)\n\n    def test_setup_registry_default_permission(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDefaultPermission\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry(default_permission='view')\n        config.commit()\n        self.assertEqual(reg.getUtility(IDefaultPermission), 'view')\n\n    def test_setup_registry_includes(self):\n        from pyramid.registry import Registry\n        reg = Registry()\n        config = self._makeOne(reg)\n        settings = {\n            'pyramid.includes':\n\"\"\"pyramid.tests.test_config.dummy_include\npyramid.tests.test_config.dummy_include2\"\"\",\n        }\n        config.setup_registry(settings=settings)\n        self.assertTrue(reg.included)\n        self.assertTrue(reg.also_included)\n\n    def test_setup_registry_includes_spaces(self):\n        from pyramid.registry import Registry\n        reg = Registry()\n        config = self._makeOne(reg)\n        settings = {\n            'pyramid.includes':\n\"\"\"pyramid.tests.test_config.dummy_include pyramid.tests.test_config.dummy_include2\"\"\",\n        }\n        config.setup_registry(settings=settings)\n        self.assertTrue(reg.included)\n        self.assertTrue(reg.also_included)\n\n    def test_setup_registry_tweens(self):\n        from pyramid.interfaces import ITweens\n        from pyramid.registry import Registry\n        reg = Registry()\n        config = self._makeOne(reg)\n        settings = {\n            'pyramid.tweens':\n                    'pyramid.tests.test_config.dummy_tween_factory'\n        }\n        config.setup_registry(settings=settings)\n        config.commit()\n        tweens = config.registry.getUtility(ITweens)\n        self.assertEqual(\n            tweens.explicit,\n            [('pyramid.tests.test_config.dummy_tween_factory',\n              dummy_tween_factory)])\n\n    def test_introspector_decorator(self):\n        inst = self._makeOne()\n        default = inst.introspector\n        self.assertTrue(hasattr(default, 'add'))\n        self.assertEqual(inst.introspector, inst.registry.introspector)\n        introspector = object()\n        inst.introspector = introspector\n        new = inst.introspector\n        self.assertTrue(new is introspector)\n        self.assertEqual(inst.introspector, inst.registry.introspector)\n        del inst.introspector\n        default = inst.introspector\n        self.assertFalse(default is new)\n        self.assertTrue(hasattr(default, 'add'))\n\n    def test_make_wsgi_app(self):\n        import pyramid.config\n        from pyramid.router import Router\n        from pyramid.interfaces import IApplicationCreated\n        manager = DummyThreadLocalManager()\n        config = self._makeOne()\n        subscriber = self._registerEventListener(config, IApplicationCreated)\n        config.manager = manager\n        app = config.make_wsgi_app()\n        self.assertEqual(app.__class__, Router)\n        self.assertEqual(manager.pushed['registry'], config.registry)\n        self.assertEqual(manager.pushed['request'], None)\n        self.assertTrue(manager.popped)\n        self.assertEqual(pyramid.config.global_registries.last, app.registry)\n        self.assertEqual(len(subscriber), 1)\n        self.assertTrue(IApplicationCreated.providedBy(subscriber[0]))\n        pyramid.config.global_registries.empty()\n\n    def test_include_with_dotted_name(self):\n        from pyramid.tests import test_config\n        config = self._makeOne()\n        config.include('pyramid.tests.test_config.dummy_include')\n        after = config.action_state\n        actions = after.actions\n        self.assertEqual(len(actions), 1)\n        action = after.actions[0]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_include_with_python_callable(self):\n        from pyramid.tests import test_config\n        config = self._makeOne()\n        config.include(dummy_include)\n        after = config.action_state\n        actions = after.actions\n        self.assertEqual(len(actions), 1)\n        action = actions[0]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_include_with_module_defaults_to_includeme(self):\n        from pyramid.tests import test_config\n        config = self._makeOne()\n        config.include('pyramid.tests.test_config')\n        after = config.action_state\n        actions = after.actions\n        self.assertEqual(len(actions), 1)\n        action = actions[0]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_include_with_module_defaults_to_includeme_missing(self):\n        from pyramid.exceptions import ConfigurationError\n        config = self._makeOne()\n        self.assertRaises(ConfigurationError, config.include, 'pyramid.tests')\n\n    def test_include_with_route_prefix(self):\n        root_config = self._makeOne(autocommit=True)\n        def dummy_subapp(config):\n            self.assertEqual(config.route_prefix, 'root')\n        root_config.include(dummy_subapp, route_prefix='root')\n\n    def test_include_with_nested_route_prefix(self):\n        root_config = self._makeOne(autocommit=True, route_prefix='root')\n        def dummy_subapp2(config):\n            self.assertEqual(config.route_prefix, 'root/nested')\n        def dummy_subapp3(config):\n            self.assertEqual(config.route_prefix, 'root/nested/nested2')\n            config.include(dummy_subapp4)\n        def dummy_subapp4(config):\n            self.assertEqual(config.route_prefix, 'root/nested/nested2')\n        def dummy_subapp(config):\n            self.assertEqual(config.route_prefix, 'root/nested')\n            config.include(dummy_subapp2)\n            config.include(dummy_subapp3, route_prefix='nested2')\n\n        root_config.include(dummy_subapp, route_prefix='nested')\n\n    def test_include_with_missing_source_file(self):\n        from pyramid.exceptions import ConfigurationError\n        import inspect\n        config = self._makeOne()\n        class DummyInspect(object):\n            def getmodule(self, c):\n                return inspect.getmodule(c)\n            def getsourcefile(self, c):\n                return None\n        config.inspect = DummyInspect()\n        try:\n            config.include('pyramid.tests.test_config.dummy_include')\n        except ConfigurationError as e:\n            self.assertEqual(\n                e.args[0], \n                \"No source file for module 'pyramid.tests.test_config' (.py \"\n                \"file must exist, refusing to use orphan .pyc or .pyo file).\")\n        else: # pragma: no cover\n            raise AssertionError\n\n    def test_include_constant_root_package(self):\n        from pyramid import tests\n        from pyramid.tests import test_config\n        config = self._makeOne(root_package=tests)\n        results = {}\n        def include(config):\n            results['package'] = config.package\n            results['root_package'] = config.root_package\n        config.include(include)\n        self.assertEqual(results['root_package'], tests)\n        self.assertEqual(results['package'], test_config)\n\n    def test_include_threadlocals_active(self):\n        from pyramid.tests import test_config\n        from pyramid.threadlocal import get_current_registry\n        stack = []\n        def include(config):\n            stack.append(get_current_registry())\n        config = self._makeOne()\n        config.include(include)\n        self.assertTrue(stack[0] is config.registry)\n\n    def test_action_branching_kw_is_None(self):\n        config = self._makeOne(autocommit=True)\n        self.assertEqual(config.action('discrim'), None)\n\n    def test_action_branching_kw_is_not_None(self):\n        config = self._makeOne(autocommit=True)\n        self.assertEqual(config.action('discrim', kw={'a':1}), None)\n\n    def test_action_autocommit_with_introspectables(self):\n        from pyramid.util import ActionInfo\n        config = self._makeOne(autocommit=True)\n        intr = DummyIntrospectable()\n        config.action('discrim', introspectables=(intr,))\n        self.assertEqual(len(intr.registered), 1)\n        self.assertEqual(intr.registered[0][0], config.introspector)\n        self.assertEqual(intr.registered[0][1].__class__, ActionInfo)\n\n    def test_action_autocommit_with_introspectables_introspection_off(self):\n        config = self._makeOne(autocommit=True)\n        config.introspection = False\n        intr = DummyIntrospectable()\n        config.action('discrim', introspectables=(intr,))\n        self.assertEqual(len(intr.registered), 0)\n        \n    def test_action_branching_nonautocommit_with_config_info(self):\n        config = self._makeOne(autocommit=False)\n        config.info = 'abc'\n        state = DummyActionState()\n        state.autocommit = False\n        config.action_state = state\n        config.action('discrim', kw={'a':1})\n        self.assertEqual(\n            state.actions,\n            [((),\n             {'args': (),\n             'callable': None,\n             'discriminator': 'discrim',\n             'includepath': (),\n             'info': 'abc',\n             'introspectables': (),\n             'kw': {'a': 1},\n             'order': 0})])\n\n    def test_action_branching_nonautocommit_without_config_info(self):\n        config = self._makeOne(autocommit=False)\n        config.info = ''\n        config._ainfo = ['z']\n        state = DummyActionState()\n        config.action_state = state\n        state.autocommit = False\n        config.action('discrim', kw={'a':1})\n        self.assertEqual(\n            state.actions,\n            [((),\n             {'args': (),\n             'callable': None,\n             'discriminator': 'discrim',\n             'includepath': (),\n             'info': 'z',\n             'introspectables': (),\n             'kw': {'a': 1},\n             'order': 0})])\n\n    def test_action_branching_nonautocommit_with_introspectables(self):\n        config = self._makeOne(autocommit=False)\n        config.info = ''\n        config._ainfo = []\n        state = DummyActionState()\n        config.action_state = state\n        state.autocommit = False\n        intr = DummyIntrospectable()\n        config.action('discrim', introspectables=(intr,))\n        self.assertEqual(\n            state.actions[0][1]['introspectables'], (intr,))\n\n    def test_action_nonautocommit_with_introspectables_introspection_off(self):\n        config = self._makeOne(autocommit=False)\n        config.info = ''\n        config._ainfo = []\n        config.introspection = False\n        state = DummyActionState()\n        config.action_state = state\n        state.autocommit = False\n        intr = DummyIntrospectable()\n        config.action('discrim', introspectables=(intr,))\n        self.assertEqual(\n            state.actions[0][1]['introspectables'], ())\n        \n    def test_scan_integration(self):\n        from zope.interface import alsoProvides\n        from pyramid.interfaces import IRequest\n        from pyramid.view import render_view_to_response\n        import pyramid.tests.test_config.pkgs.scannable as package\n        config = self._makeOne(autocommit=True)\n        config.scan(package)\n\n        ctx = DummyContext()\n        req = DummyRequest()\n        alsoProvides(req, IRequest)\n        req.registry = config.registry\n\n        req.method = 'GET'\n        result = render_view_to_response(ctx, req, '')\n        self.assertEqual(result, 'grokked')\n\n        req.method = 'POST'\n        result = render_view_to_response(ctx, req, '')\n        self.assertEqual(result, 'grokked_post')\n\n        result= render_view_to_response(ctx, req, 'grokked_class')\n        self.assertEqual(result, 'grokked_class')\n\n        result= render_view_to_response(ctx, req, 'grokked_instance')\n        self.assertEqual(result, 'grokked_instance')\n\n        result= render_view_to_response(ctx, req, 'oldstyle_grokked_class')\n        self.assertEqual(result, 'oldstyle_grokked_class')\n\n        req.method = 'GET'\n        result = render_view_to_response(ctx, req, 'another')\n        self.assertEqual(result, 'another_grokked')\n\n        req.method = 'POST'\n        result = render_view_to_response(ctx, req, 'another')\n        self.assertEqual(result, 'another_grokked_post')\n\n        result= render_view_to_response(ctx, req, 'another_grokked_class')\n        self.assertEqual(result, 'another_grokked_class')\n\n        result= render_view_to_response(ctx, req, 'another_grokked_instance')\n        self.assertEqual(result, 'another_grokked_instance')\n\n        result= render_view_to_response(ctx, req,\n                                        'another_oldstyle_grokked_class')\n        self.assertEqual(result, 'another_oldstyle_grokked_class')\n\n        result = render_view_to_response(ctx, req, 'stacked1')\n        self.assertEqual(result, 'stacked')\n\n        result = render_view_to_response(ctx, req, 'stacked2')\n        self.assertEqual(result, 'stacked')\n\n        result = render_view_to_response(ctx, req, 'another_stacked1')\n        self.assertEqual(result, 'another_stacked')\n\n        result = render_view_to_response(ctx, req, 'another_stacked2')\n        self.assertEqual(result, 'another_stacked')\n\n        result = render_view_to_response(ctx, req, 'stacked_class1')\n        self.assertEqual(result, 'stacked_class')\n\n        result = render_view_to_response(ctx, req, 'stacked_class2')\n        self.assertEqual(result, 'stacked_class')\n\n        result = render_view_to_response(ctx, req, 'another_stacked_class1')\n        self.assertEqual(result, 'another_stacked_class')\n\n        result = render_view_to_response(ctx, req, 'another_stacked_class2')\n        self.assertEqual(result, 'another_stacked_class')\n\n        # NB: on Jython, a class without an __init__ apparently accepts\n        # any number of arguments without raising a TypeError, so the next\n        # assertion may fail there.  We don't support Jython at the moment,\n        # this is just a note to a future self.\n\n        self.assertRaises(TypeError,\n                          render_view_to_response, ctx, req, 'basemethod')\n\n        result = render_view_to_response(ctx, req, 'method1')\n        self.assertEqual(result, 'method1')\n\n        result = render_view_to_response(ctx, req, 'method2')\n        self.assertEqual(result, 'method2')\n\n        result = render_view_to_response(ctx, req, 'stacked_method1')\n        self.assertEqual(result, 'stacked_method')\n\n        result = render_view_to_response(ctx, req, 'stacked_method2')\n        self.assertEqual(result, 'stacked_method')\n\n        result = render_view_to_response(ctx, req, 'subpackage_init')\n        self.assertEqual(result, 'subpackage_init')\n\n        result = render_view_to_response(ctx, req, 'subpackage_notinit')\n        self.assertEqual(result, 'subpackage_notinit')\n\n        result = render_view_to_response(ctx, req, 'subsubpackage_init')\n        self.assertEqual(result, 'subsubpackage_init')\n\n        result = render_view_to_response(ctx, req, 'pod_notinit')\n        self.assertEqual(result, None)\n\n    def test_scan_integration_with_ignore(self):\n        from zope.interface import alsoProvides\n        from pyramid.interfaces import IRequest\n        from pyramid.view import render_view_to_response\n        import pyramid.tests.test_config.pkgs.scannable as package\n        config = self._makeOne(autocommit=True)\n        config.scan(package, \n                    ignore='pyramid.tests.test_config.pkgs.scannable.another')\n\n        ctx = DummyContext()\n        req = DummyRequest()\n        alsoProvides(req, IRequest)\n        req.registry = config.registry\n\n        req.method = 'GET'\n        result = render_view_to_response(ctx, req, '')\n        self.assertEqual(result, 'grokked')\n\n        # ignored\n        v = render_view_to_response(ctx, req, 'another_stacked_class2')\n        self.assertEqual(v, None)\n        \n    def test_scan_integration_dottedname_package(self):\n        from zope.interface import alsoProvides\n        from pyramid.interfaces import IRequest\n        from pyramid.view import render_view_to_response\n        config = self._makeOne(autocommit=True)\n        config.scan('pyramid.tests.test_config.pkgs.scannable')\n\n        ctx = DummyContext()\n        req = DummyRequest()\n        alsoProvides(req, IRequest)\n        req.registry = config.registry\n\n        req.method = 'GET'\n        result = render_view_to_response(ctx, req, '')\n        self.assertEqual(result, 'grokked')\n\n    def test_scan_integration_with_extra_kw(self):\n        config = self._makeOne(autocommit=True)\n        config.scan('pyramid.tests.test_config.pkgs.scanextrakw', a=1)\n        self.assertEqual(config.a, 1)\n\n    def test_scan_integration_with_onerror(self):\n        # fancy sys.path manipulation here to appease \"setup.py test\" which\n        # fails miserably when it can't import something in the package\n        import sys\n        try:\n            here = os.path.dirname(__file__)\n            path = os.path.join(here, 'path')\n            sys.path.append(path)\n            config = self._makeOne(autocommit=True)\n            class FooException(Exception):\n                pass\n            def onerror(name):\n                raise FooException\n            self.assertRaises(FooException, config.scan, 'scanerror',\n                              onerror=onerror)\n        finally:\n            sys.path.remove(path)\n\n    def test_scan_integration_conflict(self):\n        from pyramid.tests.test_config.pkgs import selfscan\n        from pyramid.config import Configurator\n        c = Configurator()\n        c.scan(selfscan)\n        c.scan(selfscan)\n        try:\n            c.commit()\n        except ConfigurationConflictError as why:\n            def scanconflicts(e):\n                conflicts = e._conflicts.values()\n                for conflict in conflicts:\n                    for confinst in conflict:\n                        yield confinst.src\n            which = list(scanconflicts(why))\n            self.assertEqual(len(which), 4)\n            self.assertTrue(\"@view_config(renderer='string')\" in which)\n            self.assertTrue(\"@view_config(name='two', renderer='string')\" in\n                            which)\n\n    @skip_on('py3')\n    def test_hook_zca(self):\n        from zope.component import getSiteManager\n        def foo():\n            '123'\n        try:\n            config = self._makeOne()\n            config.hook_zca()\n            config.begin()\n            sm = getSiteManager()\n            self.assertEqual(sm, config.registry)\n        finally:\n            getSiteManager.reset()\n\n    @skip_on('py3')\n    def test_unhook_zca(self):\n        from zope.component import getSiteManager\n        def foo():\n            '123'\n        try:\n            getSiteManager.sethook(foo)\n            config = self._makeOne()\n            config.unhook_zca()\n            sm = getSiteManager()\n            self.assertNotEqual(sm, '123')\n        finally:\n            getSiteManager.reset()\n\n    def test_commit_conflict_simple(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        config.add_view(view1)\n        config.add_view(view2)\n        self.assertRaises(ConfigurationConflictError, config.commit)\n\n    def test_commit_conflict_resolved_with_include(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        def includeme(config):\n            config.add_view(view2)\n        config.add_view(view1)\n        config.include(includeme)\n        config.commit()\n        registeredview = self._getViewCallable(config)\n        self.assertEqual(registeredview.__name__, 'view1')\n\n    def test_commit_conflict_with_two_includes(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        def includeme1(config):\n            config.add_view(view1)\n        def includeme2(config):\n            config.add_view(view2)\n        config.include(includeme1)\n        config.include(includeme2)\n        try:\n            config.commit()\n        except ConfigurationConflictError as why:\n            c1, c2 = _conflictFunctions(why)\n            self.assertEqual(c1, 'includeme1')\n            self.assertEqual(c2, 'includeme2')\n        else: #pragma: no cover\n            raise AssertionError\n\n    def test_commit_conflict_resolved_with_two_includes_and_local(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        def view3(request): pass\n        def includeme1(config):\n            config.add_view(view1)\n        def includeme2(config):\n            config.add_view(view2)\n        config.include(includeme1)\n        config.include(includeme2)\n        config.add_view(view3)\n        config.commit()\n        registeredview = self._getViewCallable(config)\n        self.assertEqual(registeredview.__name__, 'view3')\n\n    def test_autocommit_no_conflicts(self):\n        from pyramid.renderers import null_renderer\n        config = self._makeOne(autocommit=True)\n        def view1(request): pass\n        def view2(request): pass\n        def view3(request): pass\n        config.add_view(view1, renderer=null_renderer)\n        config.add_view(view2, renderer=null_renderer)\n        config.add_view(view3, renderer=null_renderer)\n        config.commit()\n        registeredview = self._getViewCallable(config)\n        self.assertEqual(registeredview.__name__, 'view3')\n\n    def test_conflict_set_notfound_view(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        config.set_notfound_view(view1)\n        config.set_notfound_view(view2)\n        try:\n            config.commit()\n        except ConfigurationConflictError as why:\n            c1, c2 = _conflictFunctions(why)\n            self.assertEqual(c1, 'test_conflict_set_notfound_view')\n            self.assertEqual(c2, 'test_conflict_set_notfound_view')\n        else: # pragma: no cover\n            raise AssertionError\n\n    def test_conflict_set_forbidden_view(self):\n        config = self._makeOne()\n        def view1(request): pass\n        def view2(request): pass\n        config.set_forbidden_view(view1)\n        config.set_forbidden_view(view2)\n        try:\n            config.commit()\n        except ConfigurationConflictError as why:\n            c1, c2 = _conflictFunctions(why)\n            self.assertEqual(c1, 'test_conflict_set_forbidden_view')\n            self.assertEqual(c2, 'test_conflict_set_forbidden_view')\n        else: # pragma: no cover\n            raise AssertionError\n\n    def test___getattr__missing_when_directives_exist(self):\n        config = self._makeOne()\n        directives = {}\n        config.registry._directives = directives\n        self.assertRaises(AttributeError, config.__getattr__, 'wontexist')\n\n    def test___getattr__missing_when_directives_dont_exist(self):\n        config = self._makeOne()\n        self.assertRaises(AttributeError, config.__getattr__, 'wontexist')\n\n    def test___getattr__matches(self):\n        config = self._makeOne()\n        def foo(config): pass\n        directives = {'foo':(foo, True)}\n        config.registry._directives = directives\n        foo_meth = config.foo\n        self.assertTrue(getattr(foo_meth, im_func).__docobj__ is foo)\n\n    def test___getattr__matches_no_action_wrap(self):\n        config = self._makeOne()\n        def foo(config): pass\n        directives = {'foo':(foo, False)}\n        config.registry._directives = directives\n        foo_meth = config.foo\n        self.assertTrue(getattr(foo_meth, im_func) is foo)\n\nclass TestConfigurator_add_directive(unittest.TestCase):\n\n    def setUp(self):\n        from pyramid.config import Configurator\n        self.config = Configurator()\n\n    def test_extend_with_dotted_name(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n            'dummy_extend', 'pyramid.tests.test_config.dummy_extend')\n        self.assertTrue(hasattr(config, 'dummy_extend'))\n        config.dummy_extend('discrim')\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_add_directive_with_partial(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n                'dummy_partial', 'pyramid.tests.test_config.dummy_partial')\n        self.assertTrue(hasattr(config, 'dummy_partial'))\n        config.dummy_partial()\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'partial')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_add_directive_with_custom_callable(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n                'dummy_callable', 'pyramid.tests.test_config.dummy_callable')\n        self.assertTrue(hasattr(config, 'dummy_callable'))\n        config.dummy_callable('discrim')\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_extend_with_python_callable(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n            'dummy_extend', dummy_extend)\n        self.assertTrue(hasattr(config, 'dummy_extend'))\n        config.dummy_extend('discrim')\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], test_config)\n\n    def test_extend_same_name_doesnt_conflict(self):\n        config = self.config\n        config.add_directive(\n            'dummy_extend', dummy_extend)\n        config.add_directive(\n            'dummy_extend', dummy_extend2)\n        self.assertTrue(hasattr(config, 'dummy_extend'))\n        config.dummy_extend('discrim')\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], config.registry)\n\n    def test_extend_action_method_successful(self):\n        config = self.config\n        config.add_directive(\n            'dummy_extend', dummy_extend)\n        config.dummy_extend('discrim')\n        config.dummy_extend('discrim')\n        self.assertRaises(ConfigurationConflictError, config.commit)\n\n    def test_directive_persists_across_configurator_creations(self):\n        config = self.config\n        config.add_directive('dummy_extend', dummy_extend)\n        config2 = config.with_package('pyramid.tests')\n        config2.dummy_extend('discrim')\n        after = config2.action_state\n        actions = after.actions\n        self.assertEqual(len(actions), 1)\n        action = actions[0]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n        self.assertEqual(action['args'], config2.package)\n\nclass TestConfigurator__add_predicate(unittest.TestCase):\n    def _makeOne(self):\n        from pyramid.config import Configurator\n        return Configurator()\n\n    def test_factory_as_object(self):\n        config = self._makeOne()\n\n        def _fakeAction(discriminator, callable=None, args=(), kw=None,\n                        order=0, introspectables=(), **extra):\n            self.assertEqual(len(introspectables), 1)\n            self.assertEqual(introspectables[0]['name'], 'testing')\n            self.assertEqual(introspectables[0]['factory'], DummyPredicate)\n\n        config.action = _fakeAction\n        config._add_predicate('route', 'testing', DummyPredicate)\n\n    def test_factory_as_dotted_name(self):\n        config = self._makeOne()\n\n        def _fakeAction(discriminator, callable=None, args=(),\n                        kw=None, order=0, introspectables=(), **extra):\n            self.assertEqual(len(introspectables), 1)\n            self.assertEqual(introspectables[0]['name'], 'testing')\n            self.assertEqual(introspectables[0]['factory'], DummyPredicate)\n\n        config.action = _fakeAction\n        config._add_predicate(\n            'route',\n            'testing',\n            'pyramid.tests.test_config.test_init.DummyPredicate'\n            )\n        \nclass TestActionState(unittest.TestCase):\n    def _makeOne(self):\n        from pyramid.config import ActionState\n        return ActionState()\n    \n    def test_it(self):\n        c = self._makeOne()\n        self.assertEqual(c.actions, [])\n\n    def test_action_simple(self):\n        from pyramid.tests.test_config import dummyfactory as f\n        c = self._makeOne()\n        c.actions = []\n        c.action(1, f, (1,), {'x':1})\n        self.assertEqual(\n            c.actions,\n            [{'args': (1,),\n             'callable': f,\n             'discriminator': 1,\n             'includepath': (),\n             'info': None,\n             'introspectables': (),\n             'kw': {'x': 1},\n             'order': 0}])\n        c.action(None)\n        self.assertEqual(\n            c.actions,\n            [{'args': (1,),\n             'callable': f,\n             'discriminator': 1,\n             'includepath': (),\n             'info': None,\n             'introspectables': (),\n             'kw': {'x': 1},\n             'order': 0},\n\n             {'args': (),\n             'callable': None,\n             'discriminator': None,\n             'includepath': (),\n             'info': None,\n             'introspectables': (),\n             'kw': {},\n             'order': 0},])\n\n    def test_action_with_includepath(self):\n        c = self._makeOne()\n        c.actions = []\n        c.action(None, includepath=('abc',))\n        self.assertEqual(\n            c.actions,\n            [{'args': (),\n             'callable': None,\n             'discriminator': None,\n             'includepath': ('abc',),\n             'info': None,\n             'introspectables': (),\n             'kw': {},\n             'order': 0}])\n\n    def test_action_with_info(self):\n        c = self._makeOne()\n        c.action(None, info='abc')\n        self.assertEqual(\n            c.actions,\n            [{'args': (),\n             'callable': None,\n             'discriminator': None,\n             'includepath': (),\n             'info': 'abc',\n             'introspectables': (),\n             'kw': {},\n             'order': 0}])\n\n    def test_action_with_includepath_and_info(self):\n        c = self._makeOne()\n        c.action(None, includepath=('spec',), info='bleh')\n        self.assertEqual(\n            c.actions,\n            [{'args': (),\n             'callable': None,\n             'discriminator': None,\n             'includepath': ('spec',),\n             'info': 'bleh',\n             'introspectables': (),\n             'kw': {},\n             'order': 0}])\n\n    def test_action_with_order(self):\n        c = self._makeOne()\n        c.actions = []\n        c.action(None, order=99999)\n        self.assertEqual(\n            c.actions,\n            [{'args': (),\n             'callable': None,\n             'discriminator': None,\n             'includepath': (),\n             'info': None,\n             'introspectables': (),\n             'kw': {},\n             'order': 99999}])\n\n    def test_action_with_introspectables(self):\n        c = self._makeOne()\n        c.actions = []\n        intr = DummyIntrospectable()\n        c.action(None, introspectables=(intr,))\n        self.assertEqual(\n            c.actions,\n            [{'args': (),\n             'callable': None,\n             'discriminator': None,\n             'includepath': (),\n             'info': None,\n             'introspectables': (intr,),\n             'kw': {},\n             'order': 0}])\n\n    def test_processSpec(self):\n        c = self._makeOne()\n        self.assertTrue(c.processSpec('spec'))\n        self.assertFalse(c.processSpec('spec'))\n\n    def test_execute_actions_tuples(self):\n        output = []\n        def f(*a, **k):\n            output.append((a, k))\n        c = self._makeOne()\n        c.actions = [\n            (1, f, (1,)),\n            (1, f, (11,), {}, ('x', )),\n            (2, f, (2,)),\n            (None, None),\n            ]\n        c.execute_actions()\n        self.assertEqual(output,  [((1,), {}), ((2,), {})])\n\n    def test_execute_actions_dicts(self):\n        output = []\n        def f(*a, **k):\n            output.append((a, k))\n        c = self._makeOne()\n        c.actions = [\n            {'discriminator':1, 'callable':f, 'args':(1,), 'kw':{},\n             'order':0, 'includepath':(), 'info':None,\n             'introspectables':()},\n            {'discriminator':1, 'callable':f, 'args':(11,), 'kw':{},\n             'includepath':('x',), 'order': 0, 'info':None,\n             'introspectables':()},\n            {'discriminator':2, 'callable':f, 'args':(2,), 'kw':{},\n             'order':0, 'includepath':(), 'info':None,\n             'introspectables':()},\n            {'discriminator':None, 'callable':None, 'args':(), 'kw':{},\n             'order':0, 'includepath':(), 'info':None,\n             'introspectables':()},\n            ]\n        c.execute_actions()\n        self.assertEqual(output,  [((1,), {}), ((2,), {})])\n\n    def test_execute_actions_with_introspectables(self):\n        output = []\n        def f(*a, **k):\n            output.append((a, k))\n        c = self._makeOne()\n        intr = DummyIntrospectable()\n        c.actions = [\n            {'discriminator':1, 'callable':f, 'args':(1,), 'kw':{},\n             'order':0, 'includepath':(), 'info':None,\n             'introspectables':(intr,)},\n            ]\n        introspector = object()\n        c.execute_actions(introspector=introspector)\n        self.assertEqual(output,  [((1,), {})])\n        self.assertEqual(intr.registered, [(introspector, None)])\n\n    def test_execute_actions_with_introspectable_no_callable(self):\n        c = self._makeOne()\n        intr = DummyIntrospectable()\n        c.actions = [\n            {'discriminator':1, 'callable':None, 'args':(1,), 'kw':{},\n             'order':0, 'includepath':(), 'info':None,\n             'introspectables':(intr,)},\n            ]\n        introspector = object()\n        c.execute_actions(introspector=introspector)\n        self.assertEqual(intr.registered, [(introspector, None)])\n\n    def test_execute_actions_error(self):\n        output = []\n        def f(*a, **k):\n            output.append(('f', a, k))\n        def bad():\n            raise NotImplementedError\n        c = self._makeOne()\n        c.actions = [\n            (1, f, (1,)),\n            (1, f, (11,), {}, ('x', )),\n            (2, f, (2,)),\n            (3, bad, (), {}, (), 'oops')\n            ]\n        self.assertRaises(ConfigurationExecutionError, c.execute_actions)\n        self.assertEqual(output, [('f', (1,), {}), ('f', (2,), {})])\n\n    def test_reentrant_action(self):\n        output = []\n        c = self._makeOne()\n        def f(*a, **k):\n            output.append(('f', a, k))\n            c.actions.append((3, g, (8,), {}))\n        def g(*a, **k):\n            output.append(('g', a, k))\n        c.actions = [\n            (1, f, (1,)),\n        ]\n        c.execute_actions()\n        self.assertEqual(output, [('f', (1,), {}), ('g', (8,), {})])\n\n    def test_reentrant_action_with_deferred_discriminator(self):\n        # see https://github.com/Pylons/pyramid/issues/2697\n        from pyramid.registry import Deferred\n        output = []\n        c = self._makeOne()\n        def f(*a, **k):\n            output.append(('f', a, k))\n            c.actions.append((4, g, (4,), {}, (), None, 2))\n        def g(*a, **k):\n            output.append(('g', a, k))\n        def h(*a, **k):\n            output.append(('h', a, k))\n        def discrim():\n            self.assertEqual(output, [('f', (1,), {}), ('g', (2,), {})])\n            return 3\n        d = Deferred(discrim)\n        c.actions = [\n            (d, h, (3,), {}, (), None, 1), # order 1\n            (1, f, (1,)), # order 0\n            (2, g, (2,)), # order 0\n        ]\n        c.execute_actions()\n        self.assertEqual(output, [\n            ('f', (1,), {}), ('g', (2,), {}), ('h', (3,), {}), ('g', (4,), {})])\n\n    def test_reentrant_action_error(self):\n        from pyramid.exceptions import ConfigurationError\n        c = self._makeOne()\n        def f(*a, **k):\n            c.actions.append((3, g, (8,), {}, (), None, -1))\n        def g(*a, **k): pass\n        c.actions = [\n            (1, f, (1,)),\n        ]\n        self.assertRaises(ConfigurationError, c.execute_actions)\n\n    def test_reentrant_action_without_clear(self):\n        c = self._makeOne()\n        def f(*a, **k):\n            c.actions.append((3, g, (8,)))\n        def g(*a, **k): pass\n        c.actions = [\n            (1, f, (1,)),\n        ]\n        c.execute_actions(clear=False)\n        self.assertEqual(c.actions, [\n            (1, f, (1,)),\n            (3, g, (8,)),\n        ])\n\n    def test_executing_conflicting_action_across_orders(self):\n        from pyramid.exceptions import ConfigurationConflictError\n        c = self._makeOne()\n        def f(*a, **k): pass\n        def g(*a, **k): pass\n        c.actions = [\n            (1, f, (1,), {}, (), None, -1),\n            (1, g, (2,)),\n        ]\n        self.assertRaises(ConfigurationConflictError, c.execute_actions)\n\n    def test_executing_conflicting_action_across_reentrant_orders(self):\n        from pyramid.exceptions import ConfigurationConflictError\n        c = self._makeOne()\n        def f(*a, **k):\n            c.actions.append((1, g, (8,)))\n        def g(*a, **k): pass\n        c.actions = [\n            (1, f, (1,), {}, (), None, -1),\n        ]\n        self.assertRaises(ConfigurationConflictError, c.execute_actions)\n\nclass Test_reentrant_action_functional(unittest.TestCase):\n    def _makeConfigurator(self, *arg, **kw):\n        from pyramid.config import Configurator\n        config = Configurator(*arg, **kw)\n        return config\n\n    def test_functional(self):\n        def add_auto_route(config, name, view):\n               def register():\n                   config.add_view(route_name=name, view=view)\n                   config.add_route(name, '/' + name)\n               config.action(\n                   ('auto route', name), register, order=-30\n                   )\n        config = self._makeConfigurator()\n        config.add_directive('add_auto_route', add_auto_route)\n        def my_view(request): return request.response\n        config.add_auto_route('foo', my_view)\n        config.commit()\n        from pyramid.interfaces import IRoutesMapper\n        mapper = config.registry.getUtility(IRoutesMapper)\n        routes = mapper.get_routes()\n        route = routes[0]\n        self.assertEqual(len(routes), 1)\n        self.assertEqual(route.name, 'foo')\n        self.assertEqual(route.path, '/foo')\n\n    def test_deferred_discriminator(self):\n        # see https://github.com/Pylons/pyramid/issues/2697\n        from pyramid.config import PHASE0_CONFIG\n        config = self._makeConfigurator()\n        def deriver(view, info): return view\n        deriver.options = ('foo',)\n        config.add_view_deriver(deriver, 'foo_view')\n        # add_view uses a deferred discriminator and will fail if executed\n        # prior to add_view_deriver executing its action\n        config.add_view(lambda r: r.response, name='', foo=1)\n        def dummy_action():\n            # trigger a re-entrant action\n            config.action(None, lambda: None)\n        config.action(None, dummy_action, order=PHASE0_CONFIG)\n        config.commit()\n\nclass Test_resolveConflicts(unittest.TestCase):\n    def _callFUT(self, actions):\n        from pyramid.config import resolveConflicts\n        return resolveConflicts(actions)\n\n    def test_it_success_tuples(self):\n        from pyramid.tests.test_config import dummyfactory as f\n        result = self._callFUT([\n            (None, f),\n            (1, f, (1,), {}, (), 'first'),\n            (1, f, (2,), {}, ('x',), 'second'),\n            (1, f, (3,), {}, ('y',), 'third'),\n            (4, f, (4,), {}, ('y',), 'should be last', 99999),\n            (3, f, (3,), {}, ('y',)),\n            (None, f, (5,), {}, ('y',)),\n            ])\n        result = list(result)\n        self.assertEqual(\n            result,\n            [{'info': None,\n              'args': (),\n              'callable': f,\n              'introspectables': (),\n              'kw': {},\n              'discriminator': None,\n              'includepath': (),\n              'order': 0},\n\n              {'info': 'first',\n               'args': (1,),\n               'callable': f,\n               'introspectables': (),\n               'kw': {},\n               'discriminator': 1,\n               'includepath': (),\n               'order': 0},\n\n               {'info': None,\n                'args': (3,),\n                'callable': f,\n                'introspectables': (),\n                'kw': {},\n                'discriminator': 3,\n                'includepath': ('y',),\n                'order': 0},\n\n                {'info': None,\n                 'args': (5,),\n                 'callable': f,\n                 'introspectables': (),\n                 'kw': {},\n                 'discriminator': None,\n                 'includepath': ('y',),\n                 'order': 0},\n\n                 {'info': 'should be last',\n                  'args': (4,),\n                  'callable': f,\n                  'introspectables': (),\n                  'kw': {},\n                  'discriminator': 4,\n                  'includepath': ('y',),\n                  'order': 99999}\n                  ]\n                  )\n\n    def test_it_success_dicts(self):\n        from pyramid.tests.test_config import dummyfactory as f\n        result = self._callFUT([\n            (None, f),\n            (1, f, (1,), {}, (), 'first'),\n            (1, f, (2,), {}, ('x',), 'second'),\n            (1, f, (3,), {}, ('y',), 'third'),\n            (4, f, (4,), {}, ('y',), 'should be last', 99999),\n            (3, f, (3,), {}, ('y',)),\n            (None, f, (5,), {}, ('y',)),\n            ])\n        result = list(result)\n        self.assertEqual(\n            result,\n            [{'info': None,\n              'args': (),\n              'callable': f,\n              'introspectables': (),\n              'kw': {},\n              'discriminator': None,\n              'includepath': (),\n              'order': 0},\n\n              {'info': 'first',\n               'args': (1,),\n               'callable': f,\n               'introspectables': (),\n               'kw': {},\n               'discriminator': 1,\n               'includepath': (),\n               'order': 0},\n\n               {'info': None,\n                'args': (3,),\n                'callable': f,\n                'introspectables': (),\n                'kw': {},\n                'discriminator': 3,\n                'includepath': ('y',),\n                'order': 0},\n\n                {'info': None,\n                 'args': (5,),\n                 'callable': f,\n                 'introspectables': (),\n                 'kw': {},\n                 'discriminator': None,\n                 'includepath': ('y',),\n                 'order': 0},\n\n                 {'info': 'should be last',\n                  'args': (4,),\n                  'callable': f,\n                  'introspectables': (),\n                  'kw': {},\n                  'discriminator': 4,\n                  'includepath': ('y',),\n                  'order': 99999}\n                  ]\n                  )\n\n    def test_it_conflict(self):\n        from pyramid.tests.test_config import dummyfactory as f\n        result = self._callFUT([\n            (None, f),\n            (1, f, (2,), {}, ('x',), 'eek'),     # will conflict\n            (1, f, (3,), {}, ('y',), 'ack'),     # will conflict\n            (4, f, (4,), {}, ('y',)),\n            (3, f, (3,), {}, ('y',)),\n            (None, f, (5,), {}, ('y',)),\n            ])\n        self.assertRaises(ConfigurationConflictError, list, result)\n\n    def test_it_with_actions_grouped_by_order(self):\n        from pyramid.tests.test_config import dummyfactory as f\n        result = self._callFUT([\n            (None, f),                                 # X\n            (1, f, (1,), {}, (), 'third', 10),         # X\n            (1, f, (2,), {}, ('x',), 'fourth', 10),\n            (1, f, (3,), {}, ('y',), 'fifth', 10),\n            (2, f, (1,), {}, (), 'sixth', 10),         # X\n            (3, f, (1,), {}, (), 'seventh', 10),       # X\n            (5, f, (4,), {}, ('y',), 'eighth', 99999), # X\n            (4, f, (3,), {}, (), 'first', 5),          # X\n            (4, f, (5,), {}, ('y',), 'second', 5),\n            ])\n        result = list(result)\n        self.assertEqual(len(result), 6)\n        # resolved actions should be grouped by (order, i)\n        self.assertEqual(\n            result,\n            [{'info': None,\n              'args': (),\n              'callable': f,\n              'introspectables': (),\n              'kw': {},\n              'discriminator': None,\n              'includepath': (),\n              'order': 0},\n\n              {'info': 'first',\n               'args': (3,),\n               'callable': f,\n               'introspectables': (),\n               'kw': {},\n               'discriminator': 4,\n               'includepath': (),\n               'order': 5},\n\n               {'info': 'third',\n                'args': (1,),\n                'callable': f,\n                'introspectables': (),\n                'kw': {},\n                'discriminator': 1,\n                'includepath': (),\n                'order': 10},\n\n               {'info': 'sixth',\n                'args': (1,),\n                'callable': f,\n                'introspectables': (),\n                'kw': {},\n                'discriminator': 2,\n                'includepath': (),\n                'order': 10},\n\n               {'info': 'seventh',\n                'args': (1,),\n                'callable': f,\n                'introspectables': (),\n                'kw': {},\n                'discriminator': 3,\n                'includepath': (),\n                'order': 10},\n\n                 {'info': 'eighth',\n                  'args': (4,),\n                  'callable': f,\n                  'introspectables': (),\n                  'kw': {},\n                  'discriminator': 5,\n                  'includepath': ('y',),\n                  'order': 99999}\n                  ]\n                  )\n\n    def test_override_success_across_orders(self):\n        from pyramid.tests.test_config import dummyfactory as f\n        result = self._callFUT([\n            (1, f, (2,), {}, ('x',), 'eek', 0),\n            (1, f, (3,), {}, ('x', 'y'), 'ack', 10),\n            ])\n        result = list(result)\n        self.assertEqual(result, [\n            {'info': 'eek',\n            'args': (2,),\n            'callable': f,\n            'introspectables': (),\n            'kw': {},\n            'discriminator': 1,\n            'includepath': ('x',),\n            'order': 0},\n        ])\n\n    def test_conflicts_across_orders(self):\n        from pyramid.tests.test_config import dummyfactory as f\n        result = self._callFUT([\n            (1, f, (2,), {}, ('x', 'y'), 'eek', 0),\n            (1, f, (3,), {}, ('x'), 'ack', 10),\n            ])\n        self.assertRaises(ConfigurationConflictError, list, result)\n\nclass TestGlobalRegistriesIntegration(unittest.TestCase):\n    def setUp(self):\n        from pyramid.config import global_registries\n        global_registries.empty()\n\n    tearDown = setUp\n\n    def _makeConfigurator(self, *arg, **kw):\n        from pyramid.config import Configurator\n        config = Configurator(*arg, **kw)\n        return config\n\n    def test_global_registries_empty(self):\n        from pyramid.config import global_registries\n        self.assertEqual(global_registries.last, None)\n\n    def test_global_registries(self):\n        from pyramid.config import global_registries\n        config1 = self._makeConfigurator()\n        config1.make_wsgi_app()\n        self.assertEqual(global_registries.last, config1.registry)\n        config2 = self._makeConfigurator()\n        config2.make_wsgi_app()\n        self.assertEqual(global_registries.last, config2.registry)\n        self.assertEqual(list(global_registries),\n                         [config1.registry, config2.registry])\n        global_registries.remove(config2.registry)\n        self.assertEqual(global_registries.last, config1.registry)\n\nclass DummyRequest:\n    subpath = ()\n    matchdict = None\n    request_iface = IRequest\n    def __init__(self, environ=None):\n        if environ is None:\n            environ = {}\n        self.environ = environ\n        self.params = {}\n        self.cookies = {}\n\nclass DummyThreadLocalManager(object):\n    def __init__(self):\n        self.pushed = {'registry': None, 'request': None}\n        self.popped = False\n    def push(self, d):\n        self.pushed = d\n    def get(self):\n        return self.pushed\n    def pop(self):\n        self.popped = True\n\nfrom zope.interface import implementer\n@implementer(IDummy)\nclass DummyEvent:\n    pass\n\nclass DummyRegistry(object):\n    def __init__(self, adaptation=None, util=None):\n        self.utilities = []\n        self.adapters = []\n        self.adaptation = adaptation\n        self.util = util\n    def subscribers(self, events, name):\n        self.events = events\n        return events\n    def registerUtility(self, *arg, **kw):\n        self.utilities.append((arg, kw))\n    def registerAdapter(self, *arg, **kw):\n        self.adapters.append((arg, kw))\n    def queryAdapter(self, *arg, **kw):\n        return self.adaptation\n    def queryUtility(self, *arg, **kw):\n        return self.util\n\nfrom zope.interface import Interface\nclass IOther(Interface):\n    pass\n\ndef _conflictFunctions(e):\n    conflicts = e._conflicts.values()\n    for conflict in conflicts:\n        for confinst in conflict:\n            yield confinst.function\n\nclass DummyActionState(object):\n    autocommit = False\n    info = ''\n    def __init__(self):\n        self.actions = []\n    def action(self, *arg, **kw):\n        self.actions.append((arg, kw))\n\nclass DummyIntrospectable(object):\n    def __init__(self):\n        self.registered = []\n    def register(self, introspector, action_info):\n        self.registered.append((introspector, action_info))\n        \nclass DummyPredicate(object):\n    pass\n"
    ],
    "test_file_names": [
        "test_1.py"
    ],
    "setup_res_code": 0,
    "setup_res_stdout": "",
    "setup_res_stderr": "Using CPython 3.8.20\nCreating virtual environment at: .venv\nActivate with: source .venv/bin/activate\nResolved 10 packages in 721ms\nPrepared 1 package in 868ms\nInstalled 10 packages in 19ms\n + hupper==1.12.1\n + pastedeploy==3.1.0\n + pyramid==1.9.dev0 (from file:///home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab)\n + repoze-lru==0.7\n + setuptools==75.3.0\n + translationstring==1.4\n + venusian==3.1.1\n + webob==1.8.9\n + zope-deprecation==5.0\n + zope-interface==7.2\nResolved 23 packages in 23ms\nInstalled 13 packages in 10ms\n + beautifulsoup4==4.12.3\n + coverage==7.6.1\n + distlib==0.3.9\n + filelock==3.16.1\n + nose==1.3.7\n + platformdirs==4.3.6\n + soupsieve==2.6\n + virtualenv==20.29.0\n + waitress==3.0.0\n + webtest==3.0.1\n + zope-component==6.0\n + zope-event==5.0\n + zope-hookable==7.0\nResolved 16 packages in 7ms\nInstalled 12 packages in 11ms\n + cachetools==5.5.0\n + chardet==5.2.0\n + colorama==0.4.6\n + exceptiongroup==1.2.2\n + iniconfig==2.0.0\n + packaging==24.2\n + pluggy==1.5.0\n + pyproject-api==1.8.0\n + pytest==8.3.4\n + tomli==2.2.1\n + tox==4.23.2\n + typing-extensions==4.12.2\n",
    "new_commit_res_code": 1,
    "new_commit_res_stdout": "============================= test session starts ==============================\nplatform linux -- Python 3.8.20, pytest-8.3.4, pluggy-1.5.0\nrootdir: /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab\ncollected 978 items\n\nr2e_tests/test_1.py ...........................................F..F..... [  5%]\n..F..............F...F.......F.....................FF...FFF............. [ 12%]\n.................                                                        [ 14%]\nr2e_tests/test_config/test_adapters.py .FF..............F...             [ 16%]\nr2e_tests/test_config/test_assets.py ....F.F...F...FF.FF................ [ 20%]\n.....................................F.F................................ [ 27%]\n                                                                         [ 27%]\nr2e_tests/test_config/test_factories.py .......................          [ 29%]\nr2e_tests/test_config/test_i18n.py FFFF..FF.FFF..                        [ 31%]\nr2e_tests/test_config/test_init.py ..................................... [ 35%]\n......F..F.......F..............F...........F.....................FF...F [ 42%]\nFF..............................                                         [ 45%]\nr2e_tests/test_config/test_rendering.py ...                              [ 46%]\nr2e_tests/test_config/test_routes.py ........................            [ 48%]\nr2e_tests/test_config/test_security.py ............                      [ 49%]\nr2e_tests/test_config/test_settings.py ........................          [ 52%]\nr2e_tests/test_config/test_testing.py ............                       [ 53%]\nr2e_tests/test_config/test_tweens.py .................................   [ 56%]\nr2e_tests/test_config/test_util.py ..................................... [ 60%]\n...............                                                          [ 62%]\nr2e_tests/test_config/test_views.py .................................F.. [ 65%]\n........................................................................ [ 73%]\n.......................FF............................................... [ 80%]\n.......................................................F.......F         [ 87%]\nr2e_tests/test_scripts/test_common.py ..                                 [ 87%]\nr2e_tests/test_scripts/test_pcreate.py .....................             [ 89%]\nr2e_tests/test_scripts/test_pdistreport.py ..                            [ 89%]\nr2e_tests/test_scripts/test_prequest.py ...................              [ 91%]\nr2e_tests/test_scripts/test_proutes.py ...........FFFF.F.FF....F..FF.    [ 94%]\nr2e_tests/test_scripts/test_pserve.py ..F......                          [ 95%]\nr2e_tests/test_scripts/test_pshell.py ................                   [ 97%]\nr2e_tests/test_scripts/test_ptweens.py .....                             [ 97%]\nr2e_tests/test_scripts/test_pviews.py ................F......            [100%]\n\n=================================== FAILURES ===================================\n___________________ ConfiguratorTests.test_ctor_no_registry ____________________\n\nself = <r2e_tests.test_1.ConfiguratorTests testMethod=test_ctor_no_registry>\n\n    def test_ctor_no_registry(self):\n        import sys\n        from pyramid.interfaces import ISettings\n        from pyramid.config import Configurator\n        from pyramid.interfaces import IRendererFactory\n        config = Configurator()\n        this_pkg = sys.modules['pyramid.tests.test_config']\n        self.assertTrue(config.registry.getUtility(ISettings))\n>       self.assertEqual(config.package, this_pkg)\nE       AssertionError: <module 'r2e_tests' from '/home/gcpuser/buckets/lo[93 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_1.py:68: AssertionError\n_________ ConfiguratorTests.test_ctor_noreg_debug_logger_None_default __________\n\nself = <r2e_tests.test_1.ConfiguratorTests testMethod=test_ctor_noreg_debug_logger_None_default>\n\n    def test_ctor_noreg_debug_logger_None_default(self):\n        from pyramid.interfaces import IDebugLogger\n        config = self._makeOne()\n        logger = config.registry.getUtility(IDebugLogger)\n>       self.assertEqual(logger.name, 'pyramid.tests.test_config')\nE       AssertionError: 'r2e_tests' != 'pyramid.tests.test_config'\nE       - r2e_tests\nE       + pyramid.tests.test_config\n\nr2e_tests/test_1.py:165: AssertionError\n_____________ ConfiguratorTests.test_include_constant_root_package _____________\n\nself = <r2e_tests.test_1.ConfiguratorTests testMethod=test_include_constant_root_package>\n\n    def test_include_constant_root_package(self):\n        from pyramid import tests\n        from pyramid.tests import test_config\n        config = self._makeOne(root_package=tests)\n        results = {}\n        def include(config):\n            results['package'] = config.package\n            results['root_package'] = config.root_package\n        config.include(include)\n        self.assertEqual(results['root_package'], tests)\n>       self.assertEqual(results['package'], test_config)\nE       AssertionError: <module 'r2e_tests' from '/home/gcpuser/buckets/lo[93 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_1.py:818: AssertionError\n_______________ ConfiguratorTests.test_scan_integration_conflict _______________\n\nself = <r2e_tests.test_1.ConfiguratorTests testMethod=test_scan_integration_conflict>\n\n    def test_scan_integration_conflict(self):\n        from pyramid.tests.test_config.pkgs import selfscan\n        from pyramid.config import Configurator\n        c = Configurator()\n        c.scan(selfscan)\n        c.scan(selfscan)\n        try:\n>           c.commit()\n\nr2e_tests/test_1.py:1090: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \npyramid/config/__init__.py:657: in commit\n    self.action_state.execute_actions(introspector=self.introspector)\npyramid/config/__init__.py:1160: in execute_actions\n    action = next(action_iter, None)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nactions = [{'args': (), 'callable': <function ViewsConfiguratorMixin.add_view.<locals>.register at 0x7384d0e568b0>, 'discriminat...84d0e56040>, 'discriminator': ('view', None, 'two', None, 'd41d8cd98f00b204e9800998ecf8427e'), 'includepath': (), ...}]\nstate = <pyramid.config.ConflictResolverState object at 0x7384d0fd7430>\n\n    def resolveConflicts(actions, state=None):\n        \"\"\"Resolve conflicting actions\n    \n        Given an actions list, identify and try to resolve conflicting actions.\n        Actions conflict if they have the same non-None discriminator.\n    \n        Conflicting actions can be resolved if the include path of one of\n        the actions is a prefix of the includepaths of the other\n        conflicting actions and is unequal to the include paths in the\n        other conflicting actions.\n    \n        Actions are resolved on a per-order basis because some discriminators\n        cannot be computed until earlier actions have executed. An action in an\n        earlier order may execute successfully only to find out later that it was\n        overridden by another action with a smaller include path. This will result\n        in a conflict as there is no way to revert the original action.\n    \n        ``state`` may be an instance of ``ConflictResolverState`` that\n        can be used to resume execution and resolve the new actions against the\n        list of executed actions from a previous call.\n    \n        \"\"\"\n        if state is None:\n            state = ConflictResolverState()\n    \n        # pick up where we left off last time, but track the new actions as well\n        state.remaining_actions.extend(normalize_actions(actions))\n        actions = state.remaining_actions\n    \n        def orderandpos(v):\n            n, v = v\n            return (v['order'] or 0, n)\n    \n        def orderonly(v):\n            n, v = v\n            return v['order'] or 0\n    \n        sactions = sorted(enumerate(actions, start=state.start), key=orderandpos)\n        for order, actiongroup in itertools.groupby(sactions, orderonly):\n            # \"order\" is an integer grouping. Actions in a lower order will be\n            # executed before actions in a higher order.  All of the actions in\n            # one grouping will be executed (its callable, if any will be called)\n            # before any of the actions in the next.\n            output = []\n            unique = {}\n    \n            # error out if we went backward in order\n            if state.min_order is not None and order < state.min_order:\n                r = ['Actions were added to order={0} after execution had moved '\n                     'on to order={1}. Conflicting actions: '\n                     .format(order, state.min_order)]\n                for i, action in actiongroup:\n                    for line in str(action['info']).rstrip().split('\\n'):\n                        r.append(\"  \" + line)\n                raise ConfigurationError('\\n'.join(r))\n    \n            for i, action in actiongroup:\n                # Within an order, actions are executed sequentially based on\n                # original action ordering (\"i\").\n    \n                # \"ainfo\" is a tuple of (i, action) where \"i\" is an integer\n                # expressing the relative position of this action in the action\n                # list being resolved, and \"action\" is an action dictionary.  The\n                # purpose of an ainfo is to associate an \"i\" with a particular\n                # action; \"i\" exists for sorting after conflict resolution.\n                ainfo = (i, action)\n    \n                # wait to defer discriminators until we are on their order because\n                # the discriminator may depend on state from a previous order\n                discriminator = undefer(action['discriminator'])\n                action['discriminator'] = discriminator\n    \n                if discriminator is None:\n                    # The discriminator is None, so this action can never conflict.\n                    # We can add it directly to the result.\n                    output.append(ainfo)\n                    continue\n    \n                L = unique.setdefault(discriminator, [])\n                L.append(ainfo)\n    \n            # Check for conflicts\n            conflicts = {}\n            for discriminator, ainfos in unique.items():\n                # We use (includepath, i) as a sort key because we need to\n                # sort the actions by the paths so that the shortest path with a\n                # given prefix comes first.  The \"first\" action is the one with the\n                # shortest include path.  We break sorting ties using \"i\".\n                def bypath(ainfo):\n                    path, i = ainfo[1]['includepath'], ainfo[0]\n                    return path, order, i\n    \n                ainfos.sort(key=bypath)\n                ainfo, rest = ainfos[0], ainfos[1:]\n                _, action = ainfo\n    \n                # ensure this new action does not conflict with a previously\n                # resolved action from an earlier order / invocation\n                prev_ainfo = state.resolved_ainfos.get(discriminator)\n                if prev_ainfo is not None:\n                    _, paction = prev_ainfo\n                    basepath, baseinfo = paction['includepath'], paction['info']\n                    includepath = action['includepath']\n                    # if the new action conflicts with the resolved action then\n                    # note the conflict, otherwise drop the action as it's\n                    # effectively overriden by the previous action\n                    if (includepath[:len(basepath)] != basepath or\n                            includepath == basepath):\n                        L = conflicts.setdefault(discriminator, [baseinfo])\n                        L.append(action['info'])\n    \n                else:\n                    output.append(ainfo)\n    \n                basepath, baseinfo = action['includepath'], action['info']\n                for _, action in rest:\n                    includepath = action['includepath']\n                    # Test whether path is a prefix of opath\n                    if (includepath[:len(basepath)] != basepath or  # not a prefix\n                            includepath == basepath):\n                        L = conflicts.setdefault(discriminator, [baseinfo])\n                        L.append(action['info'])\n    \n            if conflicts:\n>               raise ConfigurationConflictError(conflicts)\nE               pyramid.exceptions.ConfigurationConflictError: Conflicting configuration actions\nE                 For: ('view', None, '', None, 'd41d8cd98f00b204e9800998ecf8427e')\nE                   Line 4 of file /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/pkgs/selfscan/__init__.py:\nE                       def abc(request):\nE                   Line 4 of file /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/pkgs/selfscan/__init__.py:\nE                       def abc(request):\nE                 For: ('view', None, 'two', None, 'd41d8cd98f00b204e9800998ecf8427e')\nE                   Line 4 of file /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/pkgs/selfscan/another.py:\nE                       def two(request):\nE                   Line 4 of file /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/pkgs/selfscan/another.py:\nE                       def two(request):\n\npyramid/config/__init__.py:1342: ConfigurationConflictError\n\nDuring handling of the above exception, another exception occurred:\n\nself = <r2e_tests.test_1.ConfiguratorTests testMethod=test_scan_integration_conflict>\n\n    def test_scan_integration_conflict(self):\n        from pyramid.tests.test_config.pkgs import selfscan\n        from pyramid.config import Configurator\n        c = Configurator()\n        c.scan(selfscan)\n        c.scan(selfscan)\n        try:\n            c.commit()\n        except ConfigurationConflictError as why:\n            def scanconflicts(e):\n                conflicts = e._conflicts.values()\n                for conflict in conflicts:\n                    for confinst in conflict:\n                        yield confinst.src\n            which = list(scanconflicts(why))\n            self.assertEqual(len(which), 4)\n>           self.assertTrue(\"@view_config(renderer='string')\" in which)\nE           AssertionError: False is not true\n\nr2e_tests/test_1.py:1099: AssertionError\n_____________ ConfiguratorTests.test_scan_integration_with_onerror _____________\n\nself = <r2e_tests.test_1.ConfiguratorTests testMethod=test_scan_integration_with_onerror>\n\n    def test_scan_integration_with_onerror(self):\n        # fancy sys.path manipulation here to appease \"setup.py test\" which\n        # fails miserably when it can't import something in the package\n        import sys\n        try:\n            here = os.path.dirname(__file__)\n            path = os.path.join(here, 'path')\n            sys.path.append(path)\n            config = self._makeOne(autocommit=True)\n            class FooException(Exception):\n                pass\n            def onerror(name):\n                raise FooException\n>           self.assertRaises(FooException, config.scan, 'scanerror',\n                              onerror=onerror)\n\nr2e_tests/test_1.py:1078: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \npyramid/config/__init__.py:996: in scan\n    package = self.maybe_dotted(package)\npyramid/config/__init__.py:885: in maybe_dotted\n    return self.name_resolver.maybe_resolve(dotted)\npyramid/path.py:320: in maybe_resolve\n    return self._resolve(dotted, package)\npyramid/path.py:327: in _resolve\n    return self._zope_dottedname_style(dotted, package)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\n    def _zope_dottedname_style(self, value, package):\n        \"\"\" package.module.attr style \"\"\"\n        module = getattr(package, '__name__', None) # package may be None\n        if not module:\n            module = None\n        if value == '.':\n            if module is None:\n                raise ValueError(\n                    'relative name %r irresolveable without package' % (value,)\n                )\n            name = module.split('.')\n        else:\n            name = value.split('.')\n            if not name[0]:\n                if module is None:\n                    raise ValueError(\n                        'relative name %r irresolveable without '\n                        'package' % (value,)\n                        )\n                module = module.split('.')\n                name.pop(0)\n                while not name[0]:\n                    module.pop()\n                    name.pop(0)\n                name = module + name\n    \n        used = name.pop(0)\n>       found = __import__(used)\nE       ModuleNotFoundError: No module named 'scanerror'\n\npyramid/path.py:376: ModuleNotFoundError\n_______ ConfiguratorTests.test_setup_registry_debug_logger_None_default ________\n\nself = <r2e_tests.test_1.ConfiguratorTests testMethod=test_setup_registry_debug_logger_None_default>\n\n    def test_setup_registry_debug_logger_None_default(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDebugLogger\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry()\n        logger = reg.getUtility(IDebugLogger)\n>       self.assertEqual(logger.name, 'pyramid.tests.test_config')\nE       AssertionError: 'r2e_tests' != 'pyramid.tests.test_config'\nE       - r2e_tests\nE       + pyramid.tests.test_config\n\nr2e_tests/test_1.py:485: AssertionError\n____ TestConfigurator_add_directive.test_add_directive_with_custom_callable ____\n\nself = <r2e_tests.test_1.TestConfigurator_add_directive testMethod=test_add_directive_with_custom_callable>\n\n    def test_add_directive_with_custom_callable(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n                'dummy_callable', 'pyramid.tests.test_config.dummy_callable')\n        self.assertTrue(hasattr(config, 'dummy_callable'))\n        config.dummy_callable('discrim')\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n>       self.assertEqual(action['args'], test_config)\nE       AssertionError: <module 'r2e_tests' from '/home/gcpuser/buckets/lo[93 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_1.py:1298: AssertionError\n________ TestConfigurator_add_directive.test_add_directive_with_partial ________\n\nself = <r2e_tests.test_1.TestConfigurator_add_directive testMethod=test_add_directive_with_partial>\n\n    def test_add_directive_with_partial(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n                'dummy_partial', 'pyramid.tests.test_config.dummy_partial')\n        self.assertTrue(hasattr(config, 'dummy_partial'))\n        config.dummy_partial()\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'partial')\n        self.assertEqual(action['callable'], None)\n>       self.assertEqual(action['args'], test_config)\nE       AssertionError: <module 'r2e_tests' from '/home/gcpuser/buckets/lo[93 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_1.py:1285: AssertionError\n_________ TestConfigurator_add_directive.test_extend_with_dotted_name __________\n\nself = <r2e_tests.test_1.TestConfigurator_add_directive testMethod=test_extend_with_dotted_name>\n\n    def test_extend_with_dotted_name(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n            'dummy_extend', 'pyramid.tests.test_config.dummy_extend')\n        self.assertTrue(hasattr(config, 'dummy_extend'))\n        config.dummy_extend('discrim')\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n>       self.assertEqual(action['args'], test_config)\nE       AssertionError: <module 'r2e_tests' from '/home/gcpuser/buckets/lo[93 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_1.py:1272: AssertionError\n_______ TestConfigurator_add_directive.test_extend_with_python_callable ________\n\nself = <r2e_tests.test_1.TestConfigurator_add_directive testMethod=test_extend_with_python_callable>\n\n    def test_extend_with_python_callable(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n            'dummy_extend', dummy_extend)\n        self.assertTrue(hasattr(config, 'dummy_extend'))\n        config.dummy_extend('discrim')\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n>       self.assertEqual(action['args'], test_config)\nE       AssertionError: <module 'r2e_tests' from '/home/gcpuser/buckets/lo[93 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_1.py:1311: AssertionError\n_________ TestConfigurator__add_predicate.test_factory_as_dotted_name __________\n\nself = <r2e_tests.test_1.TestConfigurator__add_predicate testMethod=test_factory_as_dotted_name>\n\n    def test_factory_as_dotted_name(self):\n        config = self._makeOne()\n    \n        def _fakeAction(discriminator, callable=None, args=(),\n                        kw=None, order=0, introspectables=(), **extra):\n            self.assertEqual(len(introspectables), 1)\n            self.assertEqual(introspectables[0]['name'], 'testing')\n            self.assertEqual(introspectables[0]['factory'], DummyPredicate)\n    \n        config.action = _fakeAction\n>       config._add_predicate(\n            'route',\n            'testing',\n            'pyramid.tests.test_config.test_init.DummyPredicate'\n            )\n\nr2e_tests/test_1.py:1375: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \npyramid/config/__init__.py:540: in _add_predicate\n    self.action(discriminator, register, introspectables=(intr,),\nr2e_tests/test_1.py:1372: in _fakeAction\n    self.assertEqual(introspectables[0]['factory'], DummyPredicate)\nE   AssertionError: <class 'pyramid.tests.test_config.test_init.DummyPredicate'> != <class 'r2e_tests.test_1.DummyPredicate'>\n__ AdaptersConfiguratorMixinTests.test_add_resource_url_adapter_dotted_names ___\n\nself = <r2e_tests.test_config.test_adapters.AdaptersConfiguratorMixinTests testMethod=test_add_resource_url_adapter_dotted_names>\n\n    def test_add_resource_url_adapter_dotted_names(self):\n        from pyramid.interfaces import IResourceURL\n        config = self._makeOne(autocommit=True)\n        config.add_resource_url_adapter(\n            'pyramid.tests.test_config.test_adapters.DummyResourceURL',\n            'pyramid.tests.test_config.test_adapters.DummyIface',\n            )\n        iface = DummyIface()\n>       adapter = config.registry.getMultiAdapter((iface, iface),\n                                                    IResourceURL)\n\nr2e_tests/test_config/test_adapters.py:280: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <Registry r2e_tests.test_config>\nobjects = (<r2e_tests.test_config.test_adapters.DummyIface object at 0x7384d1618160>, <r2e_tests.test_config.test_adapters.DummyIface object at 0x7384d1618160>)\ninterface = <InterfaceClass pyramid.interfaces.IResourceURL>, name = ''\n\n    def getMultiAdapter(self, objects, interface, name=''):\n        adapter = self.adapters.queryMultiAdapter(objects, interface, name)\n        if adapter is None:\n>           raise ComponentLookupError(objects, interface, name)\nE           zope.interface.interfaces.ComponentLookupError: ((<r2e_tests.test_config.test_adapters.DummyIface object at 0x7384d1618160>, <r2e_tests.test_config.test_adapters.DummyIface object at 0x7384d1618160>), <InterfaceClass pyramid.interfaces.IResourceURL>, '')\n\n.venv/lib/python3.8/site-packages/zope/interface/registry.py:379: ComponentLookupError\n_ AdaptersConfiguratorMixinTests.test_add_resource_url_adapter_introspectables _\n\nself = <r2e_tests.test_config.test_adapters.AdaptersConfiguratorMixinTests testMethod=test_add_resource_url_adapter_introspectables>\n\n    def test_add_resource_url_adapter_introspectables(self):\n        config = self._makeOne()\n        config.add_resource_url_adapter(DummyResourceURL, DummyIface)\n        actions = config.action_state.actions\n        self.assertEqual(len(actions), 1)\n        intrs  = actions[0]['introspectables']\n        self.assertEqual(len(intrs), 1)\n        intr = intrs[0]\n        self.assertEqual(intr.type_name, 'resource url adapter')\n        self.assertEqual(intr.discriminator,\n                         ('resource url adapter', DummyIface))\n        self.assertEqual(intr.category_name, 'resource url adapters')\n>       self.assertEqual(\n            intr.title,\n            \"resource url adapter for resource iface \"\n            \"<class 'pyramid.tests.test_config.test_adapters.DummyIface'>\"\n            )\nE       AssertionError: \"reso[34 chars]e <class 'r2e_tests.test_config.test_adapters.DummyIface'>\" != \"reso[34 chars]e <class 'pyramid.tests.test_config.test_adapters.DummyIface'>\"\nE       - resource url adapter for resource iface <class 'r2e_tests.test_config.test_adapters.DummyIface'>\nE       ?                                                  ^^^\nE       + resource url adapter for resource iface <class 'pyramid.tests.test_config.test_adapters.DummyIface'>\nE       ?                                                 ++ ^^^^^\n\nr2e_tests/test_config/test_adapters.py:326: AssertionError\n________ AdaptersConfiguratorMixinTests.test_add_traverser_dotted_names ________\n\nself = <r2e_tests.test_config.test_adapters.AdaptersConfiguratorMixinTests testMethod=test_add_traverser_dotted_names>\n\n    def test_add_traverser_dotted_names(self):\n        from pyramid.interfaces import ITraverser\n        config = self._makeOne(autocommit=True)\n        config.add_traverser(\n            'pyramid.tests.test_config.test_adapters.DummyTraverser',\n            'pyramid.tests.test_config.test_adapters.DummyIface')\n        iface = DummyIface()\n>       traverser = config.registry.getAdapter(iface, ITraverser)\n\nr2e_tests/test_config/test_adapters.py:237: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <Registry r2e_tests.test_config>\nobject = <r2e_tests.test_config.test_adapters.DummyIface object at 0x7384d0ec5dc0>\ninterface = <InterfaceClass pyramid.interfaces.ITraverser>, name = ''\n\n    def getAdapter(self, object, interface, name=''):\n        adapter = self.adapters.queryAdapter(object, interface, name)\n        if adapter is None:\n>           raise ComponentLookupError(object, interface, name)\nE           zope.interface.interfaces.ComponentLookupError: (<r2e_tests.test_config.test_adapters.DummyIface object at 0x7384d0ec5dc0>, <InterfaceClass pyramid.interfaces.ITraverser>, '')\n\n.venv/lib/python3.8/site-packages/zope/interface/registry.py:368: ComponentLookupError\n___ TestAssetsConfiguratorMixin.test_override_asset_directory_with_directory ___\n\nself = <r2e_tests.test_config.test_assets.TestAssetsConfiguratorMixin testMethod=test_override_asset_directory_with_directory>\n\n    def test_override_asset_directory_with_directory(self):\n        from pyramid.config.assets import PackageAssetSource\n        config = self._makeOne(autocommit=True)\n        override = DummyUnderOverride()\n        config.override_asset(\n            'pyramid.tests.test_config.pkgs.asset:templates/',\n            'pyramid.tests.test_config.pkgs.asset.subpackage:templates/',\n            _override=override)\n        from pyramid.tests.test_config.pkgs import asset\n        from pyramid.tests.test_config.pkgs.asset import subpackage\n        self.assertEqual(override.package, asset)\n        self.assertEqual(override.path, 'templates/')\n        source = override.source\n        self.assertTrue(isinstance(source, PackageAssetSource))\n        self.assertEqual(source.package, subpackage)\n        self.assertEqual(source.prefix, 'templates/')\n    \n        resource_name = 'bar.pt'\n        expected = os.path.join(here, 'pkgs', 'asset',\n                                'subpackage', 'templates', 'bar.pt')\n>       self.assertEqual(override.source.get_filename(resource_name),\n                         expected)\nE       AssertionError: '/hom[90 chars]f3ab/pyramid/tests/test_config/pkgs/asset/subp[19 chars]r.pt' != '/hom[90 chars]f3ab/r2e_tests/test_config/pkgs/asset/subpacka[15 chars]r.pt'\nE       - /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/pkgs/asset/subpackage/templates/bar.pt\nE       ?                                                                                                    -- ^^^^^\nE       + /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/test_config/pkgs/asset/subpackage/templates/bar.pt\nE       ?                                                                                                     ^^^\n\nr2e_tests/test_config/test_assets.py:106: AssertionError\n____ TestAssetsConfiguratorMixin.test_override_asset_directory_with_package ____\n\nself = <r2e_tests.test_config.test_assets.TestAssetsConfiguratorMixin testMethod=test_override_asset_directory_with_package>\n\n    def test_override_asset_directory_with_package(self):\n        from pyramid.config.assets import PackageAssetSource\n        config = self._makeOne(autocommit=True)\n        override = DummyUnderOverride()\n        config.override_asset(\n            'pyramid.tests.test_config.pkgs.asset:templates/',\n            'pyramid.tests.test_config.pkgs.asset.subpackage',\n            _override=override)\n        from pyramid.tests.test_config.pkgs import asset\n        from pyramid.tests.test_config.pkgs.asset import subpackage\n        self.assertEqual(override.package, asset)\n        self.assertEqual(override.path, 'templates/')\n        source = override.source\n        self.assertTrue(isinstance(source, PackageAssetSource))\n        self.assertEqual(source.package, subpackage)\n        self.assertEqual(source.prefix, '')\n    \n        resource_name = 'templates/bar.pt'\n        expected = os.path.join(here, 'pkgs', 'asset',\n                                'subpackage', 'templates', 'bar.pt')\n>       self.assertEqual(override.source.get_filename(resource_name),\n                         expected)\nE       AssertionError: '/hom[90 chars]f3ab/pyramid/tests/test_config/pkgs/asset/subp[19 chars]r.pt' != '/hom[90 chars]f3ab/r2e_tests/test_config/pkgs/asset/subpacka[15 chars]r.pt'\nE       - /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/pkgs/asset/subpackage/templates/bar.pt\nE       ?                                                                                                    -- ^^^^^\nE       + /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/test_config/pkgs/asset/subpackage/templates/bar.pt\nE       ?                                                                                                     ^^^\n\nr2e_tests/test_config/test_assets.py:129: AssertionError\n________ TestAssetsConfiguratorMixin.test_override_asset_file_with_file ________\n\nself = <r2e_tests.test_config.test_assets.TestAssetsConfiguratorMixin testMethod=test_override_asset_file_with_file>\n\n    def test_override_asset_file_with_file(self):\n        from pyramid.config.assets import PackageAssetSource\n        config = self._makeOne(autocommit=True)\n        override = DummyUnderOverride()\n        config.override_asset(\n            'pyramid.tests.test_config.pkgs.asset:templates/foo.pt',\n            'pyramid.tests.test_config.pkgs.asset.subpackage:templates/bar.pt',\n            _override=override)\n        from pyramid.tests.test_config.pkgs import asset\n        from pyramid.tests.test_config.pkgs.asset import subpackage\n        self.assertEqual(override.package, asset)\n        self.assertEqual(override.path, 'templates/foo.pt')\n        source = override.source\n        self.assertTrue(isinstance(source, PackageAssetSource))\n        self.assertEqual(source.package, subpackage)\n        self.assertEqual(source.prefix, 'templates/bar.pt')\n    \n        resource_name = ''\n        expected = os.path.join(here, 'pkgs', 'asset',\n                                'subpackage', 'templates', 'bar.pt')\n>       self.assertEqual(override.source.get_filename(resource_name),\n                         expected)\nE       AssertionError: '/hom[90 chars]f3ab/pyramid/tests/test_config/pkgs/asset/subp[19 chars]r.pt' != '/hom[90 chars]f3ab/r2e_tests/test_config/pkgs/asset/subpacka[15 chars]r.pt'\nE       - /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/pkgs/asset/subpackage/templates/bar.pt\nE       ?                                                                                                    -- ^^^^^\nE       + /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/test_config/pkgs/asset/subpackage/templates/bar.pt\nE       ?                                                                                                     ^^^\n\nr2e_tests/test_config/test_assets.py:60: AssertionError\n____ TestAssetsConfiguratorMixin.test_override_asset_package_with_directory ____\n\nself = <r2e_tests.test_config.test_assets.TestAssetsConfiguratorMixin testMethod=test_override_asset_package_with_directory>\n\n    def test_override_asset_package_with_directory(self):\n        from pyramid.config.assets import PackageAssetSource\n        config = self._makeOne(autocommit=True)\n        override = DummyUnderOverride()\n        config.override_asset(\n            'pyramid.tests.test_config.pkgs.asset',\n            'pyramid.tests.test_config.pkgs.asset.subpackage:templates/',\n            _override=override)\n        from pyramid.tests.test_config.pkgs import asset\n        from pyramid.tests.test_config.pkgs.asset import subpackage\n        self.assertEqual(override.package, asset)\n        self.assertEqual(override.path, '')\n        source = override.source\n        self.assertTrue(isinstance(source, PackageAssetSource))\n        self.assertEqual(source.package, subpackage)\n        self.assertEqual(source.prefix, 'templates/')\n    \n        resource_name = 'bar.pt'\n        expected = os.path.join(here, 'pkgs', 'asset',\n                                'subpackage', 'templates', 'bar.pt')\n>       self.assertEqual(override.source.get_filename(resource_name),\n                         expected)\nE       AssertionError: '/hom[90 chars]f3ab/pyramid/tests/test_config/pkgs/asset/subp[19 chars]r.pt' != '/hom[90 chars]f3ab/r2e_tests/test_config/pkgs/asset/subpacka[15 chars]r.pt'\nE       - /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/pkgs/asset/subpackage/templates/bar.pt\nE       ?                                                                                                    -- ^^^^^\nE       + /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/test_config/pkgs/asset/subpackage/templates/bar.pt\nE       ?                                                                                                     ^^^\n\nr2e_tests/test_config/test_assets.py:152: AssertionError\n_____ TestAssetsConfiguratorMixin.test_override_asset_package_with_package _____\n\nself = <r2e_tests.test_config.test_assets.TestAssetsConfiguratorMixin testMethod=test_override_asset_package_with_package>\n\n    def test_override_asset_package_with_package(self):\n        from pyramid.config.assets import PackageAssetSource\n        config = self._makeOne(autocommit=True)\n        override = DummyUnderOverride()\n        config.override_asset(\n            'pyramid.tests.test_config.pkgs.asset',\n            'pyramid.tests.test_config.pkgs.asset.subpackage',\n            _override=override)\n        from pyramid.tests.test_config.pkgs import asset\n        from pyramid.tests.test_config.pkgs.asset import subpackage\n        self.assertEqual(override.package, asset)\n        self.assertEqual(override.path, '')\n        source = override.source\n        self.assertTrue(isinstance(source, PackageAssetSource))\n        self.assertEqual(source.package, subpackage)\n        self.assertEqual(source.prefix, '')\n    \n        resource_name = 'templates/bar.pt'\n        expected = os.path.join(here, 'pkgs', 'asset',\n                                'subpackage', 'templates', 'bar.pt')\n>       self.assertEqual(override.source.get_filename(resource_name),\n                         expected)\nE       AssertionError: '/hom[90 chars]f3ab/pyramid/tests/test_config/pkgs/asset/subp[19 chars]r.pt' != '/hom[90 chars]f3ab/r2e_tests/test_config/pkgs/asset/subpacka[15 chars]r.pt'\nE       - /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/pkgs/asset/subpackage/templates/bar.pt\nE       ?                                                                                                    -- ^^^^^\nE       + /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/test_config/pkgs/asset/subpackage/templates/bar.pt\nE       ?                                                                                                     ^^^\n\nr2e_tests/test_config/test_assets.py:83: AssertionError\n_________ TestOverrideProvider.test_get_resource_filename_no_overrides _________\n\nself = <r2e_tests.test_config.test_assets.TestOverrideProvider testMethod=test_get_resource_filename_no_overrides>\n\n    def test_get_resource_filename_no_overrides(self):\n        resource_name = 'test_assets.py'\n        import pyramid.tests.test_config\n        provider = self._makeOne(pyramid.tests.test_config)\n        expected = os.path.join(here, resource_name)\n        result = provider.get_resource_filename(None, resource_name)\n>       self.assertEqual(result, expected)\nE       AssertionError: '/hom[73 chars]76c6d03e3d314979af3ab/pyramid/tests/test_config/test_assets.py' != '/hom[73 chars]76c6d03e3d314979af3ab/r2e_tests/test_config/test_assets.py'\nE       - /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/test_assets.py\nE       ?                                                                                                    -- ^^^^^\nE       + /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/test_config/test_assets.py\nE       ?                                                                                                     ^^^\n\nr2e_tests/test_config/test_assets.py:297: AssertionError\n____ TestOverrideProvider.test_get_resource_filename_override_returns_None _____\n\nself = <r2e_tests.test_config.test_assets.TestOverrideProvider testMethod=test_get_resource_filename_override_returns_None>\n\n    def test_get_resource_filename_override_returns_None(self):\n        overrides = DummyOverrides(None)\n        self._registerOverrides(overrides)\n        resource_name = 'test_assets.py'\n        import pyramid.tests.test_config\n        provider = self._makeOne(pyramid.tests.test_config)\n        expected = os.path.join(here, resource_name)\n        result = provider.get_resource_filename(None, resource_name)\n>       self.assertEqual(result, expected)\nE       AssertionError: '/hom[73 chars]76c6d03e3d314979af3ab/pyramid/tests/test_config/test_assets.py' != '/hom[73 chars]76c6d03e3d314979af3ab/r2e_tests/test_config/test_assets.py'\nE       - /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/test_assets.py\nE       ?                                                                                                    -- ^^^^^\nE       + /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/test_config/test_assets.py\nE       ?                                                                                                     ^^^\n\nr2e_tests/test_config/test_assets.py:345: AssertionError\n___________________ TestPackageAssetSource.test_get_filename ___________________\n\nself = <r2e_tests.test_config.test_assets.TestPackageAssetSource testMethod=test_get_filename>\n\n    def test_get_filename(self):\n        source = self._makeOne('')\n>       self.assertEqual(source.get_filename('test_assets.py'),\n                         os.path.join(here, 'test_assets.py'))\nE       AssertionError: '/hom[73 chars]76c6d03e3d314979af3ab/pyramid/tests/test_config/test_assets.py' != '/hom[73 chars]76c6d03e3d314979af3ab/r2e_tests/test_config/test_assets.py'\nE       - /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/test_assets.py\nE       ?                                                                                                    -- ^^^^^\nE       + /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/test_config/test_assets.py\nE       ?                                                                                                     ^^^\n\nr2e_tests/test_config/test_assets.py:716: AssertionError\n_____________ TestPackageAssetSource.test_get_filename_with_prefix _____________\n\nself = <r2e_tests.test_config.test_assets.TestPackageAssetSource testMethod=test_get_filename_with_prefix>\n\n    def test_get_filename_with_prefix(self):\n        source = self._makeOne('test_assets.py')\n>       self.assertEqual(source.get_filename(''),\n                         os.path.join(here, 'test_assets.py'))\nE       AssertionError: '/hom[73 chars]76c6d03e3d314979af3ab/pyramid/tests/test_config/test_assets.py' != '/hom[73 chars]76c6d03e3d314979af3ab/r2e_tests/test_config/test_assets.py'\nE       - /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/test_assets.py\nE       ?                                                                                                    -- ^^^^^\nE       + /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/test_config/test_assets.py\nE       ?                                                                                                     ^^^\n\nr2e_tests/test_config/test_assets.py:721: AssertionError\n_________ TestI18NConfiguratorMixin.test_add_translation_dirs_abspath __________\n\nself = <r2e_tests.test_config.test_i18n.TestI18NConfiguratorMixin testMethod=test_add_translation_dirs_abspath>\n\n    def test_add_translation_dirs_abspath(self):\n        from pyramid.interfaces import ITranslationDirectories\n        config = self._makeOne(autocommit=True)\n>       config.add_translation_dirs(locale)\n\nr2e_tests/test_config/test_i18n.py:102: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \npyramid/util.py:588: in wrapper\n    result = wrapped(self, *arg, **kw)\npyramid/config/i18n.py:118: in add_translation_dirs\n    self.action(None, register, introspectables=introspectables)\npyramid/config/__init__.py:610: in action\n    callable(*args, **kw)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\n    def register():\n        directories = []\n        resolver = AssetResolver(self.package_name)\n    \n        # defer spec resolution until register to allow for asset\n        # overrides to take place in an earlier config phase\n        for spec in specs:\n            # the trailing slash helps match asset overrides for folders\n            if not spec.endswith('/'):\n                spec += '/'\n            asset = resolver.resolve(spec)\n            directory = asset.abspath()\n            if not asset.isdir():\n>               raise ConfigurationError('\"%s\" is not a directory' %\n                                        directory)\nE               pyramid.exceptions.ConfigurationError: \"/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale\" is not a directory\n\npyramid/config/i18n.py:99: ConfigurationError\n________ TestI18NConfiguratorMixin.test_add_translation_dirs_asset_spec ________\n\nself = <r2e_tests.test_config.test_i18n.TestI18NConfiguratorMixin testMethod=test_add_translation_dirs_asset_spec>\n\n    def test_add_translation_dirs_asset_spec(self):\n        from pyramid.interfaces import ITranslationDirectories\n        config = self._makeOne(autocommit=True)\n        config.add_translation_dirs('pyramid.tests.pkgs.localeapp:locale')\n>       self.assertEqual(config.registry.getUtility(ITranslationDirectories),\n                         [locale])\nE       AssertionError: Lists differ: ['/ho[70 chars]86c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale'] != ['/ho[70 chars]86c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale']\nE       \nE       First differing element 0:\nE       '/hom[68 chars]586c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale'\nE       '/hom[68 chars]586c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale'\nE       \nE       - ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale']\nE       ?                                                                                                      -- ^^^^^\nE       \nE       + ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale']\nE       ?                                                                                                       ^^^\n\nr2e_tests/test_config/test_i18n.py:53: AssertionError\n_ TestI18NConfiguratorMixin.test_add_translation_dirs_asset_spec_existing_translation_dirs _\n\nself = <r2e_tests.test_config.test_i18n.TestI18NConfiguratorMixin testMethod=test_add_translation_dirs_asset_spec_existing_translation_dirs>\n\n    def test_add_translation_dirs_asset_spec_existing_translation_dirs(self):\n        from pyramid.interfaces import ITranslationDirectories\n        config = self._makeOne(autocommit=True)\n        directories = ['abc']\n        config.registry.registerUtility(directories, ITranslationDirectories)\n        config.add_translation_dirs('pyramid.tests.pkgs.localeapp:locale')\n        result = config.registry.getUtility(ITranslationDirectories)\n>       self.assertEqual(result, [locale, 'abc'])\nE       AssertionError: Lists differ: ['/ho[77 chars]6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale', 'abc'] != ['/ho[77 chars]6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale', 'abc']\nE       \nE       First differing element 0:\nE       '/hom[68 chars]586c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale'\nE       '/hom[68 chars]586c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale'\nE       \nE       - ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale',\nE       ?                                                                                                      -- ^^^^^\nE       \nE       + ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale',\nE       ?                                                                                                       ^^^\nE       \nE          'abc']\n\nr2e_tests/test_config/test_i18n.py:63: AssertionError\n_ TestI18NConfiguratorMixin.test_add_translation_dirs_doesnt_use_override_w_autocommit _\n\nself = <r2e_tests.test_config.test_i18n.TestI18NConfiguratorMixin testMethod=test_add_translation_dirs_doesnt_use_override_w_autocommit>\n\n    def test_add_translation_dirs_doesnt_use_override_w_autocommit(self):\n        from pyramid.interfaces import ITranslationDirectories\n        config = self._makeOne(autocommit=True)\n        config.add_translation_dirs('pyramid.tests.pkgs.localeapp:locale')\n        config.override_asset('pyramid.tests.pkgs.localeapp:locale/',\n                              'pyramid.tests.pkgs.localeapp:locale2/')\n>       self.assertEqual(config.registry.getUtility(ITranslationDirectories),\n                         [locale])\nE       AssertionError: Lists differ: ['/ho[70 chars]86c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale'] != ['/ho[70 chars]86c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale']\nE       \nE       First differing element 0:\nE       '/hom[68 chars]586c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale'\nE       '/hom[68 chars]586c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale'\nE       \nE       - ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale']\nE       ?                                                                                                      -- ^^^^^\nE       \nE       + ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale']\nE       ?                                                                                                       ^^^\n\nr2e_tests/test_config/test_i18n.py:122: AssertionError\n______ TestI18NConfiguratorMixin.test_add_translation_dirs_multiple_specs ______\n\nself = <r2e_tests.test_config.test_i18n.TestI18NConfiguratorMixin testMethod=test_add_translation_dirs_multiple_specs>\n\n    def test_add_translation_dirs_multiple_specs(self):\n        from pyramid.interfaces import ITranslationDirectories\n        config = self._makeOne(autocommit=True)\n        config.add_translation_dirs('pyramid.tests.pkgs.localeapp:locale',\n                                    'pyramid.tests.pkgs.localeapp:locale2')\n>       self.assertEqual(config.registry.getUtility(ITranslationDirectories),\n                         [locale, locale2])\nE       AssertionError: Lists differ: ['/ho[91 chars]f3ab/pyramid/tests/pkgs/localeapp/locale', '/h[130 chars]le2'] != ['/ho[91 chars]f3ab/r2e_tests/pkgs/localeapp/locale', '/home/[122 chars]le2']\nE       \nE       First differing element 0:\nE       '/hom[68 chars]586c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale'\nE       '/hom[68 chars]586c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale'\nE       \nE       Diff is 1002 characters long. Set self.maxDiff to None to see it.\n\nr2e_tests/test_config/test_i18n.py:70: AssertionError\n_ TestI18NConfiguratorMixin.test_add_translation_dirs_multiple_specs_multiple_calls _\n\nself = <r2e_tests.test_config.test_i18n.TestI18NConfiguratorMixin testMethod=test_add_translation_dirs_multiple_specs_multiple_calls>\n\n    def test_add_translation_dirs_multiple_specs_multiple_calls(self):\n        from pyramid.interfaces import ITranslationDirectories\n        config = self._makeOne(autocommit=True)\n        config.add_translation_dirs('pyramid.tests.pkgs.localeapp:locale',\n                                    'pyramid.tests.pkgs.localeapp:locale2')\n        config.add_translation_dirs('pyramid.tests.pkgs.localeapp:locale3')\n>       self.assertEqual(config.registry.getUtility(ITranslationDirectories),\n                         [locale3, locale, locale2])\nE       AssertionError: Lists differ: ['/ho[91 chars]f3ab/pyramid/tests/pkgs/localeapp/locale3', '/[269 chars]le2'] != ['/ho[91 chars]f3ab/r2e_tests/pkgs/localeapp/locale3', '/home[257 chars]le2']\nE       \nE       First differing element 0:\nE       '/hom[69 chars]86c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale3'\nE       '/hom[69 chars]86c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale3'\nE       \nE       Diff is 1504 characters long. Set self.maxDiff to None to see it.\n\nr2e_tests/test_config/test_i18n.py:79: AssertionError\n_ TestI18NConfiguratorMixin.test_add_translation_dirs_override_multiple_specs_multiple_calls _\n\nself = <r2e_tests.test_config.test_i18n.TestI18NConfiguratorMixin testMethod=test_add_translation_dirs_override_multiple_specs_multiple_calls>\n\n    def test_add_translation_dirs_override_multiple_specs_multiple_calls(self):\n        from pyramid.interfaces import ITranslationDirectories\n        config = self._makeOne(autocommit=True)\n        config.add_translation_dirs('pyramid.tests.pkgs.localeapp:locale',\n                                    'pyramid.tests.pkgs.localeapp:locale2')\n        config.add_translation_dirs('pyramid.tests.pkgs.localeapp:locale3',\n                                    override=True)\n>       self.assertEqual(config.registry.getUtility(ITranslationDirectories),\n                         [locale, locale2, locale3])\nE       AssertionError: Lists differ: ['/ho[91 chars]f3ab/pyramid/tests/pkgs/localeapp/locale', '/h[269 chars]le3'] != ['/ho[91 chars]f3ab/r2e_tests/pkgs/localeapp/locale', '/home/[257 chars]le3']\nE       \nE       First differing element 0:\nE       '/hom[68 chars]586c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale'\nE       '/hom[68 chars]586c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale'\nE       \nE       Diff is 1504 characters long. Set self.maxDiff to None to see it.\n\nr2e_tests/test_config/test_i18n.py:89: AssertionError\n_ TestI18NConfiguratorMixin.test_add_translation_dirs_uses_override_out_of_order _\n\nself = <r2e_tests.test_config.test_i18n.TestI18NConfiguratorMixin testMethod=test_add_translation_dirs_uses_override_out_of_order>\n\n    def test_add_translation_dirs_uses_override_out_of_order(self):\n        from pyramid.interfaces import ITranslationDirectories\n        config = self._makeOne()\n        config.add_translation_dirs('pyramid.tests.pkgs.localeapp:locale')\n        config.override_asset('pyramid.tests.pkgs.localeapp:locale/',\n                              'pyramid.tests.pkgs.localeapp:locale2/')\n        config.commit()\n>       self.assertEqual(config.registry.getUtility(ITranslationDirectories),\n                         [locale2])\nE       AssertionError: Lists differ: ['/ho[71 chars]6c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale2'] != ['/ho[71 chars]6c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale2']\nE       \nE       First differing element 0:\nE       '/hom[69 chars]86c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale2'\nE       '/hom[69 chars]86c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale2'\nE       \nE       - ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale2']\nE       ?                                                                                                      -- ^^^^^\nE       \nE       + ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale2']\nE       ?                                                                                                       ^^^\n\nr2e_tests/test_config/test_i18n.py:113: AssertionError\n_ TestI18NConfiguratorMixin.test_add_translation_dirs_uses_override_w_autocommit _\n\nself = <r2e_tests.test_config.test_i18n.TestI18NConfiguratorMixin testMethod=test_add_translation_dirs_uses_override_w_autocommit>\n\n    def test_add_translation_dirs_uses_override_w_autocommit(self):\n        from pyramid.interfaces import ITranslationDirectories\n        config = self._makeOne(autocommit=True)\n        config.override_asset('pyramid.tests.pkgs.localeapp:locale/',\n                              'pyramid.tests.pkgs.localeapp:locale2/')\n        config.add_translation_dirs('pyramid.tests.pkgs.localeapp:locale')\n>       self.assertEqual(config.registry.getUtility(ITranslationDirectories),\n                         [locale2])\nE       AssertionError: Lists differ: ['/ho[71 chars]6c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale2'] != ['/ho[71 chars]6c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale2']\nE       \nE       First differing element 0:\nE       '/hom[69 chars]86c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale2'\nE       '/hom[69 chars]86c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale2'\nE       \nE       - ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale2']\nE       ?                                                                                                      -- ^^^^^\nE       \nE       + ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale2']\nE       ?                                                                                                       ^^^\n\nr2e_tests/test_config/test_i18n.py:131: AssertionError\n___________________ ConfiguratorTests.test_ctor_no_registry ____________________\n\nself = <r2e_tests.test_config.test_init.ConfiguratorTests testMethod=test_ctor_no_registry>\n\n    def test_ctor_no_registry(self):\n        import sys\n        from pyramid.interfaces import ISettings\n        from pyramid.config import Configurator\n        from pyramid.interfaces import IRendererFactory\n        config = Configurator()\n        this_pkg = sys.modules['pyramid.tests.test_config']\n        self.assertTrue(config.registry.getUtility(ISettings))\n>       self.assertEqual(config.package, this_pkg)\nE       AssertionError: <module 'r2e_tests.test_config' from '/home/gcpuse[117 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_config/test_init.py:68: AssertionError\n_________ ConfiguratorTests.test_ctor_noreg_debug_logger_None_default __________\n\nself = <r2e_tests.test_config.test_init.ConfiguratorTests testMethod=test_ctor_noreg_debug_logger_None_default>\n\n    def test_ctor_noreg_debug_logger_None_default(self):\n        from pyramid.interfaces import IDebugLogger\n        config = self._makeOne()\n        logger = config.registry.getUtility(IDebugLogger)\n>       self.assertEqual(logger.name, 'pyramid.tests.test_config')\nE       AssertionError: 'r2e_tests.test_config' != 'pyramid.tests.test_config'\nE       - r2e_tests.test_config\nE       ?  ^^^\nE       + pyramid.tests.test_config\nE       ? ++ ^^^^^\n\nr2e_tests/test_config/test_init.py:165: AssertionError\n_____________ ConfiguratorTests.test_include_constant_root_package _____________\n\nself = <r2e_tests.test_config.test_init.ConfiguratorTests testMethod=test_include_constant_root_package>\n\n    def test_include_constant_root_package(self):\n        from pyramid import tests\n        from pyramid.tests import test_config\n        config = self._makeOne(root_package=tests)\n        results = {}\n        def include(config):\n            results['package'] = config.package\n            results['root_package'] = config.root_package\n        config.include(include)\n        self.assertEqual(results['root_package'], tests)\n>       self.assertEqual(results['package'], test_config)\nE       AssertionError: <module 'r2e_tests.test_config' from '/home/gcpuse[117 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_config/test_init.py:818: AssertionError\n_______________ ConfiguratorTests.test_scan_integration_conflict _______________\n\nself = <r2e_tests.test_config.test_init.ConfiguratorTests testMethod=test_scan_integration_conflict>\n\n    def test_scan_integration_conflict(self):\n        from pyramid.tests.test_config.pkgs import selfscan\n        from pyramid.config import Configurator\n        c = Configurator()\n        c.scan(selfscan)\n        c.scan(selfscan)\n        try:\n>           c.commit()\n\nr2e_tests/test_config/test_init.py:1090: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \npyramid/config/__init__.py:657: in commit\n    self.action_state.execute_actions(introspector=self.introspector)\npyramid/config/__init__.py:1160: in execute_actions\n    action = next(action_iter, None)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nactions = [{'args': (), 'callable': <function ViewsConfiguratorMixin.add_view.<locals>.register at 0x7384d158a790>, 'discriminat...84d0dbfd30>, 'discriminator': ('view', None, 'two', None, 'd41d8cd98f00b204e9800998ecf8427e'), 'includepath': (), ...}]\nstate = <pyramid.config.ConflictResolverState object at 0x7384d11433d0>\n\n    def resolveConflicts(actions, state=None):\n        \"\"\"Resolve conflicting actions\n    \n        Given an actions list, identify and try to resolve conflicting actions.\n        Actions conflict if they have the same non-None discriminator.\n    \n        Conflicting actions can be resolved if the include path of one of\n        the actions is a prefix of the includepaths of the other\n        conflicting actions and is unequal to the include paths in the\n        other conflicting actions.\n    \n        Actions are resolved on a per-order basis because some discriminators\n        cannot be computed until earlier actions have executed. An action in an\n        earlier order may execute successfully only to find out later that it was\n        overridden by another action with a smaller include path. This will result\n        in a conflict as there is no way to revert the original action.\n    \n        ``state`` may be an instance of ``ConflictResolverState`` that\n        can be used to resume execution and resolve the new actions against the\n        list of executed actions from a previous call.\n    \n        \"\"\"\n        if state is None:\n            state = ConflictResolverState()\n    \n        # pick up where we left off last time, but track the new actions as well\n        state.remaining_actions.extend(normalize_actions(actions))\n        actions = state.remaining_actions\n    \n        def orderandpos(v):\n            n, v = v\n            return (v['order'] or 0, n)\n    \n        def orderonly(v):\n            n, v = v\n            return v['order'] or 0\n    \n        sactions = sorted(enumerate(actions, start=state.start), key=orderandpos)\n        for order, actiongroup in itertools.groupby(sactions, orderonly):\n            # \"order\" is an integer grouping. Actions in a lower order will be\n            # executed before actions in a higher order.  All of the actions in\n            # one grouping will be executed (its callable, if any will be called)\n            # before any of the actions in the next.\n            output = []\n            unique = {}\n    \n            # error out if we went backward in order\n            if state.min_order is not None and order < state.min_order:\n                r = ['Actions were added to order={0} after execution had moved '\n                     'on to order={1}. Conflicting actions: '\n                     .format(order, state.min_order)]\n                for i, action in actiongroup:\n                    for line in str(action['info']).rstrip().split('\\n'):\n                        r.append(\"  \" + line)\n                raise ConfigurationError('\\n'.join(r))\n    \n            for i, action in actiongroup:\n                # Within an order, actions are executed sequentially based on\n                # original action ordering (\"i\").\n    \n                # \"ainfo\" is a tuple of (i, action) where \"i\" is an integer\n                # expressing the relative position of this action in the action\n                # list being resolved, and \"action\" is an action dictionary.  The\n                # purpose of an ainfo is to associate an \"i\" with a particular\n                # action; \"i\" exists for sorting after conflict resolution.\n                ainfo = (i, action)\n    \n                # wait to defer discriminators until we are on their order because\n                # the discriminator may depend on state from a previous order\n                discriminator = undefer(action['discriminator'])\n                action['discriminator'] = discriminator\n    \n                if discriminator is None:\n                    # The discriminator is None, so this action can never conflict.\n                    # We can add it directly to the result.\n                    output.append(ainfo)\n                    continue\n    \n                L = unique.setdefault(discriminator, [])\n                L.append(ainfo)\n    \n            # Check for conflicts\n            conflicts = {}\n            for discriminator, ainfos in unique.items():\n                # We use (includepath, i) as a sort key because we need to\n                # sort the actions by the paths so that the shortest path with a\n                # given prefix comes first.  The \"first\" action is the one with the\n                # shortest include path.  We break sorting ties using \"i\".\n                def bypath(ainfo):\n                    path, i = ainfo[1]['includepath'], ainfo[0]\n                    return path, order, i\n    \n                ainfos.sort(key=bypath)\n                ainfo, rest = ainfos[0], ainfos[1:]\n                _, action = ainfo\n    \n                # ensure this new action does not conflict with a previously\n                # resolved action from an earlier order / invocation\n                prev_ainfo = state.resolved_ainfos.get(discriminator)\n                if prev_ainfo is not None:\n                    _, paction = prev_ainfo\n                    basepath, baseinfo = paction['includepath'], paction['info']\n                    includepath = action['includepath']\n                    # if the new action conflicts with the resolved action then\n                    # note the conflict, otherwise drop the action as it's\n                    # effectively overriden by the previous action\n                    if (includepath[:len(basepath)] != basepath or\n                            includepath == basepath):\n                        L = conflicts.setdefault(discriminator, [baseinfo])\n                        L.append(action['info'])\n    \n                else:\n                    output.append(ainfo)\n    \n                basepath, baseinfo = action['includepath'], action['info']\n                for _, action in rest:\n                    includepath = action['includepath']\n                    # Test whether path is a prefix of opath\n                    if (includepath[:len(basepath)] != basepath or  # not a prefix\n                            includepath == basepath):\n                        L = conflicts.setdefault(discriminator, [baseinfo])\n                        L.append(action['info'])\n    \n            if conflicts:\n>               raise ConfigurationConflictError(conflicts)\nE               pyramid.exceptions.ConfigurationConflictError: Conflicting configuration actions\nE                 For: ('view', None, '', None, 'd41d8cd98f00b204e9800998ecf8427e')\nE                   Line 4 of file /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/pkgs/selfscan/__init__.py:\nE                       def abc(request):\nE                   Line 4 of file /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/pkgs/selfscan/__init__.py:\nE                       def abc(request):\nE                 For: ('view', None, 'two', None, 'd41d8cd98f00b204e9800998ecf8427e')\nE                   Line 4 of file /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/pkgs/selfscan/another.py:\nE                       def two(request):\nE                   Line 4 of file /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/pkgs/selfscan/another.py:\nE                       def two(request):\n\npyramid/config/__init__.py:1342: ConfigurationConflictError\n\nDuring handling of the above exception, another exception occurred:\n\nself = <r2e_tests.test_config.test_init.ConfiguratorTests testMethod=test_scan_integration_conflict>\n\n    def test_scan_integration_conflict(self):\n        from pyramid.tests.test_config.pkgs import selfscan\n        from pyramid.config import Configurator\n        c = Configurator()\n        c.scan(selfscan)\n        c.scan(selfscan)\n        try:\n            c.commit()\n        except ConfigurationConflictError as why:\n            def scanconflicts(e):\n                conflicts = e._conflicts.values()\n                for conflict in conflicts:\n                    for confinst in conflict:\n                        yield confinst.src\n            which = list(scanconflicts(why))\n            self.assertEqual(len(which), 4)\n>           self.assertTrue(\"@view_config(renderer='string')\" in which)\nE           AssertionError: False is not true\n\nr2e_tests/test_config/test_init.py:1099: AssertionError\n_______ ConfiguratorTests.test_setup_registry_debug_logger_None_default ________\n\nself = <r2e_tests.test_config.test_init.ConfiguratorTests testMethod=test_setup_registry_debug_logger_None_default>\n\n    def test_setup_registry_debug_logger_None_default(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDebugLogger\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry()\n        logger = reg.getUtility(IDebugLogger)\n>       self.assertEqual(logger.name, 'pyramid.tests.test_config')\nE       AssertionError: 'r2e_tests.test_config' != 'pyramid.tests.test_config'\nE       - r2e_tests.test_config\nE       ?  ^^^\nE       + pyramid.tests.test_config\nE       ? ++ ^^^^^\n\nr2e_tests/test_config/test_init.py:485: AssertionError\n____ TestConfigurator_add_directive.test_add_directive_with_custom_callable ____\n\nself = <r2e_tests.test_config.test_init.TestConfigurator_add_directive testMethod=test_add_directive_with_custom_callable>\n\n    def test_add_directive_with_custom_callable(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n                'dummy_callable', 'pyramid.tests.test_config.dummy_callable')\n        self.assertTrue(hasattr(config, 'dummy_callable'))\n        config.dummy_callable('discrim')\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n>       self.assertEqual(action['args'], test_config)\nE       AssertionError: <module 'r2e_tests.test_config' from '/home/gcpuse[117 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_config/test_init.py:1298: AssertionError\n________ TestConfigurator_add_directive.test_add_directive_with_partial ________\n\nself = <r2e_tests.test_config.test_init.TestConfigurator_add_directive testMethod=test_add_directive_with_partial>\n\n    def test_add_directive_with_partial(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n                'dummy_partial', 'pyramid.tests.test_config.dummy_partial')\n        self.assertTrue(hasattr(config, 'dummy_partial'))\n        config.dummy_partial()\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'partial')\n        self.assertEqual(action['callable'], None)\n>       self.assertEqual(action['args'], test_config)\nE       AssertionError: <module 'r2e_tests.test_config' from '/home/gcpuse[117 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_config/test_init.py:1285: AssertionError\n_________ TestConfigurator_add_directive.test_extend_with_dotted_name __________\n\nself = <r2e_tests.test_config.test_init.TestConfigurator_add_directive testMethod=test_extend_with_dotted_name>\n\n    def test_extend_with_dotted_name(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n            'dummy_extend', 'pyramid.tests.test_config.dummy_extend')\n        self.assertTrue(hasattr(config, 'dummy_extend'))\n        config.dummy_extend('discrim')\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n>       self.assertEqual(action['args'], test_config)\nE       AssertionError: <module 'r2e_tests.test_config' from '/home/gcpuse[117 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_config/test_init.py:1272: AssertionError\n_______ TestConfigurator_add_directive.test_extend_with_python_callable ________\n\nself = <r2e_tests.test_config.test_init.TestConfigurator_add_directive testMethod=test_extend_with_python_callable>\n\n    def test_extend_with_python_callable(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n            'dummy_extend', dummy_extend)\n        self.assertTrue(hasattr(config, 'dummy_extend'))\n        config.dummy_extend('discrim')\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n>       self.assertEqual(action['args'], test_config)\nE       AssertionError: <module 'r2e_tests.test_config' from '/home/gcpuse[117 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_config/test_init.py:1311: AssertionError\n_________ TestConfigurator__add_predicate.test_factory_as_dotted_name __________\n\nself = <r2e_tests.test_config.test_init.TestConfigurator__add_predicate testMethod=test_factory_as_dotted_name>\n\n    def test_factory_as_dotted_name(self):\n        config = self._makeOne()\n    \n        def _fakeAction(discriminator, callable=None, args=(),\n                        kw=None, order=0, introspectables=(), **extra):\n            self.assertEqual(len(introspectables), 1)\n            self.assertEqual(introspectables[0]['name'], 'testing')\n            self.assertEqual(introspectables[0]['factory'], DummyPredicate)\n    \n        config.action = _fakeAction\n>       config._add_predicate(\n            'route',\n            'testing',\n            'pyramid.tests.test_config.test_init.DummyPredicate'\n            )\n\nr2e_tests/test_config/test_init.py:1375: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \npyramid/config/__init__.py:540: in _add_predicate\n    self.action(discriminator, register, introspectables=(intr,),\nr2e_tests/test_config/test_init.py:1372: in _fakeAction\n    self.assertEqual(introspectables[0]['factory'], DummyPredicate)\nE   AssertionError: <class 'pyramid.tests.test_config.test_init.DummyPredicate'> != <class 'r2e_tests.test_config.test_init.DummyPredicate'>\n____ TestViewsConfigurationMixin.test_add_static_view_package_here_relative ____\n\nself = <r2e_tests.test_config.test_views.TestViewsConfigurationMixin testMethod=test_add_static_view_package_here_relative>\n\n    def test_add_static_view_package_here_relative(self):\n        from pyramid.interfaces import IStaticURLInfo\n        info = DummyStaticURLInfo()\n        config = self._makeOne(autocommit=True)\n        config.registry.registerUtility(info, IStaticURLInfo)\n        config.add_static_view('static', 'files')\n>       self.assertEqual(\n            info.added,\n            [(config, 'static', 'pyramid.tests.test_config:files', {})])\nE       AssertionError: Lists differ: [(<py[39 chars]384d0eb69d0>, 'static', 'r2e_tests.test_config:files', {})] != [(<py[39 chars]384d0eb69d0>, 'static', 'pyramid.tests.test_config:files', {})]\nE       \nE       First differing element 0:\nE       (<pyr[37 chars]7384d0eb69d0>, 'static', 'r2e_tests.test_config:files', {})\nE       (<pyr[37 chars]7384d0eb69d0>, 'static', 'pyramid.tests.test_config:files', {})\nE       \nE         [(<pyramid.config.Configurator object at 0x7384d0eb69d0>,\nE           'static',\nE       -   'r2e_tests.test_config:files',\nE       ?     ^^^\nE       \nE       +   'pyramid.tests.test_config:files',\nE       ?    ++ ^^^^^\nE       \nE           {})]\n\nr2e_tests/test_config/test_views.py:2065: AssertionError\n_______ TestViewsConfigurationMixin.test_add_view_with_template_renderer _______\n\nself = <r2e_tests.test_config.test_views.TestViewsConfigurationMixin testMethod=test_add_view_with_template_renderer>\n\n    def test_add_view_with_template_renderer(self):\n        from pyramid.tests import test_config\n        from pyramid.interfaces import ISettings\n        class view(object):\n            def __init__(self, context, request):\n                self.request = request\n                self.context = context\n    \n            def __call__(self):\n                return {'a':'1'}\n        config = self._makeOne(autocommit=True)\n        renderer = self._registerRenderer(config)\n        fixture = 'pyramid.tests.test_config:files/minimal.txt'\n        config.introspection = False\n        config.add_view(view=view, renderer=fixture)\n        wrapper = self._getViewCallable(config)\n        request = self._makeRequest(config)\n        result = wrapper(None, request)\n        self.assertEqual(result.body, b'Hello!')\n        settings = config.registry.queryUtility(ISettings)\n        result = renderer.info\n        self.assertEqual(result.registry, config.registry)\n        self.assertEqual(result.type, '.txt')\n>       self.assertEqual(result.package, test_config)\nE       AssertionError: <module 'r2e_tests.test_config' from '/home/gcpuse[117 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_config/test_views.py:1186: AssertionError\n_ TestViewsConfigurationMixin.test_add_view_with_template_renderer_no_callable _\n\nself = <r2e_tests.test_config.test_views.TestViewsConfigurationMixin testMethod=test_add_view_with_template_renderer_no_callable>\n\n    def test_add_view_with_template_renderer_no_callable(self):\n        from pyramid.tests import test_config\n        from pyramid.interfaces import ISettings\n        config = self._makeOne(autocommit=True)\n        renderer = self._registerRenderer(config)\n        fixture = 'pyramid.tests.test_config:files/minimal.txt'\n        config.introspection = False\n        config.add_view(view=None, renderer=fixture)\n        wrapper = self._getViewCallable(config)\n        request = self._makeRequest(config)\n        result = wrapper(None, request)\n        self.assertEqual(result.body, b'Hello!')\n        settings = config.registry.queryUtility(ISettings)\n        result = renderer.info\n        self.assertEqual(result.registry, config.registry)\n        self.assertEqual(result.type, '.txt')\n>       self.assertEqual(result.package, test_config)\nE       AssertionError: <module 'r2e_tests.test_config' from '/home/gcpuse[117 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_config/test_views.py:1227: AssertionError\n_________ TestStaticURLInfo.test_generate_url_cachebust_with_overrides _________\n\nself = <r2e_tests.test_config.test_views.TestStaticURLInfo testMethod=test_generate_url_cachebust_with_overrides>\n\n    def test_generate_url_cachebust_with_overrides(self):\n        config = testing.setUp()\n        try:\n            request = testing.DummyRequest()\n            config.add_static_view('static', 'path')\n            config.override_asset(\n                'pyramid.tests.test_config:path/',\n                'pyramid.tests.test_config:other_path/')\n            def cb(val):\n                def cb_(request, subpath, kw):\n                    kw['_query'] = {'x': val}\n                    return subpath, kw\n                return cb_\n            config.add_cache_buster('path', cb('foo'))\n            result = request.static_url('path/foo.png')\n            self.assertEqual(result, 'http://example.com/static/foo.png?x=foo')\n            config.add_cache_buster('other_path', cb('bar'), explicit=True)\n            result = request.static_url('path/foo.png')\n>           self.assertEqual(result, 'http://example.com/static/foo.png?x=bar')\nE           AssertionError: 'http://example.com/static/foo.png?x=foo' != 'http://example.com/static/foo.png?x=bar'\nE           - http://example.com/static/foo.png?x=foo\nE           ?                                     ^^^\nE           + http://example.com/static/foo.png?x=bar\nE           ?                                     ^^^\n\nr2e_tests/test_config/test_views.py:3213: AssertionError\n___________________ Test_view_description.test_without_text ____________________\n\nself = <r2e_tests.test_config.test_views.Test_view_description testMethod=test_without_text>\n\n    def test_without_text(self):\n        def view(): pass\n        result = self._callFUT(view)\n>       self.assertEqual(result,\n                         'function pyramid.tests.test_config.test_views.view')\nE       AssertionError: 'function r2e_tests.test_config.test_views.view' != 'function pyramid.tests.test_config.test_views.view'\nE       - function r2e_tests.test_config.test_views.view\nE       ?           ^^^\nE       + function pyramid.tests.test_config.test_views.view\nE       ?          ++ ^^^^^\n\nr2e_tests/test_config/test_views.py:3384: AssertionError\n_________ TestPRoutesCommand.test_one_route_all_methods_view_only_post _________\n\nself = <r2e_tests.test_scripts.test_proutes.TestPRoutesCommand testMethod=test_one_route_all_methods_view_only_post>\n\n    def test_one_route_all_methods_view_only_post(self):\n        from pyramid.renderers import null_renderer as nr\n    \n        def view1(context, request): return 'view1'\n    \n        config = self._makeConfig(autocommit=True)\n        config.add_route('foo', '/a/b')\n        config.add_view(\n            route_name='foo',\n            view=view1,\n            renderer=nr,\n            request_method='POST'\n        )\n    \n        command = self._makeOne()\n        L = []\n        command.out = L.append\n        command.bootstrap = (dummy.DummyBootstrap(registry=config.registry),)\n        result = command.run()\n        self.assertEqual(result, 0)\n        self.assertEqual(len(L), 3)\n        compare_to = L[-1].split()\n        expected = [\n            'foo', '/a/b',\n            'pyramid.tests.test_scripts.test_proutes.view1', 'POST'\n        ]\n>       self.assertEqual(compare_to, expected)\nE       AssertionError: Lists differ: ['foo', '/a/b', 'r2e_tests.test_scripts.test_proutes.view1', 'POST'] != ['foo', '/a/b', 'pyramid.tests.test_scripts.test_proutes.view1', 'POST']\nE       \nE       First differing element 2:\nE       'r2e_tests.test_scripts.test_proutes.view1'\nE       'pyramid.tests.test_scripts.test_proutes.view1'\nE       \nE       - ['foo', '/a/b', 'r2e_tests.test_scripts.test_proutes.view1', 'POST']\nE       ?                   ^^^\nE       \nE       + ['foo', '/a/b', 'pyramid.tests.test_scripts.test_proutes.view1', 'POST']\nE       ?                  ++ ^^^^^\n\nr2e_tests/test_scripts/test_proutes.py:339: AssertionError\n_________ TestPRoutesCommand.test_one_route_only_post_view_all_methods _________\n\nself = <r2e_tests.test_scripts.test_proutes.TestPRoutesCommand testMethod=test_one_route_only_post_view_all_methods>\n\n    def test_one_route_only_post_view_all_methods(self):\n        from pyramid.renderers import null_renderer as nr\n    \n        def view1(context, request): return 'view1'\n    \n        config = self._makeConfig(autocommit=True)\n        config.add_route('foo', '/a/b', request_method='POST')\n        config.add_view(\n            route_name='foo',\n            view=view1,\n            renderer=nr,\n        )\n    \n        command = self._makeOne()\n        L = []\n        command.out = L.append\n        command.bootstrap = (dummy.DummyBootstrap(registry=config.registry),)\n        result = command.run()\n        self.assertEqual(result, 0)\n        self.assertEqual(len(L), 3)\n        compare_to = L[-1].split()\n        expected = [\n            'foo', '/a/b',\n            'pyramid.tests.test_scripts.test_proutes.view1', 'POST'\n        ]\n>       self.assertEqual(compare_to, expected)\nE       AssertionError: Lists differ: ['foo', '/a/b', 'r2e_tests.test_scripts.test_proutes.view1', 'POST'] != ['foo', '/a/b', 'pyramid.tests.test_scripts.test_proutes.view1', 'POST']\nE       \nE       First differing element 2:\nE       'r2e_tests.test_scripts.test_proutes.view1'\nE       'pyramid.tests.test_scripts.test_proutes.view1'\nE       \nE       - ['foo', '/a/b', 'r2e_tests.test_scripts.test_proutes.view1', 'POST']\nE       ?                   ^^^\nE       \nE       + ['foo', '/a/b', 'pyramid.tests.test_scripts.test_proutes.view1', 'POST']\nE       ?                  ++ ^^^^^\n\nr2e_tests/test_scripts/test_proutes.py:366: AssertionError\n________ TestPRoutesCommand.test_one_route_only_post_view_post_and_get _________\n\nself = <r2e_tests.test_scripts.test_proutes.TestPRoutesCommand testMethod=test_one_route_only_post_view_post_and_get>\n\n    def test_one_route_only_post_view_post_and_get(self):\n        from pyramid.renderers import null_renderer as nr\n    \n        def view1(context, request): return 'view1'\n    \n        config = self._makeConfig(autocommit=True)\n        config.add_route('foo', '/a/b', request_method='POST')\n        config.add_view(\n            route_name='foo',\n            view=view1,\n            renderer=nr,\n            request_method=('POST', 'GET')\n        )\n    \n        command = self._makeOne()\n        L = []\n        command.out = L.append\n        command.bootstrap = (dummy.DummyBootstrap(registry=config.registry),)\n        result = command.run()\n        self.assertEqual(result, 0)\n        self.assertEqual(len(L), 3)\n        compare_to = L[-1].split()\n        expected = [\n            'foo', '/a/b',\n            'pyramid.tests.test_scripts.test_proutes.view1', 'POST'\n        ]\n>       self.assertEqual(compare_to, expected)\nE       AssertionError: Lists differ: ['foo', '/a/b', 'r2e_tests.test_scripts.test_proutes.view1', 'POST'] != ['foo', '/a/b', 'pyramid.tests.test_scripts.test_proutes.view1', 'POST']\nE       \nE       First differing element 2:\nE       'r2e_tests.test_scripts.test_proutes.view1'\nE       'pyramid.tests.test_scripts.test_proutes.view1'\nE       \nE       - ['foo', '/a/b', 'r2e_tests.test_scripts.test_proutes.view1', 'POST']\nE       ?                   ^^^\nE       \nE       + ['foo', '/a/b', 'pyramid.tests.test_scripts.test_proutes.view1', 'POST']\nE       ?                  ++ ^^^^^\n\nr2e_tests/test_scripts/test_proutes.py:394: AssertionError\n_____ TestPRoutesCommand.test_one_route_with_long_name_one_view_registered _____\n\nself = <r2e_tests.test_scripts.test_proutes.TestPRoutesCommand testMethod=test_one_route_with_long_name_one_view_registered>\n\n    def test_one_route_with_long_name_one_view_registered(self):\n        from zope.interface import Interface\n        from pyramid.interfaces import IRouteRequest\n        from pyramid.interfaces import IViewClassifier\n        from pyramid.interfaces import IView\n        registry = self._makeRegistry()\n    \n        def view():pass\n    \n        class IMyRoute(Interface):\n            pass\n    \n        registry.registerAdapter(\n            view,\n            (IViewClassifier, IMyRoute, Interface),\n            IView, ''\n        )\n    \n        registry.registerUtility(IMyRoute, IRouteRequest,\n                                 name='very_long_name_123')\n    \n        command = self._makeOne()\n        route = dummy.DummyRoute(\n            'very_long_name_123',\n            '/and_very_long_pattern_as_well'\n        )\n        mapper = dummy.DummyMapper(route)\n        command._get_mapper = lambda *arg: mapper\n        L = []\n        command.out = L.append\n        command.bootstrap = (dummy.DummyBootstrap(registry=registry),)\n        result = command.run()\n        self.assertEqual(result, 0)\n        self.assertEqual(len(L), 3)\n        compare_to = L[-1].split()[:3]\n>       self.assertEqual(\n            compare_to,\n            ['very_long_name_123',\n             '/and_very_long_pattern_as_well',\n             'pyramid.tests.test_scripts.test_proutes.view']\n        )\nE       AssertionError: Lists differ: ['ver[36 chars]ttern_as_well', 'r2e_tests.test_scripts.test_proutes.view'] != ['ver[36 chars]ttern_as_well', 'pyramid.tests.test_scripts.test_proutes.view']\nE       \nE       First differing element 2:\nE       'r2e_tests.test_scripts.test_proutes.view'\nE       'pyramid.tests.test_scripts.test_proutes.view'\nE       \nE         ['very_long_name_123',\nE          '/and_very_long_pattern_as_well',\nE       -  'r2e_tests.test_scripts.test_proutes.view']\nE       ?    ^^^\nE       \nE       +  'pyramid.tests.test_scripts.test_proutes.view']\nE       ?   ++ ^^^^^\n\nr2e_tests/test_scripts/test_proutes.py:198: AssertionError\n______ TestPRoutesCommand.test_route_is_get_view_request_method_not_post _______\n\nself = <r2e_tests.test_scripts.test_proutes.TestPRoutesCommand testMethod=test_route_is_get_view_request_method_not_post>\n\n    def test_route_is_get_view_request_method_not_post(self):\n        from pyramid.renderers import null_renderer as nr\n        from pyramid.config import not_\n    \n        def view1(context, request): return 'view1'\n    \n        config = self._makeConfig(autocommit=True)\n        config.add_route('foo', '/a/b', request_method='GET')\n        config.add_view(\n            route_name='foo',\n            view=view1,\n            renderer=nr,\n            request_method=not_('POST')\n        )\n    \n        command = self._makeOne()\n        L = []\n        command.out = L.append\n        command.bootstrap = (dummy.DummyBootstrap(registry=config.registry),)\n        result = command.run()\n        self.assertEqual(result, 0)\n        self.assertEqual(len(L), 3)\n        compare_to = L[-1].split()\n        expected = [\n            'foo', '/a/b',\n            'pyramid.tests.test_scripts.test_proutes.view1',\n            'GET'\n        ]\n>       self.assertEqual(compare_to, expected)\nE       AssertionError: Lists differ: ['foo', '/a/b', 'r2e_tests.test_scripts.test_proutes.view1', 'GET'] != ['foo', '/a/b', 'pyramid.tests.test_scripts.test_proutes.view1', 'GET']\nE       \nE       First differing element 2:\nE       'r2e_tests.test_scripts.test_proutes.view1'\nE       'pyramid.tests.test_scripts.test_proutes.view1'\nE       \nE       - ['foo', '/a/b', 'r2e_tests.test_scripts.test_proutes.view1', 'GET']\nE       ?                   ^^^\nE       \nE       + ['foo', '/a/b', 'pyramid.tests.test_scripts.test_proutes.view1', 'GET']\nE       ?                  ++ ^^^^^\n\nr2e_tests/test_scripts/test_proutes.py:534: AssertionError\n____________ TestPRoutesCommand.test_route_request_method_mismatch _____________\n\nself = <r2e_tests.test_scripts.test_proutes.TestPRoutesCommand testMethod=test_route_request_method_mismatch>\n\n    def test_route_request_method_mismatch(self):\n        from pyramid.renderers import null_renderer as nr\n    \n        def view1(context, request): return 'view1'\n    \n        config = self._makeConfig(autocommit=True)\n        config.add_route('foo', '/a/b', request_method='POST')\n        config.add_view(\n            route_name='foo',\n            view=view1,\n            renderer=nr,\n            request_method='GET'\n        )\n    \n        command = self._makeOne()\n        L = []\n        command.out = L.append\n        command.bootstrap = (dummy.DummyBootstrap(registry=config.registry),)\n        result = command.run()\n        self.assertEqual(result, 0)\n        self.assertEqual(len(L), 3)\n        compare_to = L[-1].split()\n        expected = [\n            'foo', '/a/b',\n            'pyramid.tests.test_scripts.test_proutes.view1',\n            '<route', 'mismatch>'\n        ]\n>       self.assertEqual(compare_to, expected)\nE       AssertionError: Lists differ: ['foo', '/a/b', 'r2e_tests.test_scripts.test_proutes.view1[20 chars]ch>'] != ['foo', '/a/b', 'pyramid.tests.test_scripts.test_proutes.v[24 chars]ch>']\nE       \nE       First differing element 2:\nE       'r2e_tests.test_scripts.test_proutes.view1'\nE       'pyramid.tests.test_scripts.test_proutes.view1'\nE       \nE         ['foo',\nE          '/a/b',\nE       -  'r2e_tests.test_scripts.test_proutes.view1',\nE       ?    ^^^\nE       \nE       +  'pyramid.tests.test_scripts.test_proutes.view1',\nE       ?   ++ ^^^^^\nE       \nE          '<route',\nE          'mismatch>']\n\nr2e_tests/test_scripts/test_proutes.py:423: AssertionError\n__________________ TestPRoutesCommand.test_route_static_views __________________\n\nself = <r2e_tests.test_scripts.test_proutes.TestPRoutesCommand testMethod=test_route_static_views>\n\n    def test_route_static_views(self):\n        from pyramid.renderers import null_renderer as nr\n        config = self._makeConfig(autocommit=True)\n        config.add_static_view('static', 'static', cache_max_age=3600)\n        path2 = os.path.normpath('/var/www/static')\n        config.add_static_view(name='static2', path=path2)\n        config.add_static_view(\n            name='pyramid_scaffold',\n            path='pyramid:scaffolds/starter/+package+/static'\n        )\n    \n        command = self._makeOne()\n        L = []\n        command.out = L.append\n        command.bootstrap = (dummy.DummyBootstrap(registry=config.registry),)\n        result = command.run()\n        self.assertEqual(result, 0)\n        self.assertEqual(len(L), 5)\n    \n        expected = [\n            ['__static/', '/static/*subpath',\n             'pyramid.tests.test_scripts:static/', '*'],\n            ['__static2/', '/static2/*subpath', path2 + os.sep, '*'],\n            ['__pyramid_scaffold/', '/pyramid_scaffold/*subpath',\n             'pyramid:scaffolds/starter/+package+/static/',  '*'],\n        ]\n    \n        for index, line in enumerate(L[2:]):\n            data = line.split()\n>           self.assertEqual(data, expected[index])\nE           AssertionError: Lists differ: ['__static/', '/static/*subpath', 'r2e_tests.test_scripts:static/', '*'] != ['__static/', '/static/*subpath', 'pyramid.tests.test_scripts:static/', '*']\nE           \nE           First differing element 2:\nE           'r2e_tests.test_scripts:static/'\nE           'pyramid.tests.test_scripts:static/'\nE           \nE           - ['__static/', '/static/*subpath', 'r2e_tests.test_scripts:static/', '*']\nE           ?                                     ^^^\nE           \nE           + ['__static/', '/static/*subpath', 'pyramid.tests.test_scripts:static/', '*']\nE           ?                                    ++ ^^^^^\n\nr2e_tests/test_scripts/test_proutes.py:454: AssertionError\n___________ TestPRoutesCommand.test_single_route_one_view_registered ___________\n\nself = <r2e_tests.test_scripts.test_proutes.TestPRoutesCommand testMethod=test_single_route_one_view_registered>\n\n    def test_single_route_one_view_registered(self):\n        from zope.interface import Interface\n        from pyramid.interfaces import IRouteRequest\n        from pyramid.interfaces import IViewClassifier\n        from pyramid.interfaces import IView\n        registry = self._makeRegistry()\n    \n        def view():pass\n        class IMyRoute(Interface):\n            pass\n        registry.registerAdapter(view,\n                                 (IViewClassifier, IMyRoute, Interface),\n                                 IView, '')\n        registry.registerUtility(IMyRoute, IRouteRequest, name='a')\n        command = self._makeOne()\n        route = dummy.DummyRoute('a', '/a')\n        mapper = dummy.DummyMapper(route)\n        command._get_mapper = lambda *arg: mapper\n        L = []\n        command.out = L.append\n        command.bootstrap = (dummy.DummyBootstrap(registry=registry),)\n        result = command.run()\n        self.assertEqual(result, 0)\n        self.assertEqual(len(L), 3)\n        compare_to = L[-1].split()[:3]\n>       self.assertEqual(\n            compare_to,\n            ['a', '/a', 'pyramid.tests.test_scripts.test_proutes.view']\n        )\nE       AssertionError: Lists differ: ['a', '/a', 'r2e_tests.test_scripts.test_proutes.view'] != ['a', '/a', 'pyramid.tests.test_scripts.test_proutes.view']\nE       \nE       First differing element 2:\nE       'r2e_tests.test_scripts.test_proutes.view'\nE       'pyramid.tests.test_scripts.test_proutes.view'\nE       \nE       - ['a', '/a', 'r2e_tests.test_scripts.test_proutes.view']\nE       ?               ^^^\nE       \nE       + ['a', '/a', 'pyramid.tests.test_scripts.test_proutes.view']\nE       ?              ++ ^^^^^\n\nr2e_tests/test_scripts/test_proutes.py:158: AssertionError\n______________________ TestPRoutesCommand.test_view_glob _______________________\n\nself = <r2e_tests.test_scripts.test_proutes.TestPRoutesCommand testMethod=test_view_glob>\n\n    def test_view_glob(self):\n        from pyramid.renderers import null_renderer as nr\n        from pyramid.config import not_\n    \n        def view1(context, request): return 'view1'\n        def view2(context, request): return 'view2'\n    \n        config = self._makeConfig(autocommit=True)\n        config.add_route('foo', '/a/b')\n        config.add_view(\n            route_name='foo',\n            view=view1,\n            renderer=nr,\n            request_method=not_('POST')\n        )\n    \n        config.add_route('bar', '/b/a')\n        config.add_view(\n            route_name='bar',\n            view=view2,\n            renderer=nr,\n            request_method=not_('POST')\n        )\n    \n        command = self._makeOne()\n        command.args.glob = '*foo*'\n    \n        L = []\n        command.out = L.append\n        command.bootstrap = (dummy.DummyBootstrap(registry=config.registry),)\n        result = command.run()\n        self.assertEqual(result, 0)\n        self.assertEqual(len(L), 3)\n        compare_to = L[-1].split()\n        expected = [\n            'foo', '/a/b',\n            'pyramid.tests.test_scripts.test_proutes.view1',\n            '!POST,*'\n        ]\n>       self.assertEqual(compare_to, expected)\nE       AssertionError: Lists differ: ['foo', '/a/b', 'r2e_tests.test_scripts.test_proutes.view1', '!POST,*'] != ['foo', '/a/b', 'pyramid.tests.test_scripts.test_proutes.view1', '!POST,*']\nE       \nE       First differing element 2:\nE       'r2e_tests.test_scripts.test_proutes.view1'\nE       'pyramid.tests.test_scripts.test_proutes.view1'\nE       \nE       - ['foo', '/a/b', 'r2e_tests.test_scripts.test_proutes.view1', '!POST,*']\nE       ?                   ^^^\nE       \nE       + ['foo', '/a/b', 'pyramid.tests.test_scripts.test_proutes.view1', '!POST,*']\nE       ?                  ++ ^^^^^\n\nr2e_tests/test_scripts/test_proutes.py:605: AssertionError\n_____________ TestPRoutesCommand.test_view_request_method_not_post _____________\n\nself = <r2e_tests.test_scripts.test_proutes.TestPRoutesCommand testMethod=test_view_request_method_not_post>\n\n    def test_view_request_method_not_post(self):\n        from pyramid.renderers import null_renderer as nr\n        from pyramid.config import not_\n    \n        def view1(context, request): return 'view1'\n    \n        config = self._makeConfig(autocommit=True)\n        config.add_route('foo', '/a/b')\n        config.add_view(\n            route_name='foo',\n            view=view1,\n            renderer=nr,\n            request_method=not_('POST')\n        )\n    \n        command = self._makeOne()\n        L = []\n        command.out = L.append\n        command.bootstrap = (dummy.DummyBootstrap(registry=config.registry),)\n        result = command.run()\n        self.assertEqual(result, 0)\n        self.assertEqual(len(L), 3)\n        compare_to = L[-1].split()\n        expected = [\n            'foo', '/a/b',\n            'pyramid.tests.test_scripts.test_proutes.view1',\n            '!POST,*'\n        ]\n>       self.assertEqual(compare_to, expected)\nE       AssertionError: Lists differ: ['foo', '/a/b', 'r2e_tests.test_scripts.test_proutes.view1', '!POST,*'] != ['foo', '/a/b', 'pyramid.tests.test_scripts.test_proutes.view1', '!POST,*']\nE       \nE       First differing element 2:\nE       'r2e_tests.test_scripts.test_proutes.view1'\nE       'pyramid.tests.test_scripts.test_proutes.view1'\nE       \nE       - ['foo', '/a/b', 'r2e_tests.test_scripts.test_proutes.view1', '!POST,*']\nE       ?                   ^^^\nE       \nE       + ['foo', '/a/b', 'pyramid.tests.test_scripts.test_proutes.view1', '!POST,*']\nE       ?                  ++ ^^^^^\n\nr2e_tests/test_scripts/test_proutes.py:564: AssertionError\n_____________ TestPServeCommand.test_config_file_finds_watch_files _____________\n\nself = <r2e_tests.test_scripts.test_pserve.TestPServeCommand testMethod=test_config_file_finds_watch_files>\n\n    def test_config_file_finds_watch_files(self):\n        inst = self._makeOne('development.ini')\n        self.config_factory.items = [(\n            'watch_files',\n            'foo\\n/baz\\npyramid.tests.test_scripts:*.py',\n        )]\n        inst.pserve_file_config('/base/path.ini', global_conf={'a': '1'})\n        self.assertEqual(self.config_factory.defaults, {\n            'a': '1',\n            'here': os.path.abspath('/base'),\n        })\n>       self.assertEqual(inst.watch_files, set([\n            os.path.abspath('/base/foo'),\n            os.path.abspath('/baz'),\n            os.path.abspath(os.path.join(here, '*.py')),\n        ]))\nE       AssertionError: Items in the first set but not the second:\nE       '/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_scripts/*.py'\nE       Items in the second set but not the first:\nE       '/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/test_scripts/*.py'\n\nr2e_tests/test_scripts/test_pserve.py:77: AssertionError\n_____ TestPViewsCommand.test_views_command_single_view_function_traversal ______\n\nself = <r2e_tests.test_scripts.test_pviews.TestPViewsCommand testMethod=test_views_command_single_view_function_traversal>\n\n    def test_views_command_single_view_function_traversal(self):\n        from pyramid.registry import Registry\n        registry = Registry()\n        command = self._makeOne(registry=registry)\n        L = []\n        command.out = L.append\n        def view(): pass\n        view.__request_attrs__ = {'context': 'context', 'view_name': 'a'}\n        command._find_view = lambda arg1: view\n        command.args.config_uri = '/foo/bar/myapp.ini#myapp'\n        command.args.url = '/a'\n        result = command.run()\n        self.assertEqual(result, 0)\n        self.assertEqual(L[1], 'URL = /a')\n        self.assertEqual(L[3], '    context: context')\n        self.assertEqual(L[4], '    view name: a')\n>       self.assertEqual(L[8],\n                         '    pyramid.tests.test_scripts.test_pviews.view')\nE       AssertionError: '    r2e_tests.test_scripts.test_pviews.view' != '    pyramid.tests.test_scripts.test_pviews.view'\nE       -     r2e_tests.test_scripts.test_pviews.view\nE       ?      ^^^\nE       +     pyramid.tests.test_scripts.test_pviews.view\nE       ?     ++ ^^^^^\n\nr2e_tests/test_scripts/test_pviews.py:300: AssertionError\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test___getattr__matches\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test___getattr__matches_no_action_wrap\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test___getattr__missing_when_directives_dont_exist\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test___getattr__missing_when_directives_exist\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test__fix_registry_adds__lock\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test__fix_registry_adds_clear_view_lookup_cache\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test__fix_registry_has_listeners\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test__fix_registry_notify\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test__fix_registry_queryAdapterOrSelf\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test__fix_registry_registerSelfAdapter\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_absolute_asset_spec_already_absolute\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_absolute_asset_spec_notastring\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_absolute_asset_spec_relative\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_action_autocommit_with_introspectables\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_action_autocommit_with_introspectables_introspection_off\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_action_branching_kw_is_None\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_action_branching_kw_is_not_None\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_action_branching_nonautocommit_with_config_info\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_action_branching_nonautocommit_with_introspectables\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_action_branching_nonautocommit_without_config_info\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_action_nonautocommit_with_introspectables_introspection_off\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_autocommit_no_conflicts\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_begin\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_begin_does_not_propagate_request_for_diff_registry\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_begin_overrides_request\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_begin_propagates_request_for_same_registry\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_begin_with_request\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_commit_conflict_resolved_with_include\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_commit_conflict_resolved_with_two_includes_and_local\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_commit_conflict_simple\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_commit_conflict_with_two_includes\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_conflict_set_forbidden_view\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_conflict_set_notfound_view\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_alternate_renderers\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_authentication_policy\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_authorization_policy_only\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_default_permission\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_default_renderers\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_default_view_mapper\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_default_webob_response_adapter_registered\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_exceptionresponse_view_None\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_exceptionresponse_view_custom\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_httpexception_view_default\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_no_root_factory\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_noreg_custom_settings\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_noreg_debug_logger_non_None\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_session_factory\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_with_introspection\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_with_package_registry\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_with_root_factory\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_end\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_hook_zca\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_include_threadlocals_active\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_include_with_dotted_name\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_include_with_missing_source_file\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_include_with_module_defaults_to_includeme\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_include_with_module_defaults_to_includeme_missing\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_include_with_nested_route_prefix\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_include_with_python_callable\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_include_with_route_prefix\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_introspector_decorator\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_make_wsgi_app\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_maybe_dotted_notstring_success\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_maybe_dotted_string_fail\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_maybe_dotted_string_success\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_scan_integration\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_scan_integration_dottedname_package\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_scan_integration_with_extra_kw\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_scan_integration_with_ignore\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_alternate_renderers\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_authentication_policy\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_authentication_policy_dottedname\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_authorization_policy_dottedname\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_authorization_policy_only\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_calls_fix_registry\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_custom_settings\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_debug_logger_name\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_debug_logger_non_None\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_default_permission\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_dottedname_root_factory\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_explicit_notfound_trumps_iexceptionresponse\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_includes\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_includes_spaces\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_locale_negotiator\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_locale_negotiator_dottedname\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_no_default_root_factory\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_registers_default_exceptionresponse_views\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_registers_default_view_predicates\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_registers_default_webob_iresponse_adapter\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_request_factory\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_request_factory_dottedname\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_response_factory\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_tweens\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_unhook_zca\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_with_package\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_with_package_module\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_with_package_package\nPASSED r2e_tests/test_1.py::TestConfigurator_add_directive::test_directive_persists_across_configurator_creations\nPASSED r2e_tests/test_1.py::TestConfigurator_add_directive::test_extend_action_method_successful\nPASSED r2e_tests/test_1.py::TestConfigurator_add_directive::test_extend_same_name_doesnt_conflict\nPASSED r2e_tests/test_1.py::TestConfigurator__add_predicate::test_factory_as_object\nPASSED r2e_tests/test_1.py::TestActionState::test_action_simple\nPASSED r2e_tests/test_1.py::TestActionState::test_action_with_includepath\nPASSED r2e_tests/test_1.py::TestActionState::test_action_with_includepath_and_info\nPASSED r2e_tests/test_1.py::TestActionState::test_action_with_info\nPASSED r2e_tests/test_1.py::TestActionState::test_action_with_introspectables\nPASSED r2e_tests/test_1.py::TestActionState::test_action_with_order\nPASSED r2e_tests/test_1.py::TestActionState::test_execute_actions_dicts\nPASSED r2e_tests/test_1.py::TestActionState::test_execute_actions_error\nPASSED r2e_tests/test_1.py::TestActionState::test_execute_actions_tuples\nPASSED r2e_tests/test_1.py::TestActionState::test_execute_actions_with_introspectable_no_callable\nPASSED r2e_tests/test_1.py::TestActionState::test_execute_actions_with_introspectables\nPASSED r2e_tests/test_1.py::TestActionState::test_executing_conflicting_action_across_orders\nPASSED r2e_tests/test_1.py::TestActionState::test_executing_conflicting_action_across_reentrant_orders\nPASSED r2e_tests/test_1.py::TestActionState::test_it\nPASSED r2e_tests/test_1.py::TestActionState::test_processSpec\nPASSED r2e_tests/test_1.py::TestActionState::test_reentrant_action\nPASSED r2e_tests/test_1.py::TestActionState::test_reentrant_action_error\nPASSED r2e_tests/test_1.py::TestActionState::test_reentrant_action_with_deferred_discriminator\nPASSED r2e_tests/test_1.py::TestActionState::test_reentrant_action_without_clear\nPASSED r2e_tests/test_1.py::Test_reentrant_action_functional::test_deferred_discriminator\nPASSED r2e_tests/test_1.py::Test_reentrant_action_functional::test_functional\nPASSED r2e_tests/test_1.py::Test_resolveConflicts::test_conflicts_across_orders\nPASSED r2e_tests/test_1.py::Test_resolveConflicts::test_it_conflict\nPASSED r2e_tests/test_1.py::Test_resolveConflicts::test_it_success_dicts\nPASSED r2e_tests/test_1.py::Test_resolveConflicts::test_it_success_tuples\nPASSED r2e_tests/test_1.py::Test_resolveConflicts::test_it_with_actions_grouped_by_order\nPASSED r2e_tests/test_1.py::Test_resolveConflicts::test_override_success_across_orders\nPASSED r2e_tests/test_1.py::TestGlobalRegistriesIntegration::test_global_registries\nPASSED r2e_tests/test_1.py::TestGlobalRegistriesIntegration::test_global_registries_empty\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_object_event_subscriber\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_resource_url_default_resource_iface_means_Interface\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_resource_url_nodefault_resource_iface\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_response_adapter\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_response_adapter_dottednames\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_response_adapter_self\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_subscriber_defaults\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_subscriber_dottednames\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_subscriber_iface_specified\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_subscriber_predicate\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_subscriber_with_default_type_predicates_False\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_subscriber_with_default_type_predicates_True\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_subscriber_with_specific_type_and_predicates_False\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_subscriber_with_specific_type_and_predicates_True\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_traverser_default_iface_means_Interface\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_traverser_introspectables\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_traverser_nondefault_iface\nPASSED r2e_tests/test_config/test_adapters.py::Test_eventonly::test_defaults\nPASSED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test__override_already_registered\nPASSED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test__override_not_yet_registered\nPASSED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_directory_with_absdirectory\nPASSED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_directory_with_absfile\nPASSED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_directory_with_file\nPASSED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_file_with_absdirectory\nPASSED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_file_with_absfile\nPASSED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_file_with_directory\nPASSED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_file_with_missing_abspath\nPASSED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_file_with_package\nPASSED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_package_with_absdirectory\nPASSED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_samename\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_get_resource_filename_override_returns_value\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_get_resource_stream_no_overrides\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_get_resource_stream_override_returns_None\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_get_resource_stream_override_returns_value\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_get_resource_string_no_overrides\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_get_resource_string_override_returns_None\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_get_resource_string_override_returns_value\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_has_resource_no_overrides\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_has_resource_override_returns_None\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_has_resource_override_returns_True\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_resource_isdir_no_overrides\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_resource_isdir_override_returns_False\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_resource_isdir_override_returns_None\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_resource_listdir_no_overrides\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_resource_listdir_override_returns_None\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_resource_listdir_override_returns_values\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_class_conforms_to_IPEP302Loader\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_class_conforms_to_IPackageOverrides\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_ctor_package_already_has_loader_of_different_type\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_ctor_package_already_has_loader_of_same_type\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_ctor_registers_loader_type\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_ctor_sets_loader\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_ctor_sets_local_state\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_filtered_sources\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_get_code_pkg_has___loader__\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_get_code_pkg_has_no___loader__\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_get_data_pkg_has___loader__\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_get_data_pkg_has_no___loader__\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_get_filename\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_get_filename_file_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_get_source_pkg_has___loader__\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_get_source_pkg_has_no___loader__\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_get_stream\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_get_stream_file_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_get_string\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_get_string_file_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_has_resource\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_has_resource_file_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_insert_directory\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_insert_emptystring\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_insert_file\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_instance_conforms_to_IPEP302Loader\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_instance_conforms_to_IPackageOverrides\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_is_package_pkg_has___loader__\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_is_package_pkg_has_no___loader__\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_isdir_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_isdir_false\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_isdir_true\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_listdir\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_listdir_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_exists\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_exists_file_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_exists_with_prefix\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_get_filename_file_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_get_stream\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_get_stream_file_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_get_stream_with_prefix\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_get_string\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_get_string_file_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_get_string_with_prefix\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_isdir_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_isdir_false\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_isdir_true\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_listdir\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_listdir_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_exists\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_exists_file_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_exists_with_prefix\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_get_filename\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_get_filename_file_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_get_filename_with_prefix\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_get_stream\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_get_stream_file_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_get_stream_with_prefix\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_get_string\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_get_string_file_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_get_string_with_prefix\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_isdir_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_isdir_false\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_isdir_true\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_listdir\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_listdir_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestDirectoryOverride::test_it_match\nPASSED r2e_tests/test_config/test_assets.py::TestDirectoryOverride::test_it_no_match\nPASSED r2e_tests/test_config/test_assets.py::TestFileOverride::test_it_match\nPASSED r2e_tests/test_config/test_assets.py::TestFileOverride::test_it_no_match\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_add_request_method_with_None_callable\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_add_request_method_with_None_callable_and_no_name\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_add_request_method_with_None_callable_conflict\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_add_request_method_with_callable\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_add_request_method_with_text_type_name\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_add_request_method_with_unnamed_callable\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_execution_policy\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_execution_policy_to_None\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_multiple_request_methods_conflict\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_request_factory\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_request_factory_dottedname\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_response_factory\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_response_factory_dottedname\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_root_factory\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_root_factory_as_None\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_root_factory_dottedname\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_session_factory\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_session_factory_dottedname\nPASSED r2e_tests/test_config/test_factories.py::TestDeprecatedFactoriesMixinMethods::test_set_multiple_request_properties\nPASSED r2e_tests/test_config/test_factories.py::TestDeprecatedFactoriesMixinMethods::test_set_multiple_request_properties_conflict\nPASSED r2e_tests/test_config/test_factories.py::TestDeprecatedFactoriesMixinMethods::test_set_request_property_with_callable\nPASSED r2e_tests/test_config/test_factories.py::TestDeprecatedFactoriesMixinMethods::test_set_request_property_with_property\nPASSED r2e_tests/test_config/test_factories.py::TestDeprecatedFactoriesMixinMethods::test_set_request_property_with_unnamed_callable\nPASSED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_add_translation_dirs_invalid_kwargs\nPASSED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_add_translation_dirs_missing_dir\nPASSED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_add_translation_dirs_no_specs\nPASSED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_set_locale_negotiator\nPASSED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_set_locale_negotiator_dottedname\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test___getattr__matches\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test___getattr__matches_no_action_wrap\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test___getattr__missing_when_directives_dont_exist\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test___getattr__missing_when_directives_exist\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test__fix_registry_adds__lock\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test__fix_registry_adds_clear_view_lookup_cache\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test__fix_registry_has_listeners\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test__fix_registry_notify\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test__fix_registry_queryAdapterOrSelf\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test__fix_registry_registerSelfAdapter\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_absolute_asset_spec_already_absolute\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_absolute_asset_spec_notastring\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_absolute_asset_spec_relative\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_action_autocommit_with_introspectables\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_action_autocommit_with_introspectables_introspection_off\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_action_branching_kw_is_None\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_action_branching_kw_is_not_None\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_action_branching_nonautocommit_with_config_info\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_action_branching_nonautocommit_with_introspectables\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_action_branching_nonautocommit_without_config_info\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_action_nonautocommit_with_introspectables_introspection_off\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_autocommit_no_conflicts\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_begin\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_begin_does_not_propagate_request_for_diff_registry\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_begin_overrides_request\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_begin_propagates_request_for_same_registry\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_begin_with_request\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_commit_conflict_resolved_with_include\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_commit_conflict_resolved_with_two_includes_and_local\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_commit_conflict_simple\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_commit_conflict_with_two_includes\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_conflict_set_forbidden_view\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_conflict_set_notfound_view\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_alternate_renderers\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_authentication_policy\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_authorization_policy_only\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_default_permission\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_default_renderers\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_default_view_mapper\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_default_webob_response_adapter_registered\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_exceptionresponse_view_None\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_exceptionresponse_view_custom\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_httpexception_view_default\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_no_root_factory\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_noreg_custom_settings\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_noreg_debug_logger_non_None\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_session_factory\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_with_introspection\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_with_package_registry\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_with_root_factory\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_end\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_hook_zca\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_include_threadlocals_active\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_include_with_dotted_name\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_include_with_missing_source_file\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_include_with_module_defaults_to_includeme\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_include_with_module_defaults_to_includeme_missing\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_include_with_nested_route_prefix\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_include_with_python_callable\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_include_with_route_prefix\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_introspector_decorator\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_make_wsgi_app\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_maybe_dotted_notstring_success\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_maybe_dotted_string_fail\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_maybe_dotted_string_success\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_scan_integration\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_scan_integration_dottedname_package\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_scan_integration_with_extra_kw\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_scan_integration_with_ignore\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_scan_integration_with_onerror\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_alternate_renderers\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_authentication_policy\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_authentication_policy_dottedname\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_authorization_policy_dottedname\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_authorization_policy_only\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_calls_fix_registry\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_custom_settings\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_debug_logger_name\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_debug_logger_non_None\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_default_permission\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_dottedname_root_factory\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_explicit_notfound_trumps_iexceptionresponse\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_includes\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_includes_spaces\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_locale_negotiator\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_locale_negotiator_dottedname\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_no_default_root_factory\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_registers_default_exceptionresponse_views\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_registers_default_view_predicates\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_registers_default_webob_iresponse_adapter\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_request_factory\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_request_factory_dottedname\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_response_factory\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_tweens\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_unhook_zca\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_with_package\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_with_package_module\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_with_package_package\nPASSED r2e_tests/test_config/test_init.py::TestConfigurator_add_directive::test_directive_persists_across_configurator_creations\nPASSED r2e_tests/test_config/test_init.py::TestConfigurator_add_directive::test_extend_action_method_successful\nPASSED r2e_tests/test_config/test_init.py::TestConfigurator_add_directive::test_extend_same_name_doesnt_conflict\nPASSED r2e_tests/test_config/test_init.py::TestConfigurator__add_predicate::test_factory_as_object\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_action_simple\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_action_with_includepath\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_action_with_includepath_and_info\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_action_with_info\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_action_with_introspectables\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_action_with_order\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_execute_actions_dicts\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_execute_actions_error\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_execute_actions_tuples\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_execute_actions_with_introspectable_no_callable\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_execute_actions_with_introspectables\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_executing_conflicting_action_across_orders\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_executing_conflicting_action_across_reentrant_orders\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_it\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_processSpec\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_reentrant_action\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_reentrant_action_error\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_reentrant_action_with_deferred_discriminator\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_reentrant_action_without_clear\nPASSED r2e_tests/test_config/test_init.py::Test_reentrant_action_functional::test_deferred_discriminator\nPASSED r2e_tests/test_config/test_init.py::Test_reentrant_action_functional::test_functional\nPASSED r2e_tests/test_config/test_init.py::Test_resolveConflicts::test_conflicts_across_orders\nPASSED r2e_tests/test_config/test_init.py::Test_resolveConflicts::test_it_conflict\nPASSED r2e_tests/test_config/test_init.py::Test_resolveConflicts::test_it_success_dicts\nPASSED r2e_tests/test_config/test_init.py::Test_resolveConflicts::test_it_success_tuples\nPASSED r2e_tests/test_config/test_init.py::Test_resolveConflicts::test_it_with_actions_grouped_by_order\nPASSED r2e_tests/test_config/test_init.py::Test_resolveConflicts::test_override_success_across_orders\nPASSED r2e_tests/test_config/test_init.py::TestGlobalRegistriesIntegration::test_global_registries\nPASSED r2e_tests/test_config/test_init.py::TestGlobalRegistriesIntegration::test_global_registries_empty\nPASSED r2e_tests/test_config/test_rendering.py::TestRenderingConfiguratorMixin::test_add_default_renderers\nPASSED r2e_tests/test_config/test_rendering.py::TestRenderingConfiguratorMixin::test_add_renderer\nPASSED r2e_tests/test_config/test_rendering.py::TestRenderingConfiguratorMixin::test_add_renderer_dottedname_factory\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_defaults\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_discriminator\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_no_path_no_pattern\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_no_pattern_with_path\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_no_view_with_view_attr\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_no_view_with_view_context\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_no_view_with_view_permission\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_no_view_with_view_renderer\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_accept\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_custom_predicates\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_factory\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_factory_dottedname\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_header\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_path_info\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_path_info_highorder\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_path_info_regex\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_pregenerator\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_request_method\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_request_param\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_route_prefix\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_static\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_xhr\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_get_routes_mapper_already_registered\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_get_routes_mapper_not_yet_registered\nPASSED r2e_tests/test_config/test_security.py::ConfiguratorSecurityMethodsTests::test_add_permission\nPASSED r2e_tests/test_config/test_security.py::ConfiguratorSecurityMethodsTests::test_changing_set_default_csrf_options\nPASSED r2e_tests/test_config/test_security.py::ConfiguratorSecurityMethodsTests::test_set_authentication_policy_no_authz_policy\nPASSED r2e_tests/test_config/test_security.py::ConfiguratorSecurityMethodsTests::test_set_authentication_policy_no_authz_policy_autocommit\nPASSED r2e_tests/test_config/test_security.py::ConfiguratorSecurityMethodsTests::test_set_authentication_policy_with_authz_policy\nPASSED r2e_tests/test_config/test_security.py::ConfiguratorSecurityMethodsTests::test_set_authentication_policy_with_authz_policy_autocommit\nPASSED r2e_tests/test_config/test_security.py::ConfiguratorSecurityMethodsTests::test_set_authorization_policy_no_authn_policy\nPASSED r2e_tests/test_config/test_security.py::ConfiguratorSecurityMethodsTests::test_set_authorization_policy_no_authn_policy_autocommit\nPASSED r2e_tests/test_config/test_security.py::ConfiguratorSecurityMethodsTests::test_set_authorization_policy_with_authn_policy\nPASSED r2e_tests/test_config/test_security.py::ConfiguratorSecurityMethodsTests::test_set_authorization_policy_with_authn_policy_autocommit\nPASSED r2e_tests/test_config/test_security.py::ConfiguratorSecurityMethodsTests::test_set_default_csrf_options\nPASSED r2e_tests/test_config/test_security.py::ConfiguratorSecurityMethodsTests::test_set_default_permission\nPASSED r2e_tests/test_config/test_settings.py::TestSettingsConfiguratorMixin::test__set_settings_as_None\nPASSED r2e_tests/test_config/test_settings.py::TestSettingsConfiguratorMixin::test__set_settings_as_dictwithvalues\nPASSED r2e_tests/test_config/test_settings.py::TestSettingsConfiguratorMixin::test__set_settings_does_not_uses_original_dict\nPASSED r2e_tests/test_config/test_settings.py::TestSettingsConfiguratorMixin::test_add_settings_settings_None\nPASSED r2e_tests/test_config/test_settings.py::TestSettingsConfiguratorMixin::test_add_settings_settings_already_registered\nPASSED r2e_tests/test_config/test_settings.py::TestSettingsConfiguratorMixin::test_add_settings_settings_not_yet_registered\nPASSED r2e_tests/test_config/test_settings.py::TestSettingsConfiguratorMixin::test_get_settings_nosettings\nPASSED r2e_tests/test_config/test_settings.py::TestSettingsConfiguratorMixin::test_get_settings_withsettings\nPASSED r2e_tests/test_config/test_settings.py::TestSettingsConfiguratorMixin::test_settings_parameter_dict_is_never_updated\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_csrf_trusted_origins\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_debug_all\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_debug_authorization\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_debug_notfound\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_debug_routematch\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_debug_templates\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_default_locale_name\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_noargs\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_originals_kept\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_prevent_cachebust\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_prevent_http_cache\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_reload_all\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_reload_assets\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_reload_resources\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_reload_templates\nPASSED r2e_tests/test_config/test_testing.py::TestingConfiguratorMixinTests::test_testing_add_renderer\nPASSED r2e_tests/test_config/test_testing.py::TestingConfiguratorMixinTests::test_testing_add_renderer_explicitrenderer\nPASSED r2e_tests/test_config/test_testing.py::TestingConfiguratorMixinTests::test_testing_add_renderer_twice\nPASSED r2e_tests/test_config/test_testing.py::TestingConfiguratorMixinTests::test_testing_add_subscriber_defaults\nPASSED r2e_tests/test_config/test_testing.py::TestingConfiguratorMixinTests::test_testing_add_subscriber_dottedname\nPASSED r2e_tests/test_config/test_testing.py::TestingConfiguratorMixinTests::test_testing_add_subscriber_multiple\nPASSED r2e_tests/test_config/test_testing.py::TestingConfiguratorMixinTests::test_testing_add_subscriber_single\nPASSED r2e_tests/test_config/test_testing.py::TestingConfiguratorMixinTests::test_testing_add_template\nPASSED r2e_tests/test_config/test_testing.py::TestingConfiguratorMixinTests::test_testing_resources\nPASSED r2e_tests/test_config/test_testing.py::TestingConfiguratorMixinTests::test_testing_securitypolicy\nPASSED r2e_tests/test_config/test_testing.py::TestingConfiguratorMixinTests::test_testing_securitypolicy_forget_result\nPASSED r2e_tests/test_config/test_testing.py::TestingConfiguratorMixinTests::test_testing_securitypolicy_remember_result\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tween_dottedname\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tween_instance\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tween_name_ingress\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tween_name_main\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tween_over_ingress\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tween_over_ingress_iterable\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tween_under_main\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tween_under_main_iterable\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tween_unsuitable\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tweens_conflict\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tweens_names_distinct\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tweens_names_with_over_nonstringoriter\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tweens_names_with_under_nonstringoriter\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tweens_names_with_underover\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test___call___explicit\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test___call___implicit\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_add_explicit\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_add_implicit\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_1\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_2\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_3\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_4\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_5\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_conflict_direct\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_conflict_indirect\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_missing_over_and_under_partials\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_missing_over_partial\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_missing_over_partial_with_fallback\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_missing_under_partial\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_missing_under_partial_with_fallback\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_with_missing_fallbacks\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_with_multiple_matching_fallbacks\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_with_partial_fallbacks\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_custom_predicates_can_affect_traversal\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_different_custom_predicates_with_same_hash\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_match_param_from_dict\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_match_param_from_dict_fails\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_match_param_from_string\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_match_param_from_string_fails\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_notted\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_ordering_importance_and_number\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_ordering_importance_of_predicates\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_ordering_number_of_predicates\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_ordering_xhr_and_request_method_trump_only_containment\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_predicate_text_is_correct\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_request_method_ordering_hashes_same\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_request_method_sequence\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_traverse_has_remainder_already\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_traverse_matches\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_traverse_matches_with_highorder_chars\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_unknown_predicate\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_function_annotations\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_function_defaultargs_firstname_not_request\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_function_defaultargs_firstname_request\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_function_noargs\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_function_onearg_named_request\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_function_onearg_named_somethingelse\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_function_toomanyargs\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_function_with_attr_false\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_function_with_attr_true\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_instance_defaultargs_firstname_not_request\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_instance_defaultargs_firstname_request\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_instance_defaultargs_onearg_named_request\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_instance_defaultargs_onearg_named_somethingelse\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_instance_nocall\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_instance_toomanyargs\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_method_onearg_named_request\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_newstyle_class_init_defaultargs_firstname_not_request\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_newstyle_class_init_defaultargs_firstname_request\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_newstyle_class_init_firstname_request_with_secondname\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_newstyle_class_init_noargs\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_newstyle_class_init_onearg_named_somethingelse\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_oldstyle_class_init_defaultargs_firstname_not_request\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_oldstyle_class_init_defaultargs_firstname_request\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_oldstyle_class_init_noargs\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_oldstyle_class_init_onearg_named_request\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_oldstyle_class_init_onearg_named_somethingelse\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_oldstyle_class_init_toomanyargs\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_oldstyle_class_no_init\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_requestonly_newstyle_class_init_onearg_named_request\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_requestonly_newstyle_class_init_toomanyargs\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_requestonly_newstyle_class_no_init\nPASSED r2e_tests/test_config/test_util.py::TestNotted::test_it_with_phash_val\nPASSED r2e_tests/test_config/test_util.py::TestNotted::test_it_without_phash_val\nPASSED r2e_tests/test_config/test_util.py::TestDeprecatedPredicates::test_it\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_exception_view\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_exception_view_disallows_exception_only\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_exception_view_disallows_for_\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_exception_view_disallows_name\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_exception_view_disallows_permission\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_exception_view_disallows_require_csrf\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_exception_view_with_subclass\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_exception_view_with_view_defaults\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_forbidden_view\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_forbidden_view_allows_other_predicates\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_forbidden_view_disallows_context\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_forbidden_view_disallows_for_\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_forbidden_view_disallows_name\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_forbidden_view_disallows_permission\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_forbidden_view_disallows_require_csrf\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_forbidden_view_no_view_argument\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_forbidden_view_with_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_forbidden_view_with_view_defaults\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_normal_and_exception_view_intr_derived_callable\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_notfound_view\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_notfound_view_allows_other_predicates\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_notfound_view_append_slash\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_notfound_view_append_slash_custom_response\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_notfound_view_disallows_context\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_notfound_view_disallows_for_\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_notfound_view_disallows_name\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_notfound_view_disallows_permission\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_notfound_view_disallows_require_csrf\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_notfound_view_no_view_argument\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_notfound_view_with_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_notfound_view_with_view_defaults\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_static_view_absolute\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_static_view_here_no_utility_registered\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_static_view_package_relative\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_as_instance\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_as_instance_requestonly\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_as_instancemethod\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_as_instancemethod_requestonly\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_as_oldstyle_class\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_as_oldstyle_class_requestonly\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_class_method_no_attr\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_context_as_class\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_context_as_dottedname\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_context_as_iface\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_context_trumps_for\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_custom_more_preds_first_bests_fewer_preds_last\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_custom_predicate_bests_standard_predicate\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_default_phash_overrides_default_phash\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_default_phash_overrides_no_phash\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_exc_default_phash_overrides_default_phash\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_exc_default_phash_overrides_no_phash\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_exc_multiview_replaces_existing_securedview\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_exc_multiview_replaces_existing_view\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_exc_multiview_replaces_multiviews\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_exc_multiview_replaces_only_exc_multiview\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_exc_mulview_replaces_existing_view_with___accept__\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_exc_same_phash_overrides_existing_single_view\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_exc_with_accept_multiview_replaces_existing_view\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_exception_only\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_exception_only_misconfiguration\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_exception_only_no_regular_view\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_exception_register_secured_view\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_for__as_dottedname\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_for_as_class\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_for_as_iface\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_mixed_case_replaces_existing_view\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_multiview___discriminator__\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_multiview_call_ordering\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_multiview_context_superclass_then_subclass\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_multiview_exception_superclass_then_subclass\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_multiview_replaces_existing_securedview\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_multiview_replaces_existing_view\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_multiview_replaces_existing_view_with___accept__\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_multiview_replaces_multiview\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_register_secured_view\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_same_phash_overrides_existing_single_view\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_same_predicates\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_view_callable_None_no_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_view_callable_None_with_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_view_callable_dottedname\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_accept_match\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_accept_multiview_replaces_existing_view\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_accept_nomatch\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_check_csrf_predicates_match\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_containment_dottedname\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_containment_false\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_containment_true\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_csrf_header\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_csrf_param\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_custom_predicates_match\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_custom_predicates_nomatch\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_decorator\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_decorator_tuple\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_default_permission_no_explicit_permission\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_default_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_function_callable\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_function_callable_requestonly\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_header_badregex\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_header_noval_match\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_header_noval_nomatch\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_header_val_match\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_header_val_missing\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_header_val_nomatch\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_http_cache\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_mapper\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_missing_csrf_header\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_name\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_name_unicode\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_no_default_permission_no_explicit_permission\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_nonexistant_route_name\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_path_info_badregex\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_path_info_match\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_path_info_nomatch\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_permission\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_method_false\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_method_get_implies_head\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_method_sequence_conflict\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_method_sequence_false\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_method_sequence_true\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_method_true\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_param_noval_false\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_param_noval_true\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_param_val_false\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_param_val_true\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_type\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_type_and_route_name\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_type_as_iface\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_type_as_noniface\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_route_name\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_route_name_exception\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_tmpl_renderer_factory_introspector_missing\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_tmpl_renderer_factory_no_renderer_factory\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_tmpl_renderer_factory_with_renderer_factory\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_view_config_and_view_defaults_conflicts\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_view_config_and_view_defaults_doesnt_conflict\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_view_defaults\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_view_defaults_viewname_is_dottedname_kwarg\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_view_defaults_viewname_is_dottedname_nonkwarg\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_xhr_false\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_xhr_true\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_wrapped_view_is_decorated\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_views_with_accept_multiview_replaces_existing\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_derive_view_dottedname\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_derive_view_function\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_derive_view_with_default_renderer_no_explicit_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_derive_view_with_default_renderer_with_explicit_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_set_view_mapper\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_set_view_mapper_dottedname\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_view_with_most_specific_predicate\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_view_with_most_specific_predicate_with_mismatch\nPASSED r2e_tests/test_config/test_views.py::Test_runtime_exc_view::test_call\nPASSED r2e_tests/test_config/test_views.py::Test_runtime_exc_view::test_call_dispatches_on_exception\nPASSED r2e_tests/test_config/test_views.py::Test_runtime_exc_view::test_permitted\nPASSED r2e_tests/test_config/test_views.py::Test_runtime_exc_view::test_permitted_dispatches_on_exception\nPASSED r2e_tests/test_config/test_views.py::Test_requestonly::test_defaults\nPASSED r2e_tests/test_config/test_views.py::Test_requestonly::test_otherattr\nPASSED r2e_tests/test_config/test_views.py::Test_isexception::test_is_IException\nPASSED r2e_tests/test_config/test_views.py::Test_isexception::test_is_IException_subinterface\nPASSED r2e_tests/test_config/test_views.py::Test_isexception::test_is_exception_class\nPASSED r2e_tests/test_config/test_views.py::Test_isexception::test_is_exception_instance\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test___call__\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test___call__intermediate_not_found\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test___call__raise_not_found_isnt_interpreted_as_pred_mismatch\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test___call_permissive_has_call_permissive\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test___call_permissive_has_no_call_permissive\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test__call__not_found\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test__call__with_accept_match\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test__call__with_accept_miss\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test__call_permissive__not_found\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_add\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_add_with_phash\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_add_with_phash_override_accept\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_add_with_phash_override_accept2\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_class_implements_ISecuredView\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_get_views\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_get_views_best_match_returns_None\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_get_views_no_self_accepts\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_get_views_request_has_no_accept\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_instance_implements_ISecuredView\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_match_not_found\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_match_predicate_fails\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_match_predicate_succeeds\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_multiple_with_functions_as_views\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_permitted\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_permitted_no_match_with__permitted__\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_permitted_no_views\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test__view_as_function_with_attr\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_function_context_and_request\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_function_requestonly\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_function_requestonly_with_attr\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_instance_context_and_request\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_instance_context_and_request_and_attr\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_instance_requestonly\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_instance_requestonly_with_attr\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_newstyle_class_context_and_request\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_newstyle_class_context_and_request_with_attr\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_newstyle_class_requestonly\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_newstyle_class_requestonly_with_attr\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_oldstyle_class_context_and_request\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_oldstyle_class_context_and_request_with_attr\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_oldstyle_class_requestonly\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_oldstyle_class_requestonly_with_attr\nPASSED r2e_tests/test_config/test_views.py::Test_preserve_view_attrs::test_it_different\nPASSED r2e_tests/test_config/test_views.py::Test_preserve_view_attrs::test_it_different_with_existing_original_view\nPASSED r2e_tests/test_config/test_views.py::Test_preserve_view_attrs::test_it_same\nPASSED r2e_tests/test_config/test_views.py::Test_preserve_view_attrs::test_it_view_is_None\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_already_exists\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_cachebust_prevented\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_cachebuster\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_cachebuster_abspath\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_cachebuster_for_more_specific_path\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_cachebuster_overwrite\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_cachebuster_overwrite_explicit\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_package_root\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_url_noendslash\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_url_noscheme\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_url_withendslash\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_viewname\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_viewname_with_context\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_viewname_with_for_\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_viewname_with_permission\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_viewname_with_renderer\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_viewname_with_route_prefix\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_missing\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_quoting\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_registration_miss\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_route_url\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_slash_in_name1\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_slash_in_name2\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_url_cachebust\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_url_cachebust_abspath\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_url_cachebust_nomatch\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_url_quoted_remote\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_url_unquoted_local\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_url_with_custom_anchor\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_url_with_custom_query\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_verifyClass\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_verifyObject\nPASSED r2e_tests/test_config/test_views.py::Test_view_description::test_with_text\nPASSED r2e_tests/test_scripts/test_common.py::TestParseVars::test_parse_vars_bad\nPASSED r2e_tests/test_scripts/test_common.py::TestParseVars::test_parse_vars_good\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_confirm_override_conflicting_name\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_force_override_conflicting_name\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_force_override_site_name\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_known_scaffold_absolute_path\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_known_scaffold_multiple_rendered\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_known_scaffold_single_rendered\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_known_scaffold_with_path_as_project_target_rendered\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_no_project_name\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_run_no_scaffold_name\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_run_no_scaffold_no_args\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_run_show_scaffolds_exist\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_run_show_scaffolds_none_exist\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_scaffold_with_dev_pyramid_long_version\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_scaffold_with_dev_pyramid_version\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_scaffold_with_hyphen_in_project_name\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_scaffold_with_package_name\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_scaffold_with_prod_pyramid_long_version\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_scaffold_with_prod_pyramid_unparsable_version\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_scaffold_with_prod_pyramid_version\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_unknown_scaffold_name\nPASSED r2e_tests/test_scripts/test_pcreate.py::Test_main::test_it\nPASSED r2e_tests/test_scripts/test_pdistreport.py::TestPDistReportCommand::test_no_dists\nPASSED r2e_tests/test_scripts/test_pdistreport.py::TestPDistReportCommand::test_with_dists\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_display_headers\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_has_bad_config_header\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_has_content_type_header_var\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_has_good_header_var\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_has_multiple_header_vars\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_method_configures_logging\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_method_get\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_method_options\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_method_patch\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_method_post\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_method_propfind\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_method_put\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_not_enough_args\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_path_doesnt_start_with_slash\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_response_has_no_charset\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_two_args\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_w_basic_auth\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_with_query_string\nPASSED r2e_tests/test_scripts/test_prequest.py::Test_main::test_it\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test__get_mapper\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_bad_args\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_bad_format\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_class_view\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_config_format_ini_commas\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_config_format_ini_newlines\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_config_format_ini_spaces\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_good_args\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_good_format\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_no_mapper\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_no_routes\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_route_as_wsgiapp\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_route_no_view\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_route_with_no_slash_prefix\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_single_route_multiview_registered\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_single_route_no_route_registered\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_single_route_no_views_registered\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_single_route_one_view_registered_with_factory\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_static_routes_included_in_list\nPASSED r2e_tests/test_scripts/test_proutes.py::Test_main::test_it\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test__guess_server_url\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_config_file_finds_open_url\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_config_vars_no_command\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_parse_vars_bad\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_parse_vars_good\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_reload_call_hupper_with_correct_args\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_run_no_args\nPASSED r2e_tests/test_scripts/test_pserve.py::Test_main::test_it\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_command_custom_section_override\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_command_default_shell_option\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_command_errors_with_unknown_shell\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_command_loads_check_variable_override_order\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_command_loads_custom_items\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_command_loads_default_shell\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_command_loads_ipython\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_command_loads_pythonstartup\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_command_loads_setup_from_options\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_command_setup\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_list_shells\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_shell_entry_points\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_shell_ordering\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_shell_override\nPASSED r2e_tests/test_scripts/test_pshell.py::Test_python_shell_runner::test_it\nPASSED r2e_tests/test_scripts/test_pshell.py::Test_main::test_it\nPASSED r2e_tests/test_scripts/test_ptweens.py::TestPTweensCommand::test__get_tweens\nPASSED r2e_tests/test_scripts/test_ptweens.py::TestPTweensCommand::test_command_implicit_and_explicit_tweens\nPASSED r2e_tests/test_scripts/test_ptweens.py::TestPTweensCommand::test_command_implicit_tweens_only\nPASSED r2e_tests/test_scripts/test_ptweens.py::TestPTweensCommand::test_command_no_tweens\nPASSED r2e_tests/test_scripts/test_ptweens.py::Test_main::test_it\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test__find_multi_routes_all_match\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test__find_multi_routes_none_match\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test__find_multi_routes_some_match\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test__find_view_no_match\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test__find_view_no_match_multiview_registered\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test__find_view_route_multiview\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test__find_view_route_multiview_no_view_registered\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test__find_view_route_no_multiview\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test__find_view_traversal\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test__find_view_traversal_multiview\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test_views_command_multi_view_nested\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test_views_command_multiview\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test_views_command_multiview_with_permission\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test_views_command_multiview_with_predicates\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test_views_command_not_found\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test_views_command_not_found_url_starts_without_slash\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test_views_command_single_view_route\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test_views_command_single_view_route_with_route_predicates\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test_views_command_single_view_traversal\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test_views_command_single_view_traversal_with_permission\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test_views_command_single_view_traversal_with_predicates\nPASSED r2e_tests/test_scripts/test_pviews.py::Test_main::test_it\nFAILED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_no_registry - Assert...\nFAILED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_noreg_debug_logger_None_default\nFAILED r2e_tests/test_1.py::ConfiguratorTests::test_include_constant_root_package\nFAILED r2e_tests/test_1.py::ConfiguratorTests::test_scan_integration_conflict\nFAILED r2e_tests/test_1.py::ConfiguratorTests::test_scan_integration_with_onerror\nFAILED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_debug_logger_None_default\nFAILED r2e_tests/test_1.py::TestConfigurator_add_directive::test_add_directive_with_custom_callable\nFAILED r2e_tests/test_1.py::TestConfigurator_add_directive::test_add_directive_with_partial\nFAILED r2e_tests/test_1.py::TestConfigurator_add_directive::test_extend_with_dotted_name\nFAILED r2e_tests/test_1.py::TestConfigurator_add_directive::test_extend_with_python_callable\nFAILED r2e_tests/test_1.py::TestConfigurator__add_predicate::test_factory_as_dotted_name\nFAILED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_resource_url_adapter_dotted_names\nFAILED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_resource_url_adapter_introspectables\nFAILED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_traverser_dotted_names\nFAILED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_directory_with_directory\nFAILED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_directory_with_package\nFAILED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_file_with_file\nFAILED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_package_with_directory\nFAILED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_package_with_package\nFAILED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_get_resource_filename_no_overrides\nFAILED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_get_resource_filename_override_returns_None\nFAILED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_get_filename\nFAILED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_get_filename_with_prefix\nFAILED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_add_translation_dirs_abspath\nFAILED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_add_translation_dirs_asset_spec\nFAILED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_add_translation_dirs_asset_spec_existing_translation_dirs\nFAILED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_add_translation_dirs_doesnt_use_override_w_autocommit\nFAILED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_add_translation_dirs_multiple_specs\nFAILED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_add_translation_dirs_multiple_specs_multiple_calls\nFAILED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_add_translation_dirs_override_multiple_specs_multiple_calls\nFAILED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_add_translation_dirs_uses_override_out_of_order\nFAILED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_add_translation_dirs_uses_override_w_autocommit\nFAILED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_no_registry\nFAILED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_noreg_debug_logger_None_default\nFAILED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_include_constant_root_package\nFAILED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_scan_integration_conflict\nFAILED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_debug_logger_None_default\nFAILED r2e_tests/test_config/test_init.py::TestConfigurator_add_directive::test_add_directive_with_custom_callable\nFAILED r2e_tests/test_config/test_init.py::TestConfigurator_add_directive::test_add_directive_with_partial\nFAILED r2e_tests/test_config/test_init.py::TestConfigurator_add_directive::test_extend_with_dotted_name\nFAILED r2e_tests/test_config/test_init.py::TestConfigurator_add_directive::test_extend_with_python_callable\nFAILED r2e_tests/test_config/test_init.py::TestConfigurator__add_predicate::test_factory_as_dotted_name\nFAILED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_static_view_package_here_relative\nFAILED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_template_renderer\nFAILED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_template_renderer_no_callable\nFAILED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_url_cachebust_with_overrides\nFAILED r2e_tests/test_config/test_views.py::Test_view_description::test_without_text\nFAILED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_one_route_all_methods_view_only_post\nFAILED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_one_route_only_post_view_all_methods\nFAILED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_one_route_only_post_view_post_and_get\nFAILED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_one_route_with_long_name_one_view_registered\nFAILED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_route_is_get_view_request_method_not_post\nFAILED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_route_request_method_mismatch\nFAILED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_route_static_views\nFAILED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_single_route_one_view_registered\nFAILED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_view_glob\nFAILED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_view_request_method_not_post\nFAILED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_config_file_finds_watch_files\nFAILED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test_views_command_single_view_function_traversal\n======================== 59 failed, 919 passed in 5.98s ========================\n",
    "new_commit_res_stderr": "",
    "old_commit_res_code": 1,
    "old_commit_res_stdout": "============================= test session starts ==============================\nplatform linux -- Python 3.8.20, pytest-8.3.4, pluggy-1.5.0\nrootdir: /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab\ncollected 978 items\n\nr2e_tests/test_1.py ...........................................F..F..... [  5%]\n..FF.............F...F.......F.....................FF...FFF............. [ 12%]\n.................                                                        [ 14%]\nr2e_tests/test_config/test_adapters.py .FF..............F...             [ 16%]\nr2e_tests/test_config/test_assets.py ....F.F...F...FF.FF................ [ 20%]\n.....................................F.F................................ [ 27%]\n                                                                         [ 27%]\nr2e_tests/test_config/test_factories.py .......................          [ 29%]\nr2e_tests/test_config/test_i18n.py FFFF..FF.FFF..                        [ 31%]\nr2e_tests/test_config/test_init.py ..................................... [ 35%]\n......F..F.......FF.............F...........F.....................FF...F [ 42%]\nFF..............................                                         [ 45%]\nr2e_tests/test_config/test_rendering.py ...                              [ 46%]\nr2e_tests/test_config/test_routes.py ........................            [ 48%]\nr2e_tests/test_config/test_security.py ............                      [ 49%]\nr2e_tests/test_config/test_settings.py ........................          [ 52%]\nr2e_tests/test_config/test_testing.py ............                       [ 53%]\nr2e_tests/test_config/test_tweens.py .................................   [ 56%]\nr2e_tests/test_config/test_util.py ..................................... [ 60%]\n...............                                                          [ 62%]\nr2e_tests/test_config/test_views.py .................................F.. [ 65%]\n........................................................................ [ 73%]\n.......................FF............................................... [ 80%]\n.......................................................F.......F         [ 87%]\nr2e_tests/test_scripts/test_common.py ..                                 [ 87%]\nr2e_tests/test_scripts/test_pcreate.py .....................             [ 89%]\nr2e_tests/test_scripts/test_pdistreport.py ..                            [ 89%]\nr2e_tests/test_scripts/test_prequest.py ...................              [ 91%]\nr2e_tests/test_scripts/test_proutes.py ...........FFFF.F.FF....F..FF.    [ 94%]\nr2e_tests/test_scripts/test_pserve.py ..F......                          [ 95%]\nr2e_tests/test_scripts/test_pshell.py ................                   [ 97%]\nr2e_tests/test_scripts/test_ptweens.py .....                             [ 97%]\nr2e_tests/test_scripts/test_pviews.py ................F......            [100%]\n\n=================================== FAILURES ===================================\n___________________ ConfiguratorTests.test_ctor_no_registry ____________________\n\nself = <r2e_tests.test_1.ConfiguratorTests testMethod=test_ctor_no_registry>\n\n    def test_ctor_no_registry(self):\n        import sys\n        from pyramid.interfaces import ISettings\n        from pyramid.config import Configurator\n        from pyramid.interfaces import IRendererFactory\n        config = Configurator()\n        this_pkg = sys.modules['pyramid.tests.test_config']\n        self.assertTrue(config.registry.getUtility(ISettings))\n>       self.assertEqual(config.package, this_pkg)\nE       AssertionError: <module 'r2e_tests' from '/home/gcpuser/buckets/lo[93 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_1.py:68: AssertionError\n_________ ConfiguratorTests.test_ctor_noreg_debug_logger_None_default __________\n\nself = <r2e_tests.test_1.ConfiguratorTests testMethod=test_ctor_noreg_debug_logger_None_default>\n\n    def test_ctor_noreg_debug_logger_None_default(self):\n        from pyramid.interfaces import IDebugLogger\n        config = self._makeOne()\n        logger = config.registry.getUtility(IDebugLogger)\n>       self.assertEqual(logger.name, 'pyramid.tests.test_config')\nE       AssertionError: 'r2e_tests' != 'pyramid.tests.test_config'\nE       - r2e_tests\nE       + pyramid.tests.test_config\n\nr2e_tests/test_1.py:165: AssertionError\n_____________ ConfiguratorTests.test_include_constant_root_package _____________\n\nself = <r2e_tests.test_1.ConfiguratorTests testMethod=test_include_constant_root_package>\n\n    def test_include_constant_root_package(self):\n        from pyramid import tests\n        from pyramid.tests import test_config\n        config = self._makeOne(root_package=tests)\n        results = {}\n        def include(config):\n            results['package'] = config.package\n            results['root_package'] = config.root_package\n        config.include(include)\n        self.assertEqual(results['root_package'], tests)\n>       self.assertEqual(results['package'], test_config)\nE       AssertionError: <module 'r2e_tests' from '/home/gcpuser/buckets/lo[93 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_1.py:818: AssertionError\n______________ ConfiguratorTests.test_include_threadlocals_active ______________\n\nself = <r2e_tests.test_1.ConfiguratorTests testMethod=test_include_threadlocals_active>\n\n    def test_include_threadlocals_active(self):\n        from pyramid.tests import test_config\n        from pyramid.threadlocal import get_current_registry\n        stack = []\n        def include(config):\n            stack.append(get_current_registry())\n        config = self._makeOne()\n        config.include(include)\n>       self.assertTrue(stack[0] is config.registry)\nE       AssertionError: False is not true\n\nr2e_tests/test_1.py:828: AssertionError\n_______________ ConfiguratorTests.test_scan_integration_conflict _______________\n\nself = <r2e_tests.test_1.ConfiguratorTests testMethod=test_scan_integration_conflict>\n\n    def test_scan_integration_conflict(self):\n        from pyramid.tests.test_config.pkgs import selfscan\n        from pyramid.config import Configurator\n        c = Configurator()\n        c.scan(selfscan)\n        c.scan(selfscan)\n        try:\n>           c.commit()\n\nr2e_tests/test_1.py:1090: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \npyramid/config/__init__.py:657: in commit\n    self.action_state.execute_actions(introspector=self.introspector)\npyramid/config/__init__.py:1151: in execute_actions\n    action = next(action_iter, None)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nactions = [{'args': (), 'callable': <function ViewsConfiguratorMixin.add_view.<locals>.register at 0x7cfdc26a8040>, 'discriminat...fdc2721280>, 'discriminator': ('view', None, 'two', None, 'd41d8cd98f00b204e9800998ecf8427e'), 'includepath': (), ...}]\nstate = <pyramid.config.ConflictResolverState object at 0x7cfdc2ce6310>\n\n    def resolveConflicts(actions, state=None):\n        \"\"\"Resolve conflicting actions\n    \n        Given an actions list, identify and try to resolve conflicting actions.\n        Actions conflict if they have the same non-None discriminator.\n    \n        Conflicting actions can be resolved if the include path of one of\n        the actions is a prefix of the includepaths of the other\n        conflicting actions and is unequal to the include paths in the\n        other conflicting actions.\n    \n        Actions are resolved on a per-order basis because some discriminators\n        cannot be computed until earlier actions have executed. An action in an\n        earlier order may execute successfully only to find out later that it was\n        overridden by another action with a smaller include path. This will result\n        in a conflict as there is no way to revert the original action.\n    \n        ``state`` may be an instance of ``ConflictResolverState`` that\n        can be used to resume execution and resolve the new actions against the\n        list of executed actions from a previous call.\n    \n        \"\"\"\n        if state is None:\n            state = ConflictResolverState()\n    \n        # pick up where we left off last time, but track the new actions as well\n        state.remaining_actions.extend(normalize_actions(actions))\n        actions = state.remaining_actions\n    \n        def orderandpos(v):\n            n, v = v\n            return (v['order'] or 0, n)\n    \n        def orderonly(v):\n            n, v = v\n            return v['order'] or 0\n    \n        sactions = sorted(enumerate(actions, start=state.start), key=orderandpos)\n        for order, actiongroup in itertools.groupby(sactions, orderonly):\n            # \"order\" is an integer grouping. Actions in a lower order will be\n            # executed before actions in a higher order.  All of the actions in\n            # one grouping will be executed (its callable, if any will be called)\n            # before any of the actions in the next.\n            output = []\n            unique = {}\n    \n            # error out if we went backward in order\n            if state.min_order is not None and order < state.min_order:\n                r = ['Actions were added to order={0} after execution had moved '\n                     'on to order={1}. Conflicting actions: '\n                     .format(order, state.min_order)]\n                for i, action in actiongroup:\n                    for line in str(action['info']).rstrip().split('\\n'):\n                        r.append(\"  \" + line)\n                raise ConfigurationError('\\n'.join(r))\n    \n            for i, action in actiongroup:\n                # Within an order, actions are executed sequentially based on\n                # original action ordering (\"i\").\n    \n                # \"ainfo\" is a tuple of (i, action) where \"i\" is an integer\n                # expressing the relative position of this action in the action\n                # list being resolved, and \"action\" is an action dictionary.  The\n                # purpose of an ainfo is to associate an \"i\" with a particular\n                # action; \"i\" exists for sorting after conflict resolution.\n                ainfo = (i, action)\n    \n                # wait to defer discriminators until we are on their order because\n                # the discriminator may depend on state from a previous order\n                discriminator = undefer(action['discriminator'])\n                action['discriminator'] = discriminator\n    \n                if discriminator is None:\n                    # The discriminator is None, so this action can never conflict.\n                    # We can add it directly to the result.\n                    output.append(ainfo)\n                    continue\n    \n                L = unique.setdefault(discriminator, [])\n                L.append(ainfo)\n    \n            # Check for conflicts\n            conflicts = {}\n            for discriminator, ainfos in unique.items():\n                # We use (includepath, i) as a sort key because we need to\n                # sort the actions by the paths so that the shortest path with a\n                # given prefix comes first.  The \"first\" action is the one with the\n                # shortest include path.  We break sorting ties using \"i\".\n                def bypath(ainfo):\n                    path, i = ainfo[1]['includepath'], ainfo[0]\n                    return path, order, i\n    \n                ainfos.sort(key=bypath)\n                ainfo, rest = ainfos[0], ainfos[1:]\n                _, action = ainfo\n    \n                # ensure this new action does not conflict with a previously\n                # resolved action from an earlier order / invocation\n                prev_ainfo = state.resolved_ainfos.get(discriminator)\n                if prev_ainfo is not None:\n                    _, paction = prev_ainfo\n                    basepath, baseinfo = paction['includepath'], paction['info']\n                    includepath = action['includepath']\n                    # if the new action conflicts with the resolved action then\n                    # note the conflict, otherwise drop the action as it's\n                    # effectively overriden by the previous action\n                    if (includepath[:len(basepath)] != basepath or\n                            includepath == basepath):\n                        L = conflicts.setdefault(discriminator, [baseinfo])\n                        L.append(action['info'])\n    \n                else:\n                    output.append(ainfo)\n    \n                basepath, baseinfo = action['includepath'], action['info']\n                for _, action in rest:\n                    includepath = action['includepath']\n                    # Test whether path is a prefix of opath\n                    if (includepath[:len(basepath)] != basepath or  # not a prefix\n                            includepath == basepath):\n                        L = conflicts.setdefault(discriminator, [baseinfo])\n                        L.append(action['info'])\n    \n            if conflicts:\n>               raise ConfigurationConflictError(conflicts)\nE               pyramid.exceptions.ConfigurationConflictError: Conflicting configuration actions\nE                 For: ('view', None, '', None, 'd41d8cd98f00b204e9800998ecf8427e')\nE                   Line 4 of file /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/pkgs/selfscan/__init__.py:\nE                       def abc(request):\nE                   Line 4 of file /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/pkgs/selfscan/__init__.py:\nE                       def abc(request):\nE                 For: ('view', None, 'two', None, 'd41d8cd98f00b204e9800998ecf8427e')\nE                   Line 4 of file /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/pkgs/selfscan/another.py:\nE                       def two(request):\nE                   Line 4 of file /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/pkgs/selfscan/another.py:\nE                       def two(request):\n\npyramid/config/__init__.py:1333: ConfigurationConflictError\n\nDuring handling of the above exception, another exception occurred:\n\nself = <r2e_tests.test_1.ConfiguratorTests testMethod=test_scan_integration_conflict>\n\n    def test_scan_integration_conflict(self):\n        from pyramid.tests.test_config.pkgs import selfscan\n        from pyramid.config import Configurator\n        c = Configurator()\n        c.scan(selfscan)\n        c.scan(selfscan)\n        try:\n            c.commit()\n        except ConfigurationConflictError as why:\n            def scanconflicts(e):\n                conflicts = e._conflicts.values()\n                for conflict in conflicts:\n                    for confinst in conflict:\n                        yield confinst.src\n            which = list(scanconflicts(why))\n            self.assertEqual(len(which), 4)\n>           self.assertTrue(\"@view_config(renderer='string')\" in which)\nE           AssertionError: False is not true\n\nr2e_tests/test_1.py:1099: AssertionError\n_____________ ConfiguratorTests.test_scan_integration_with_onerror _____________\n\nself = <r2e_tests.test_1.ConfiguratorTests testMethod=test_scan_integration_with_onerror>\n\n    def test_scan_integration_with_onerror(self):\n        # fancy sys.path manipulation here to appease \"setup.py test\" which\n        # fails miserably when it can't import something in the package\n        import sys\n        try:\n            here = os.path.dirname(__file__)\n            path = os.path.join(here, 'path')\n            sys.path.append(path)\n            config = self._makeOne(autocommit=True)\n            class FooException(Exception):\n                pass\n            def onerror(name):\n                raise FooException\n>           self.assertRaises(FooException, config.scan, 'scanerror',\n                              onerror=onerror)\n\nr2e_tests/test_1.py:1078: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \npyramid/config/__init__.py:987: in scan\n    package = self.maybe_dotted(package)\npyramid/config/__init__.py:876: in maybe_dotted\n    return self.name_resolver.maybe_resolve(dotted)\npyramid/path.py:320: in maybe_resolve\n    return self._resolve(dotted, package)\npyramid/path.py:327: in _resolve\n    return self._zope_dottedname_style(dotted, package)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\n    def _zope_dottedname_style(self, value, package):\n        \"\"\" package.module.attr style \"\"\"\n        module = getattr(package, '__name__', None) # package may be None\n        if not module:\n            module = None\n        if value == '.':\n            if module is None:\n                raise ValueError(\n                    'relative name %r irresolveable without package' % (value,)\n                )\n            name = module.split('.')\n        else:\n            name = value.split('.')\n            if not name[0]:\n                if module is None:\n                    raise ValueError(\n                        'relative name %r irresolveable without '\n                        'package' % (value,)\n                        )\n                module = module.split('.')\n                name.pop(0)\n                while not name[0]:\n                    module.pop()\n                    name.pop(0)\n                name = module + name\n    \n        used = name.pop(0)\n>       found = __import__(used)\nE       ModuleNotFoundError: No module named 'scanerror'\n\npyramid/path.py:376: ModuleNotFoundError\n_______ ConfiguratorTests.test_setup_registry_debug_logger_None_default ________\n\nself = <r2e_tests.test_1.ConfiguratorTests testMethod=test_setup_registry_debug_logger_None_default>\n\n    def test_setup_registry_debug_logger_None_default(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDebugLogger\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry()\n        logger = reg.getUtility(IDebugLogger)\n>       self.assertEqual(logger.name, 'pyramid.tests.test_config')\nE       AssertionError: 'r2e_tests' != 'pyramid.tests.test_config'\nE       - r2e_tests\nE       + pyramid.tests.test_config\n\nr2e_tests/test_1.py:485: AssertionError\n____ TestConfigurator_add_directive.test_add_directive_with_custom_callable ____\n\nself = <r2e_tests.test_1.TestConfigurator_add_directive testMethod=test_add_directive_with_custom_callable>\n\n    def test_add_directive_with_custom_callable(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n                'dummy_callable', 'pyramid.tests.test_config.dummy_callable')\n        self.assertTrue(hasattr(config, 'dummy_callable'))\n        config.dummy_callable('discrim')\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n>       self.assertEqual(action['args'], test_config)\nE       AssertionError: <module 'r2e_tests' from '/home/gcpuser/buckets/lo[93 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_1.py:1298: AssertionError\n________ TestConfigurator_add_directive.test_add_directive_with_partial ________\n\nself = <r2e_tests.test_1.TestConfigurator_add_directive testMethod=test_add_directive_with_partial>\n\n    def test_add_directive_with_partial(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n                'dummy_partial', 'pyramid.tests.test_config.dummy_partial')\n        self.assertTrue(hasattr(config, 'dummy_partial'))\n        config.dummy_partial()\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'partial')\n        self.assertEqual(action['callable'], None)\n>       self.assertEqual(action['args'], test_config)\nE       AssertionError: <module 'r2e_tests' from '/home/gcpuser/buckets/lo[93 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_1.py:1285: AssertionError\n_________ TestConfigurator_add_directive.test_extend_with_dotted_name __________\n\nself = <r2e_tests.test_1.TestConfigurator_add_directive testMethod=test_extend_with_dotted_name>\n\n    def test_extend_with_dotted_name(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n            'dummy_extend', 'pyramid.tests.test_config.dummy_extend')\n        self.assertTrue(hasattr(config, 'dummy_extend'))\n        config.dummy_extend('discrim')\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n>       self.assertEqual(action['args'], test_config)\nE       AssertionError: <module 'r2e_tests' from '/home/gcpuser/buckets/lo[93 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_1.py:1272: AssertionError\n_______ TestConfigurator_add_directive.test_extend_with_python_callable ________\n\nself = <r2e_tests.test_1.TestConfigurator_add_directive testMethod=test_extend_with_python_callable>\n\n    def test_extend_with_python_callable(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n            'dummy_extend', dummy_extend)\n        self.assertTrue(hasattr(config, 'dummy_extend'))\n        config.dummy_extend('discrim')\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n>       self.assertEqual(action['args'], test_config)\nE       AssertionError: <module 'r2e_tests' from '/home/gcpuser/buckets/lo[93 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_1.py:1311: AssertionError\n_________ TestConfigurator__add_predicate.test_factory_as_dotted_name __________\n\nself = <r2e_tests.test_1.TestConfigurator__add_predicate testMethod=test_factory_as_dotted_name>\n\n    def test_factory_as_dotted_name(self):\n        config = self._makeOne()\n    \n        def _fakeAction(discriminator, callable=None, args=(),\n                        kw=None, order=0, introspectables=(), **extra):\n            self.assertEqual(len(introspectables), 1)\n            self.assertEqual(introspectables[0]['name'], 'testing')\n            self.assertEqual(introspectables[0]['factory'], DummyPredicate)\n    \n        config.action = _fakeAction\n>       config._add_predicate(\n            'route',\n            'testing',\n            'pyramid.tests.test_config.test_init.DummyPredicate'\n            )\n\nr2e_tests/test_1.py:1375: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \npyramid/config/__init__.py:540: in _add_predicate\n    self.action(discriminator, register, introspectables=(intr,),\nr2e_tests/test_1.py:1372: in _fakeAction\n    self.assertEqual(introspectables[0]['factory'], DummyPredicate)\nE   AssertionError: <class 'pyramid.tests.test_config.test_init.DummyPredicate'> != <class 'r2e_tests.test_1.DummyPredicate'>\n__ AdaptersConfiguratorMixinTests.test_add_resource_url_adapter_dotted_names ___\n\nself = <r2e_tests.test_config.test_adapters.AdaptersConfiguratorMixinTests testMethod=test_add_resource_url_adapter_dotted_names>\n\n    def test_add_resource_url_adapter_dotted_names(self):\n        from pyramid.interfaces import IResourceURL\n        config = self._makeOne(autocommit=True)\n        config.add_resource_url_adapter(\n            'pyramid.tests.test_config.test_adapters.DummyResourceURL',\n            'pyramid.tests.test_config.test_adapters.DummyIface',\n            )\n        iface = DummyIface()\n>       adapter = config.registry.getMultiAdapter((iface, iface),\n                                                    IResourceURL)\n\nr2e_tests/test_config/test_adapters.py:280: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <Registry r2e_tests.test_config>\nobjects = (<r2e_tests.test_config.test_adapters.DummyIface object at 0x7cfdc23ea580>, <r2e_tests.test_config.test_adapters.DummyIface object at 0x7cfdc23ea580>)\ninterface = <InterfaceClass pyramid.interfaces.IResourceURL>, name = ''\n\n    def getMultiAdapter(self, objects, interface, name=''):\n        adapter = self.adapters.queryMultiAdapter(objects, interface, name)\n        if adapter is None:\n>           raise ComponentLookupError(objects, interface, name)\nE           zope.interface.interfaces.ComponentLookupError: ((<r2e_tests.test_config.test_adapters.DummyIface object at 0x7cfdc23ea580>, <r2e_tests.test_config.test_adapters.DummyIface object at 0x7cfdc23ea580>), <InterfaceClass pyramid.interfaces.IResourceURL>, '')\n\n.venv/lib/python3.8/site-packages/zope/interface/registry.py:379: ComponentLookupError\n_ AdaptersConfiguratorMixinTests.test_add_resource_url_adapter_introspectables _\n\nself = <r2e_tests.test_config.test_adapters.AdaptersConfiguratorMixinTests testMethod=test_add_resource_url_adapter_introspectables>\n\n    def test_add_resource_url_adapter_introspectables(self):\n        config = self._makeOne()\n        config.add_resource_url_adapter(DummyResourceURL, DummyIface)\n        actions = config.action_state.actions\n        self.assertEqual(len(actions), 1)\n        intrs  = actions[0]['introspectables']\n        self.assertEqual(len(intrs), 1)\n        intr = intrs[0]\n        self.assertEqual(intr.type_name, 'resource url adapter')\n        self.assertEqual(intr.discriminator,\n                         ('resource url adapter', DummyIface))\n        self.assertEqual(intr.category_name, 'resource url adapters')\n>       self.assertEqual(\n            intr.title,\n            \"resource url adapter for resource iface \"\n            \"<class 'pyramid.tests.test_config.test_adapters.DummyIface'>\"\n            )\nE       AssertionError: \"reso[34 chars]e <class 'r2e_tests.test_config.test_adapters.DummyIface'>\" != \"reso[34 chars]e <class 'pyramid.tests.test_config.test_adapters.DummyIface'>\"\nE       - resource url adapter for resource iface <class 'r2e_tests.test_config.test_adapters.DummyIface'>\nE       ?                                                  ^^^\nE       + resource url adapter for resource iface <class 'pyramid.tests.test_config.test_adapters.DummyIface'>\nE       ?                                                 ++ ^^^^^\n\nr2e_tests/test_config/test_adapters.py:326: AssertionError\n________ AdaptersConfiguratorMixinTests.test_add_traverser_dotted_names ________\n\nself = <r2e_tests.test_config.test_adapters.AdaptersConfiguratorMixinTests testMethod=test_add_traverser_dotted_names>\n\n    def test_add_traverser_dotted_names(self):\n        from pyramid.interfaces import ITraverser\n        config = self._makeOne(autocommit=True)\n        config.add_traverser(\n            'pyramid.tests.test_config.test_adapters.DummyTraverser',\n            'pyramid.tests.test_config.test_adapters.DummyIface')\n        iface = DummyIface()\n>       traverser = config.registry.getAdapter(iface, ITraverser)\n\nr2e_tests/test_config/test_adapters.py:237: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <Registry r2e_tests.test_config>\nobject = <r2e_tests.test_config.test_adapters.DummyIface object at 0x7cfdc24b1190>\ninterface = <InterfaceClass pyramid.interfaces.ITraverser>, name = ''\n\n    def getAdapter(self, object, interface, name=''):\n        adapter = self.adapters.queryAdapter(object, interface, name)\n        if adapter is None:\n>           raise ComponentLookupError(object, interface, name)\nE           zope.interface.interfaces.ComponentLookupError: (<r2e_tests.test_config.test_adapters.DummyIface object at 0x7cfdc24b1190>, <InterfaceClass pyramid.interfaces.ITraverser>, '')\n\n.venv/lib/python3.8/site-packages/zope/interface/registry.py:368: ComponentLookupError\n___ TestAssetsConfiguratorMixin.test_override_asset_directory_with_directory ___\n\nself = <r2e_tests.test_config.test_assets.TestAssetsConfiguratorMixin testMethod=test_override_asset_directory_with_directory>\n\n    def test_override_asset_directory_with_directory(self):\n        from pyramid.config.assets import PackageAssetSource\n        config = self._makeOne(autocommit=True)\n        override = DummyUnderOverride()\n        config.override_asset(\n            'pyramid.tests.test_config.pkgs.asset:templates/',\n            'pyramid.tests.test_config.pkgs.asset.subpackage:templates/',\n            _override=override)\n        from pyramid.tests.test_config.pkgs import asset\n        from pyramid.tests.test_config.pkgs.asset import subpackage\n        self.assertEqual(override.package, asset)\n        self.assertEqual(override.path, 'templates/')\n        source = override.source\n        self.assertTrue(isinstance(source, PackageAssetSource))\n        self.assertEqual(source.package, subpackage)\n        self.assertEqual(source.prefix, 'templates/')\n    \n        resource_name = 'bar.pt'\n        expected = os.path.join(here, 'pkgs', 'asset',\n                                'subpackage', 'templates', 'bar.pt')\n>       self.assertEqual(override.source.get_filename(resource_name),\n                         expected)\nE       AssertionError: '/hom[90 chars]f3ab/pyramid/tests/test_config/pkgs/asset/subp[19 chars]r.pt' != '/hom[90 chars]f3ab/r2e_tests/test_config/pkgs/asset/subpacka[15 chars]r.pt'\nE       - /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/pkgs/asset/subpackage/templates/bar.pt\nE       ?                                                                                                    -- ^^^^^\nE       + /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/test_config/pkgs/asset/subpackage/templates/bar.pt\nE       ?                                                                                                     ^^^\n\nr2e_tests/test_config/test_assets.py:106: AssertionError\n____ TestAssetsConfiguratorMixin.test_override_asset_directory_with_package ____\n\nself = <r2e_tests.test_config.test_assets.TestAssetsConfiguratorMixin testMethod=test_override_asset_directory_with_package>\n\n    def test_override_asset_directory_with_package(self):\n        from pyramid.config.assets import PackageAssetSource\n        config = self._makeOne(autocommit=True)\n        override = DummyUnderOverride()\n        config.override_asset(\n            'pyramid.tests.test_config.pkgs.asset:templates/',\n            'pyramid.tests.test_config.pkgs.asset.subpackage',\n            _override=override)\n        from pyramid.tests.test_config.pkgs import asset\n        from pyramid.tests.test_config.pkgs.asset import subpackage\n        self.assertEqual(override.package, asset)\n        self.assertEqual(override.path, 'templates/')\n        source = override.source\n        self.assertTrue(isinstance(source, PackageAssetSource))\n        self.assertEqual(source.package, subpackage)\n        self.assertEqual(source.prefix, '')\n    \n        resource_name = 'templates/bar.pt'\n        expected = os.path.join(here, 'pkgs', 'asset',\n                                'subpackage', 'templates', 'bar.pt')\n>       self.assertEqual(override.source.get_filename(resource_name),\n                         expected)\nE       AssertionError: '/hom[90 chars]f3ab/pyramid/tests/test_config/pkgs/asset/subp[19 chars]r.pt' != '/hom[90 chars]f3ab/r2e_tests/test_config/pkgs/asset/subpacka[15 chars]r.pt'\nE       - /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/pkgs/asset/subpackage/templates/bar.pt\nE       ?                                                                                                    -- ^^^^^\nE       + /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/test_config/pkgs/asset/subpackage/templates/bar.pt\nE       ?                                                                                                     ^^^\n\nr2e_tests/test_config/test_assets.py:129: AssertionError\n________ TestAssetsConfiguratorMixin.test_override_asset_file_with_file ________\n\nself = <r2e_tests.test_config.test_assets.TestAssetsConfiguratorMixin testMethod=test_override_asset_file_with_file>\n\n    def test_override_asset_file_with_file(self):\n        from pyramid.config.assets import PackageAssetSource\n        config = self._makeOne(autocommit=True)\n        override = DummyUnderOverride()\n        config.override_asset(\n            'pyramid.tests.test_config.pkgs.asset:templates/foo.pt',\n            'pyramid.tests.test_config.pkgs.asset.subpackage:templates/bar.pt',\n            _override=override)\n        from pyramid.tests.test_config.pkgs import asset\n        from pyramid.tests.test_config.pkgs.asset import subpackage\n        self.assertEqual(override.package, asset)\n        self.assertEqual(override.path, 'templates/foo.pt')\n        source = override.source\n        self.assertTrue(isinstance(source, PackageAssetSource))\n        self.assertEqual(source.package, subpackage)\n        self.assertEqual(source.prefix, 'templates/bar.pt')\n    \n        resource_name = ''\n        expected = os.path.join(here, 'pkgs', 'asset',\n                                'subpackage', 'templates', 'bar.pt')\n>       self.assertEqual(override.source.get_filename(resource_name),\n                         expected)\nE       AssertionError: '/hom[90 chars]f3ab/pyramid/tests/test_config/pkgs/asset/subp[19 chars]r.pt' != '/hom[90 chars]f3ab/r2e_tests/test_config/pkgs/asset/subpacka[15 chars]r.pt'\nE       - /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/pkgs/asset/subpackage/templates/bar.pt\nE       ?                                                                                                    -- ^^^^^\nE       + /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/test_config/pkgs/asset/subpackage/templates/bar.pt\nE       ?                                                                                                     ^^^\n\nr2e_tests/test_config/test_assets.py:60: AssertionError\n____ TestAssetsConfiguratorMixin.test_override_asset_package_with_directory ____\n\nself = <r2e_tests.test_config.test_assets.TestAssetsConfiguratorMixin testMethod=test_override_asset_package_with_directory>\n\n    def test_override_asset_package_with_directory(self):\n        from pyramid.config.assets import PackageAssetSource\n        config = self._makeOne(autocommit=True)\n        override = DummyUnderOverride()\n        config.override_asset(\n            'pyramid.tests.test_config.pkgs.asset',\n            'pyramid.tests.test_config.pkgs.asset.subpackage:templates/',\n            _override=override)\n        from pyramid.tests.test_config.pkgs import asset\n        from pyramid.tests.test_config.pkgs.asset import subpackage\n        self.assertEqual(override.package, asset)\n        self.assertEqual(override.path, '')\n        source = override.source\n        self.assertTrue(isinstance(source, PackageAssetSource))\n        self.assertEqual(source.package, subpackage)\n        self.assertEqual(source.prefix, 'templates/')\n    \n        resource_name = 'bar.pt'\n        expected = os.path.join(here, 'pkgs', 'asset',\n                                'subpackage', 'templates', 'bar.pt')\n>       self.assertEqual(override.source.get_filename(resource_name),\n                         expected)\nE       AssertionError: '/hom[90 chars]f3ab/pyramid/tests/test_config/pkgs/asset/subp[19 chars]r.pt' != '/hom[90 chars]f3ab/r2e_tests/test_config/pkgs/asset/subpacka[15 chars]r.pt'\nE       - /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/pkgs/asset/subpackage/templates/bar.pt\nE       ?                                                                                                    -- ^^^^^\nE       + /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/test_config/pkgs/asset/subpackage/templates/bar.pt\nE       ?                                                                                                     ^^^\n\nr2e_tests/test_config/test_assets.py:152: AssertionError\n_____ TestAssetsConfiguratorMixin.test_override_asset_package_with_package _____\n\nself = <r2e_tests.test_config.test_assets.TestAssetsConfiguratorMixin testMethod=test_override_asset_package_with_package>\n\n    def test_override_asset_package_with_package(self):\n        from pyramid.config.assets import PackageAssetSource\n        config = self._makeOne(autocommit=True)\n        override = DummyUnderOverride()\n        config.override_asset(\n            'pyramid.tests.test_config.pkgs.asset',\n            'pyramid.tests.test_config.pkgs.asset.subpackage',\n            _override=override)\n        from pyramid.tests.test_config.pkgs import asset\n        from pyramid.tests.test_config.pkgs.asset import subpackage\n        self.assertEqual(override.package, asset)\n        self.assertEqual(override.path, '')\n        source = override.source\n        self.assertTrue(isinstance(source, PackageAssetSource))\n        self.assertEqual(source.package, subpackage)\n        self.assertEqual(source.prefix, '')\n    \n        resource_name = 'templates/bar.pt'\n        expected = os.path.join(here, 'pkgs', 'asset',\n                                'subpackage', 'templates', 'bar.pt')\n>       self.assertEqual(override.source.get_filename(resource_name),\n                         expected)\nE       AssertionError: '/hom[90 chars]f3ab/pyramid/tests/test_config/pkgs/asset/subp[19 chars]r.pt' != '/hom[90 chars]f3ab/r2e_tests/test_config/pkgs/asset/subpacka[15 chars]r.pt'\nE       - /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/pkgs/asset/subpackage/templates/bar.pt\nE       ?                                                                                                    -- ^^^^^\nE       + /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/test_config/pkgs/asset/subpackage/templates/bar.pt\nE       ?                                                                                                     ^^^\n\nr2e_tests/test_config/test_assets.py:83: AssertionError\n_________ TestOverrideProvider.test_get_resource_filename_no_overrides _________\n\nself = <r2e_tests.test_config.test_assets.TestOverrideProvider testMethod=test_get_resource_filename_no_overrides>\n\n    def test_get_resource_filename_no_overrides(self):\n        resource_name = 'test_assets.py'\n        import pyramid.tests.test_config\n        provider = self._makeOne(pyramid.tests.test_config)\n        expected = os.path.join(here, resource_name)\n        result = provider.get_resource_filename(None, resource_name)\n>       self.assertEqual(result, expected)\nE       AssertionError: '/hom[73 chars]76c6d03e3d314979af3ab/pyramid/tests/test_config/test_assets.py' != '/hom[73 chars]76c6d03e3d314979af3ab/r2e_tests/test_config/test_assets.py'\nE       - /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/test_assets.py\nE       ?                                                                                                    -- ^^^^^\nE       + /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/test_config/test_assets.py\nE       ?                                                                                                     ^^^\n\nr2e_tests/test_config/test_assets.py:297: AssertionError\n____ TestOverrideProvider.test_get_resource_filename_override_returns_None _____\n\nself = <r2e_tests.test_config.test_assets.TestOverrideProvider testMethod=test_get_resource_filename_override_returns_None>\n\n    def test_get_resource_filename_override_returns_None(self):\n        overrides = DummyOverrides(None)\n        self._registerOverrides(overrides)\n        resource_name = 'test_assets.py'\n        import pyramid.tests.test_config\n        provider = self._makeOne(pyramid.tests.test_config)\n        expected = os.path.join(here, resource_name)\n        result = provider.get_resource_filename(None, resource_name)\n>       self.assertEqual(result, expected)\nE       AssertionError: '/hom[73 chars]76c6d03e3d314979af3ab/pyramid/tests/test_config/test_assets.py' != '/hom[73 chars]76c6d03e3d314979af3ab/r2e_tests/test_config/test_assets.py'\nE       - /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/test_assets.py\nE       ?                                                                                                    -- ^^^^^\nE       + /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/test_config/test_assets.py\nE       ?                                                                                                     ^^^\n\nr2e_tests/test_config/test_assets.py:345: AssertionError\n___________________ TestPackageAssetSource.test_get_filename ___________________\n\nself = <r2e_tests.test_config.test_assets.TestPackageAssetSource testMethod=test_get_filename>\n\n    def test_get_filename(self):\n        source = self._makeOne('')\n>       self.assertEqual(source.get_filename('test_assets.py'),\n                         os.path.join(here, 'test_assets.py'))\nE       AssertionError: '/hom[73 chars]76c6d03e3d314979af3ab/pyramid/tests/test_config/test_assets.py' != '/hom[73 chars]76c6d03e3d314979af3ab/r2e_tests/test_config/test_assets.py'\nE       - /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/test_assets.py\nE       ?                                                                                                    -- ^^^^^\nE       + /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/test_config/test_assets.py\nE       ?                                                                                                     ^^^\n\nr2e_tests/test_config/test_assets.py:716: AssertionError\n_____________ TestPackageAssetSource.test_get_filename_with_prefix _____________\n\nself = <r2e_tests.test_config.test_assets.TestPackageAssetSource testMethod=test_get_filename_with_prefix>\n\n    def test_get_filename_with_prefix(self):\n        source = self._makeOne('test_assets.py')\n>       self.assertEqual(source.get_filename(''),\n                         os.path.join(here, 'test_assets.py'))\nE       AssertionError: '/hom[73 chars]76c6d03e3d314979af3ab/pyramid/tests/test_config/test_assets.py' != '/hom[73 chars]76c6d03e3d314979af3ab/r2e_tests/test_config/test_assets.py'\nE       - /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/test_assets.py\nE       ?                                                                                                    -- ^^^^^\nE       + /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/test_config/test_assets.py\nE       ?                                                                                                     ^^^\n\nr2e_tests/test_config/test_assets.py:721: AssertionError\n_________ TestI18NConfiguratorMixin.test_add_translation_dirs_abspath __________\n\nself = <r2e_tests.test_config.test_i18n.TestI18NConfiguratorMixin testMethod=test_add_translation_dirs_abspath>\n\n    def test_add_translation_dirs_abspath(self):\n        from pyramid.interfaces import ITranslationDirectories\n        config = self._makeOne(autocommit=True)\n>       config.add_translation_dirs(locale)\n\nr2e_tests/test_config/test_i18n.py:102: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \npyramid/util.py:588: in wrapper\n    result = wrapped(self, *arg, **kw)\npyramid/config/i18n.py:118: in add_translation_dirs\n    self.action(None, register, introspectables=introspectables)\npyramid/config/__init__.py:610: in action\n    callable(*args, **kw)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\n    def register():\n        directories = []\n        resolver = AssetResolver(self.package_name)\n    \n        # defer spec resolution until register to allow for asset\n        # overrides to take place in an earlier config phase\n        for spec in specs:\n            # the trailing slash helps match asset overrides for folders\n            if not spec.endswith('/'):\n                spec += '/'\n            asset = resolver.resolve(spec)\n            directory = asset.abspath()\n            if not asset.isdir():\n>               raise ConfigurationError('\"%s\" is not a directory' %\n                                        directory)\nE               pyramid.exceptions.ConfigurationError: \"/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale\" is not a directory\n\npyramid/config/i18n.py:99: ConfigurationError\n________ TestI18NConfiguratorMixin.test_add_translation_dirs_asset_spec ________\n\nself = <r2e_tests.test_config.test_i18n.TestI18NConfiguratorMixin testMethod=test_add_translation_dirs_asset_spec>\n\n    def test_add_translation_dirs_asset_spec(self):\n        from pyramid.interfaces import ITranslationDirectories\n        config = self._makeOne(autocommit=True)\n        config.add_translation_dirs('pyramid.tests.pkgs.localeapp:locale')\n>       self.assertEqual(config.registry.getUtility(ITranslationDirectories),\n                         [locale])\nE       AssertionError: Lists differ: ['/ho[70 chars]86c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale'] != ['/ho[70 chars]86c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale']\nE       \nE       First differing element 0:\nE       '/hom[68 chars]586c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale'\nE       '/hom[68 chars]586c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale'\nE       \nE       - ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale']\nE       ?                                                                                                      -- ^^^^^\nE       \nE       + ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale']\nE       ?                                                                                                       ^^^\n\nr2e_tests/test_config/test_i18n.py:53: AssertionError\n_ TestI18NConfiguratorMixin.test_add_translation_dirs_asset_spec_existing_translation_dirs _\n\nself = <r2e_tests.test_config.test_i18n.TestI18NConfiguratorMixin testMethod=test_add_translation_dirs_asset_spec_existing_translation_dirs>\n\n    def test_add_translation_dirs_asset_spec_existing_translation_dirs(self):\n        from pyramid.interfaces import ITranslationDirectories\n        config = self._makeOne(autocommit=True)\n        directories = ['abc']\n        config.registry.registerUtility(directories, ITranslationDirectories)\n        config.add_translation_dirs('pyramid.tests.pkgs.localeapp:locale')\n        result = config.registry.getUtility(ITranslationDirectories)\n>       self.assertEqual(result, [locale, 'abc'])\nE       AssertionError: Lists differ: ['/ho[77 chars]6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale', 'abc'] != ['/ho[77 chars]6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale', 'abc']\nE       \nE       First differing element 0:\nE       '/hom[68 chars]586c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale'\nE       '/hom[68 chars]586c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale'\nE       \nE       - ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale',\nE       ?                                                                                                      -- ^^^^^\nE       \nE       + ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale',\nE       ?                                                                                                       ^^^\nE       \nE          'abc']\n\nr2e_tests/test_config/test_i18n.py:63: AssertionError\n_ TestI18NConfiguratorMixin.test_add_translation_dirs_doesnt_use_override_w_autocommit _\n\nself = <r2e_tests.test_config.test_i18n.TestI18NConfiguratorMixin testMethod=test_add_translation_dirs_doesnt_use_override_w_autocommit>\n\n    def test_add_translation_dirs_doesnt_use_override_w_autocommit(self):\n        from pyramid.interfaces import ITranslationDirectories\n        config = self._makeOne(autocommit=True)\n        config.add_translation_dirs('pyramid.tests.pkgs.localeapp:locale')\n        config.override_asset('pyramid.tests.pkgs.localeapp:locale/',\n                              'pyramid.tests.pkgs.localeapp:locale2/')\n>       self.assertEqual(config.registry.getUtility(ITranslationDirectories),\n                         [locale])\nE       AssertionError: Lists differ: ['/ho[70 chars]86c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale'] != ['/ho[70 chars]86c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale']\nE       \nE       First differing element 0:\nE       '/hom[68 chars]586c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale'\nE       '/hom[68 chars]586c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale'\nE       \nE       - ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale']\nE       ?                                                                                                      -- ^^^^^\nE       \nE       + ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale']\nE       ?                                                                                                       ^^^\n\nr2e_tests/test_config/test_i18n.py:122: AssertionError\n______ TestI18NConfiguratorMixin.test_add_translation_dirs_multiple_specs ______\n\nself = <r2e_tests.test_config.test_i18n.TestI18NConfiguratorMixin testMethod=test_add_translation_dirs_multiple_specs>\n\n    def test_add_translation_dirs_multiple_specs(self):\n        from pyramid.interfaces import ITranslationDirectories\n        config = self._makeOne(autocommit=True)\n        config.add_translation_dirs('pyramid.tests.pkgs.localeapp:locale',\n                                    'pyramid.tests.pkgs.localeapp:locale2')\n>       self.assertEqual(config.registry.getUtility(ITranslationDirectories),\n                         [locale, locale2])\nE       AssertionError: Lists differ: ['/ho[91 chars]f3ab/pyramid/tests/pkgs/localeapp/locale', '/h[130 chars]le2'] != ['/ho[91 chars]f3ab/r2e_tests/pkgs/localeapp/locale', '/home/[122 chars]le2']\nE       \nE       First differing element 0:\nE       '/hom[68 chars]586c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale'\nE       '/hom[68 chars]586c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale'\nE       \nE       Diff is 1002 characters long. Set self.maxDiff to None to see it.\n\nr2e_tests/test_config/test_i18n.py:70: AssertionError\n_ TestI18NConfiguratorMixin.test_add_translation_dirs_multiple_specs_multiple_calls _\n\nself = <r2e_tests.test_config.test_i18n.TestI18NConfiguratorMixin testMethod=test_add_translation_dirs_multiple_specs_multiple_calls>\n\n    def test_add_translation_dirs_multiple_specs_multiple_calls(self):\n        from pyramid.interfaces import ITranslationDirectories\n        config = self._makeOne(autocommit=True)\n        config.add_translation_dirs('pyramid.tests.pkgs.localeapp:locale',\n                                    'pyramid.tests.pkgs.localeapp:locale2')\n        config.add_translation_dirs('pyramid.tests.pkgs.localeapp:locale3')\n>       self.assertEqual(config.registry.getUtility(ITranslationDirectories),\n                         [locale3, locale, locale2])\nE       AssertionError: Lists differ: ['/ho[91 chars]f3ab/pyramid/tests/pkgs/localeapp/locale3', '/[269 chars]le2'] != ['/ho[91 chars]f3ab/r2e_tests/pkgs/localeapp/locale3', '/home[257 chars]le2']\nE       \nE       First differing element 0:\nE       '/hom[69 chars]86c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale3'\nE       '/hom[69 chars]86c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale3'\nE       \nE       Diff is 1504 characters long. Set self.maxDiff to None to see it.\n\nr2e_tests/test_config/test_i18n.py:79: AssertionError\n_ TestI18NConfiguratorMixin.test_add_translation_dirs_override_multiple_specs_multiple_calls _\n\nself = <r2e_tests.test_config.test_i18n.TestI18NConfiguratorMixin testMethod=test_add_translation_dirs_override_multiple_specs_multiple_calls>\n\n    def test_add_translation_dirs_override_multiple_specs_multiple_calls(self):\n        from pyramid.interfaces import ITranslationDirectories\n        config = self._makeOne(autocommit=True)\n        config.add_translation_dirs('pyramid.tests.pkgs.localeapp:locale',\n                                    'pyramid.tests.pkgs.localeapp:locale2')\n        config.add_translation_dirs('pyramid.tests.pkgs.localeapp:locale3',\n                                    override=True)\n>       self.assertEqual(config.registry.getUtility(ITranslationDirectories),\n                         [locale, locale2, locale3])\nE       AssertionError: Lists differ: ['/ho[91 chars]f3ab/pyramid/tests/pkgs/localeapp/locale', '/h[269 chars]le3'] != ['/ho[91 chars]f3ab/r2e_tests/pkgs/localeapp/locale', '/home/[257 chars]le3']\nE       \nE       First differing element 0:\nE       '/hom[68 chars]586c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale'\nE       '/hom[68 chars]586c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale'\nE       \nE       Diff is 1504 characters long. Set self.maxDiff to None to see it.\n\nr2e_tests/test_config/test_i18n.py:89: AssertionError\n_ TestI18NConfiguratorMixin.test_add_translation_dirs_uses_override_out_of_order _\n\nself = <r2e_tests.test_config.test_i18n.TestI18NConfiguratorMixin testMethod=test_add_translation_dirs_uses_override_out_of_order>\n\n    def test_add_translation_dirs_uses_override_out_of_order(self):\n        from pyramid.interfaces import ITranslationDirectories\n        config = self._makeOne()\n        config.add_translation_dirs('pyramid.tests.pkgs.localeapp:locale')\n        config.override_asset('pyramid.tests.pkgs.localeapp:locale/',\n                              'pyramid.tests.pkgs.localeapp:locale2/')\n        config.commit()\n>       self.assertEqual(config.registry.getUtility(ITranslationDirectories),\n                         [locale2])\nE       AssertionError: Lists differ: ['/ho[71 chars]6c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale2'] != ['/ho[71 chars]6c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale2']\nE       \nE       First differing element 0:\nE       '/hom[69 chars]86c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale2'\nE       '/hom[69 chars]86c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale2'\nE       \nE       - ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale2']\nE       ?                                                                                                      -- ^^^^^\nE       \nE       + ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale2']\nE       ?                                                                                                       ^^^\n\nr2e_tests/test_config/test_i18n.py:113: AssertionError\n_ TestI18NConfiguratorMixin.test_add_translation_dirs_uses_override_w_autocommit _\n\nself = <r2e_tests.test_config.test_i18n.TestI18NConfiguratorMixin testMethod=test_add_translation_dirs_uses_override_w_autocommit>\n\n    def test_add_translation_dirs_uses_override_w_autocommit(self):\n        from pyramid.interfaces import ITranslationDirectories\n        config = self._makeOne(autocommit=True)\n        config.override_asset('pyramid.tests.pkgs.localeapp:locale/',\n                              'pyramid.tests.pkgs.localeapp:locale2/')\n        config.add_translation_dirs('pyramid.tests.pkgs.localeapp:locale')\n>       self.assertEqual(config.registry.getUtility(ITranslationDirectories),\n                         [locale2])\nE       AssertionError: Lists differ: ['/ho[71 chars]6c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale2'] != ['/ho[71 chars]6c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale2']\nE       \nE       First differing element 0:\nE       '/hom[69 chars]86c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale2'\nE       '/hom[69 chars]86c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale2'\nE       \nE       - ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/pkgs/localeapp/locale2']\nE       ?                                                                                                      -- ^^^^^\nE       \nE       + ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/pkgs/localeapp/locale2']\nE       ?                                                                                                       ^^^\n\nr2e_tests/test_config/test_i18n.py:131: AssertionError\n___________________ ConfiguratorTests.test_ctor_no_registry ____________________\n\nself = <r2e_tests.test_config.test_init.ConfiguratorTests testMethod=test_ctor_no_registry>\n\n    def test_ctor_no_registry(self):\n        import sys\n        from pyramid.interfaces import ISettings\n        from pyramid.config import Configurator\n        from pyramid.interfaces import IRendererFactory\n        config = Configurator()\n        this_pkg = sys.modules['pyramid.tests.test_config']\n        self.assertTrue(config.registry.getUtility(ISettings))\n>       self.assertEqual(config.package, this_pkg)\nE       AssertionError: <module 'r2e_tests.test_config' from '/home/gcpuse[117 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_config/test_init.py:68: AssertionError\n_________ ConfiguratorTests.test_ctor_noreg_debug_logger_None_default __________\n\nself = <r2e_tests.test_config.test_init.ConfiguratorTests testMethod=test_ctor_noreg_debug_logger_None_default>\n\n    def test_ctor_noreg_debug_logger_None_default(self):\n        from pyramid.interfaces import IDebugLogger\n        config = self._makeOne()\n        logger = config.registry.getUtility(IDebugLogger)\n>       self.assertEqual(logger.name, 'pyramid.tests.test_config')\nE       AssertionError: 'r2e_tests.test_config' != 'pyramid.tests.test_config'\nE       - r2e_tests.test_config\nE       ?  ^^^\nE       + pyramid.tests.test_config\nE       ? ++ ^^^^^\n\nr2e_tests/test_config/test_init.py:165: AssertionError\n_____________ ConfiguratorTests.test_include_constant_root_package _____________\n\nself = <r2e_tests.test_config.test_init.ConfiguratorTests testMethod=test_include_constant_root_package>\n\n    def test_include_constant_root_package(self):\n        from pyramid import tests\n        from pyramid.tests import test_config\n        config = self._makeOne(root_package=tests)\n        results = {}\n        def include(config):\n            results['package'] = config.package\n            results['root_package'] = config.root_package\n        config.include(include)\n        self.assertEqual(results['root_package'], tests)\n>       self.assertEqual(results['package'], test_config)\nE       AssertionError: <module 'r2e_tests.test_config' from '/home/gcpuse[117 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_config/test_init.py:818: AssertionError\n______________ ConfiguratorTests.test_include_threadlocals_active ______________\n\nself = <r2e_tests.test_config.test_init.ConfiguratorTests testMethod=test_include_threadlocals_active>\n\n    def test_include_threadlocals_active(self):\n        from pyramid.tests import test_config\n        from pyramid.threadlocal import get_current_registry\n        stack = []\n        def include(config):\n            stack.append(get_current_registry())\n        config = self._makeOne()\n        config.include(include)\n>       self.assertTrue(stack[0] is config.registry)\nE       AssertionError: False is not true\n\nr2e_tests/test_config/test_init.py:828: AssertionError\n_______________ ConfiguratorTests.test_scan_integration_conflict _______________\n\nself = <r2e_tests.test_config.test_init.ConfiguratorTests testMethod=test_scan_integration_conflict>\n\n    def test_scan_integration_conflict(self):\n        from pyramid.tests.test_config.pkgs import selfscan\n        from pyramid.config import Configurator\n        c = Configurator()\n        c.scan(selfscan)\n        c.scan(selfscan)\n        try:\n>           c.commit()\n\nr2e_tests/test_config/test_init.py:1090: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \npyramid/config/__init__.py:657: in commit\n    self.action_state.execute_actions(introspector=self.introspector)\npyramid/config/__init__.py:1151: in execute_actions\n    action = next(action_iter, None)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nactions = [{'args': (), 'callable': <function ViewsConfiguratorMixin.add_view.<locals>.register at 0x7cfdc2548040>, 'discriminat...fdc2548940>, 'discriminator': ('view', None, 'two', None, 'd41d8cd98f00b204e9800998ecf8427e'), 'includepath': (), ...}]\nstate = <pyramid.config.ConflictResolverState object at 0x7cfdc24b33a0>\n\n    def resolveConflicts(actions, state=None):\n        \"\"\"Resolve conflicting actions\n    \n        Given an actions list, identify and try to resolve conflicting actions.\n        Actions conflict if they have the same non-None discriminator.\n    \n        Conflicting actions can be resolved if the include path of one of\n        the actions is a prefix of the includepaths of the other\n        conflicting actions and is unequal to the include paths in the\n        other conflicting actions.\n    \n        Actions are resolved on a per-order basis because some discriminators\n        cannot be computed until earlier actions have executed. An action in an\n        earlier order may execute successfully only to find out later that it was\n        overridden by another action with a smaller include path. This will result\n        in a conflict as there is no way to revert the original action.\n    \n        ``state`` may be an instance of ``ConflictResolverState`` that\n        can be used to resume execution and resolve the new actions against the\n        list of executed actions from a previous call.\n    \n        \"\"\"\n        if state is None:\n            state = ConflictResolverState()\n    \n        # pick up where we left off last time, but track the new actions as well\n        state.remaining_actions.extend(normalize_actions(actions))\n        actions = state.remaining_actions\n    \n        def orderandpos(v):\n            n, v = v\n            return (v['order'] or 0, n)\n    \n        def orderonly(v):\n            n, v = v\n            return v['order'] or 0\n    \n        sactions = sorted(enumerate(actions, start=state.start), key=orderandpos)\n        for order, actiongroup in itertools.groupby(sactions, orderonly):\n            # \"order\" is an integer grouping. Actions in a lower order will be\n            # executed before actions in a higher order.  All of the actions in\n            # one grouping will be executed (its callable, if any will be called)\n            # before any of the actions in the next.\n            output = []\n            unique = {}\n    \n            # error out if we went backward in order\n            if state.min_order is not None and order < state.min_order:\n                r = ['Actions were added to order={0} after execution had moved '\n                     'on to order={1}. Conflicting actions: '\n                     .format(order, state.min_order)]\n                for i, action in actiongroup:\n                    for line in str(action['info']).rstrip().split('\\n'):\n                        r.append(\"  \" + line)\n                raise ConfigurationError('\\n'.join(r))\n    \n            for i, action in actiongroup:\n                # Within an order, actions are executed sequentially based on\n                # original action ordering (\"i\").\n    \n                # \"ainfo\" is a tuple of (i, action) where \"i\" is an integer\n                # expressing the relative position of this action in the action\n                # list being resolved, and \"action\" is an action dictionary.  The\n                # purpose of an ainfo is to associate an \"i\" with a particular\n                # action; \"i\" exists for sorting after conflict resolution.\n                ainfo = (i, action)\n    \n                # wait to defer discriminators until we are on their order because\n                # the discriminator may depend on state from a previous order\n                discriminator = undefer(action['discriminator'])\n                action['discriminator'] = discriminator\n    \n                if discriminator is None:\n                    # The discriminator is None, so this action can never conflict.\n                    # We can add it directly to the result.\n                    output.append(ainfo)\n                    continue\n    \n                L = unique.setdefault(discriminator, [])\n                L.append(ainfo)\n    \n            # Check for conflicts\n            conflicts = {}\n            for discriminator, ainfos in unique.items():\n                # We use (includepath, i) as a sort key because we need to\n                # sort the actions by the paths so that the shortest path with a\n                # given prefix comes first.  The \"first\" action is the one with the\n                # shortest include path.  We break sorting ties using \"i\".\n                def bypath(ainfo):\n                    path, i = ainfo[1]['includepath'], ainfo[0]\n                    return path, order, i\n    \n                ainfos.sort(key=bypath)\n                ainfo, rest = ainfos[0], ainfos[1:]\n                _, action = ainfo\n    \n                # ensure this new action does not conflict with a previously\n                # resolved action from an earlier order / invocation\n                prev_ainfo = state.resolved_ainfos.get(discriminator)\n                if prev_ainfo is not None:\n                    _, paction = prev_ainfo\n                    basepath, baseinfo = paction['includepath'], paction['info']\n                    includepath = action['includepath']\n                    # if the new action conflicts with the resolved action then\n                    # note the conflict, otherwise drop the action as it's\n                    # effectively overriden by the previous action\n                    if (includepath[:len(basepath)] != basepath or\n                            includepath == basepath):\n                        L = conflicts.setdefault(discriminator, [baseinfo])\n                        L.append(action['info'])\n    \n                else:\n                    output.append(ainfo)\n    \n                basepath, baseinfo = action['includepath'], action['info']\n                for _, action in rest:\n                    includepath = action['includepath']\n                    # Test whether path is a prefix of opath\n                    if (includepath[:len(basepath)] != basepath or  # not a prefix\n                            includepath == basepath):\n                        L = conflicts.setdefault(discriminator, [baseinfo])\n                        L.append(action['info'])\n    \n            if conflicts:\n>               raise ConfigurationConflictError(conflicts)\nE               pyramid.exceptions.ConfigurationConflictError: Conflicting configuration actions\nE                 For: ('view', None, '', None, 'd41d8cd98f00b204e9800998ecf8427e')\nE                   Line 4 of file /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/pkgs/selfscan/__init__.py:\nE                       def abc(request):\nE                   Line 4 of file /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/pkgs/selfscan/__init__.py:\nE                       def abc(request):\nE                 For: ('view', None, 'two', None, 'd41d8cd98f00b204e9800998ecf8427e')\nE                   Line 4 of file /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/pkgs/selfscan/another.py:\nE                       def two(request):\nE                   Line 4 of file /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_config/pkgs/selfscan/another.py:\nE                       def two(request):\n\npyramid/config/__init__.py:1333: ConfigurationConflictError\n\nDuring handling of the above exception, another exception occurred:\n\nself = <r2e_tests.test_config.test_init.ConfiguratorTests testMethod=test_scan_integration_conflict>\n\n    def test_scan_integration_conflict(self):\n        from pyramid.tests.test_config.pkgs import selfscan\n        from pyramid.config import Configurator\n        c = Configurator()\n        c.scan(selfscan)\n        c.scan(selfscan)\n        try:\n            c.commit()\n        except ConfigurationConflictError as why:\n            def scanconflicts(e):\n                conflicts = e._conflicts.values()\n                for conflict in conflicts:\n                    for confinst in conflict:\n                        yield confinst.src\n            which = list(scanconflicts(why))\n            self.assertEqual(len(which), 4)\n>           self.assertTrue(\"@view_config(renderer='string')\" in which)\nE           AssertionError: False is not true\n\nr2e_tests/test_config/test_init.py:1099: AssertionError\n_______ ConfiguratorTests.test_setup_registry_debug_logger_None_default ________\n\nself = <r2e_tests.test_config.test_init.ConfiguratorTests testMethod=test_setup_registry_debug_logger_None_default>\n\n    def test_setup_registry_debug_logger_None_default(self):\n        from pyramid.registry import Registry\n        from pyramid.interfaces import IDebugLogger\n        reg = Registry()\n        config = self._makeOne(reg)\n        config.setup_registry()\n        logger = reg.getUtility(IDebugLogger)\n>       self.assertEqual(logger.name, 'pyramid.tests.test_config')\nE       AssertionError: 'r2e_tests.test_config' != 'pyramid.tests.test_config'\nE       - r2e_tests.test_config\nE       ?  ^^^\nE       + pyramid.tests.test_config\nE       ? ++ ^^^^^\n\nr2e_tests/test_config/test_init.py:485: AssertionError\n____ TestConfigurator_add_directive.test_add_directive_with_custom_callable ____\n\nself = <r2e_tests.test_config.test_init.TestConfigurator_add_directive testMethod=test_add_directive_with_custom_callable>\n\n    def test_add_directive_with_custom_callable(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n                'dummy_callable', 'pyramid.tests.test_config.dummy_callable')\n        self.assertTrue(hasattr(config, 'dummy_callable'))\n        config.dummy_callable('discrim')\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n>       self.assertEqual(action['args'], test_config)\nE       AssertionError: <module 'r2e_tests.test_config' from '/home/gcpuse[117 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_config/test_init.py:1298: AssertionError\n________ TestConfigurator_add_directive.test_add_directive_with_partial ________\n\nself = <r2e_tests.test_config.test_init.TestConfigurator_add_directive testMethod=test_add_directive_with_partial>\n\n    def test_add_directive_with_partial(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n                'dummy_partial', 'pyramid.tests.test_config.dummy_partial')\n        self.assertTrue(hasattr(config, 'dummy_partial'))\n        config.dummy_partial()\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'partial')\n        self.assertEqual(action['callable'], None)\n>       self.assertEqual(action['args'], test_config)\nE       AssertionError: <module 'r2e_tests.test_config' from '/home/gcpuse[117 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_config/test_init.py:1285: AssertionError\n_________ TestConfigurator_add_directive.test_extend_with_dotted_name __________\n\nself = <r2e_tests.test_config.test_init.TestConfigurator_add_directive testMethod=test_extend_with_dotted_name>\n\n    def test_extend_with_dotted_name(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n            'dummy_extend', 'pyramid.tests.test_config.dummy_extend')\n        self.assertTrue(hasattr(config, 'dummy_extend'))\n        config.dummy_extend('discrim')\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n>       self.assertEqual(action['args'], test_config)\nE       AssertionError: <module 'r2e_tests.test_config' from '/home/gcpuse[117 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_config/test_init.py:1272: AssertionError\n_______ TestConfigurator_add_directive.test_extend_with_python_callable ________\n\nself = <r2e_tests.test_config.test_init.TestConfigurator_add_directive testMethod=test_extend_with_python_callable>\n\n    def test_extend_with_python_callable(self):\n        from pyramid.tests import test_config\n        config = self.config\n        config.add_directive(\n            'dummy_extend', dummy_extend)\n        self.assertTrue(hasattr(config, 'dummy_extend'))\n        config.dummy_extend('discrim')\n        after = config.action_state\n        action = after.actions[-1]\n        self.assertEqual(action['discriminator'], 'discrim')\n        self.assertEqual(action['callable'], None)\n>       self.assertEqual(action['args'], test_config)\nE       AssertionError: <module 'r2e_tests.test_config' from '/home/gcpuse[117 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_config/test_init.py:1311: AssertionError\n_________ TestConfigurator__add_predicate.test_factory_as_dotted_name __________\n\nself = <r2e_tests.test_config.test_init.TestConfigurator__add_predicate testMethod=test_factory_as_dotted_name>\n\n    def test_factory_as_dotted_name(self):\n        config = self._makeOne()\n    \n        def _fakeAction(discriminator, callable=None, args=(),\n                        kw=None, order=0, introspectables=(), **extra):\n            self.assertEqual(len(introspectables), 1)\n            self.assertEqual(introspectables[0]['name'], 'testing')\n            self.assertEqual(introspectables[0]['factory'], DummyPredicate)\n    \n        config.action = _fakeAction\n>       config._add_predicate(\n            'route',\n            'testing',\n            'pyramid.tests.test_config.test_init.DummyPredicate'\n            )\n\nr2e_tests/test_config/test_init.py:1375: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \npyramid/config/__init__.py:540: in _add_predicate\n    self.action(discriminator, register, introspectables=(intr,),\nr2e_tests/test_config/test_init.py:1372: in _fakeAction\n    self.assertEqual(introspectables[0]['factory'], DummyPredicate)\nE   AssertionError: <class 'pyramid.tests.test_config.test_init.DummyPredicate'> != <class 'r2e_tests.test_config.test_init.DummyPredicate'>\n____ TestViewsConfigurationMixin.test_add_static_view_package_here_relative ____\n\nself = <r2e_tests.test_config.test_views.TestViewsConfigurationMixin testMethod=test_add_static_view_package_here_relative>\n\n    def test_add_static_view_package_here_relative(self):\n        from pyramid.interfaces import IStaticURLInfo\n        info = DummyStaticURLInfo()\n        config = self._makeOne(autocommit=True)\n        config.registry.registerUtility(info, IStaticURLInfo)\n        config.add_static_view('static', 'files')\n>       self.assertEqual(\n            info.added,\n            [(config, 'static', 'pyramid.tests.test_config:files', {})])\nE       AssertionError: Lists differ: [(<py[39 chars]cfdc2333e20>, 'static', 'r2e_tests.test_config:files', {})] != [(<py[39 chars]cfdc2333e20>, 'static', 'pyramid.tests.test_config:files', {})]\nE       \nE       First differing element 0:\nE       (<pyr[37 chars]7cfdc2333e20>, 'static', 'r2e_tests.test_config:files', {})\nE       (<pyr[37 chars]7cfdc2333e20>, 'static', 'pyramid.tests.test_config:files', {})\nE       \nE         [(<pyramid.config.Configurator object at 0x7cfdc2333e20>,\nE           'static',\nE       -   'r2e_tests.test_config:files',\nE       ?     ^^^\nE       \nE       +   'pyramid.tests.test_config:files',\nE       ?    ++ ^^^^^\nE       \nE           {})]\n\nr2e_tests/test_config/test_views.py:2065: AssertionError\n_______ TestViewsConfigurationMixin.test_add_view_with_template_renderer _______\n\nself = <r2e_tests.test_config.test_views.TestViewsConfigurationMixin testMethod=test_add_view_with_template_renderer>\n\n    def test_add_view_with_template_renderer(self):\n        from pyramid.tests import test_config\n        from pyramid.interfaces import ISettings\n        class view(object):\n            def __init__(self, context, request):\n                self.request = request\n                self.context = context\n    \n            def __call__(self):\n                return {'a':'1'}\n        config = self._makeOne(autocommit=True)\n        renderer = self._registerRenderer(config)\n        fixture = 'pyramid.tests.test_config:files/minimal.txt'\n        config.introspection = False\n        config.add_view(view=view, renderer=fixture)\n        wrapper = self._getViewCallable(config)\n        request = self._makeRequest(config)\n        result = wrapper(None, request)\n        self.assertEqual(result.body, b'Hello!')\n        settings = config.registry.queryUtility(ISettings)\n        result = renderer.info\n        self.assertEqual(result.registry, config.registry)\n        self.assertEqual(result.type, '.txt')\n>       self.assertEqual(result.package, test_config)\nE       AssertionError: <module 'r2e_tests.test_config' from '/home/gcpuse[117 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_config/test_views.py:1186: AssertionError\n_ TestViewsConfigurationMixin.test_add_view_with_template_renderer_no_callable _\n\nself = <r2e_tests.test_config.test_views.TestViewsConfigurationMixin testMethod=test_add_view_with_template_renderer_no_callable>\n\n    def test_add_view_with_template_renderer_no_callable(self):\n        from pyramid.tests import test_config\n        from pyramid.interfaces import ISettings\n        config = self._makeOne(autocommit=True)\n        renderer = self._registerRenderer(config)\n        fixture = 'pyramid.tests.test_config:files/minimal.txt'\n        config.introspection = False\n        config.add_view(view=None, renderer=fixture)\n        wrapper = self._getViewCallable(config)\n        request = self._makeRequest(config)\n        result = wrapper(None, request)\n        self.assertEqual(result.body, b'Hello!')\n        settings = config.registry.queryUtility(ISettings)\n        result = renderer.info\n        self.assertEqual(result.registry, config.registry)\n        self.assertEqual(result.type, '.txt')\n>       self.assertEqual(result.package, test_config)\nE       AssertionError: <module 'r2e_tests.test_config' from '/home/gcpuse[117 chars].py'> != <module 'pyramid.tests.test_config' from '/home/gc[125 chars].py'>\n\nr2e_tests/test_config/test_views.py:1227: AssertionError\n_________ TestStaticURLInfo.test_generate_url_cachebust_with_overrides _________\n\nself = <r2e_tests.test_config.test_views.TestStaticURLInfo testMethod=test_generate_url_cachebust_with_overrides>\n\n    def test_generate_url_cachebust_with_overrides(self):\n        config = testing.setUp()\n        try:\n            request = testing.DummyRequest()\n            config.add_static_view('static', 'path')\n            config.override_asset(\n                'pyramid.tests.test_config:path/',\n                'pyramid.tests.test_config:other_path/')\n            def cb(val):\n                def cb_(request, subpath, kw):\n                    kw['_query'] = {'x': val}\n                    return subpath, kw\n                return cb_\n            config.add_cache_buster('path', cb('foo'))\n            result = request.static_url('path/foo.png')\n            self.assertEqual(result, 'http://example.com/static/foo.png?x=foo')\n            config.add_cache_buster('other_path', cb('bar'), explicit=True)\n            result = request.static_url('path/foo.png')\n>           self.assertEqual(result, 'http://example.com/static/foo.png?x=bar')\nE           AssertionError: 'http://example.com/static/foo.png?x=foo' != 'http://example.com/static/foo.png?x=bar'\nE           - http://example.com/static/foo.png?x=foo\nE           ?                                     ^^^\nE           + http://example.com/static/foo.png?x=bar\nE           ?                                     ^^^\n\nr2e_tests/test_config/test_views.py:3213: AssertionError\n___________________ Test_view_description.test_without_text ____________________\n\nself = <r2e_tests.test_config.test_views.Test_view_description testMethod=test_without_text>\n\n    def test_without_text(self):\n        def view(): pass\n        result = self._callFUT(view)\n>       self.assertEqual(result,\n                         'function pyramid.tests.test_config.test_views.view')\nE       AssertionError: 'function r2e_tests.test_config.test_views.view' != 'function pyramid.tests.test_config.test_views.view'\nE       - function r2e_tests.test_config.test_views.view\nE       ?           ^^^\nE       + function pyramid.tests.test_config.test_views.view\nE       ?          ++ ^^^^^\n\nr2e_tests/test_config/test_views.py:3384: AssertionError\n_________ TestPRoutesCommand.test_one_route_all_methods_view_only_post _________\n\nself = <r2e_tests.test_scripts.test_proutes.TestPRoutesCommand testMethod=test_one_route_all_methods_view_only_post>\n\n    def test_one_route_all_methods_view_only_post(self):\n        from pyramid.renderers import null_renderer as nr\n    \n        def view1(context, request): return 'view1'\n    \n        config = self._makeConfig(autocommit=True)\n        config.add_route('foo', '/a/b')\n        config.add_view(\n            route_name='foo',\n            view=view1,\n            renderer=nr,\n            request_method='POST'\n        )\n    \n        command = self._makeOne()\n        L = []\n        command.out = L.append\n        command.bootstrap = (dummy.DummyBootstrap(registry=config.registry),)\n        result = command.run()\n        self.assertEqual(result, 0)\n        self.assertEqual(len(L), 3)\n        compare_to = L[-1].split()\n        expected = [\n            'foo', '/a/b',\n            'pyramid.tests.test_scripts.test_proutes.view1', 'POST'\n        ]\n>       self.assertEqual(compare_to, expected)\nE       AssertionError: Lists differ: ['foo', '/a/b', 'r2e_tests.test_scripts.test_proutes.view1', 'POST'] != ['foo', '/a/b', 'pyramid.tests.test_scripts.test_proutes.view1', 'POST']\nE       \nE       First differing element 2:\nE       'r2e_tests.test_scripts.test_proutes.view1'\nE       'pyramid.tests.test_scripts.test_proutes.view1'\nE       \nE       - ['foo', '/a/b', 'r2e_tests.test_scripts.test_proutes.view1', 'POST']\nE       ?                   ^^^\nE       \nE       + ['foo', '/a/b', 'pyramid.tests.test_scripts.test_proutes.view1', 'POST']\nE       ?                  ++ ^^^^^\n\nr2e_tests/test_scripts/test_proutes.py:339: AssertionError\n_________ TestPRoutesCommand.test_one_route_only_post_view_all_methods _________\n\nself = <r2e_tests.test_scripts.test_proutes.TestPRoutesCommand testMethod=test_one_route_only_post_view_all_methods>\n\n    def test_one_route_only_post_view_all_methods(self):\n        from pyramid.renderers import null_renderer as nr\n    \n        def view1(context, request): return 'view1'\n    \n        config = self._makeConfig(autocommit=True)\n        config.add_route('foo', '/a/b', request_method='POST')\n        config.add_view(\n            route_name='foo',\n            view=view1,\n            renderer=nr,\n        )\n    \n        command = self._makeOne()\n        L = []\n        command.out = L.append\n        command.bootstrap = (dummy.DummyBootstrap(registry=config.registry),)\n        result = command.run()\n        self.assertEqual(result, 0)\n        self.assertEqual(len(L), 3)\n        compare_to = L[-1].split()\n        expected = [\n            'foo', '/a/b',\n            'pyramid.tests.test_scripts.test_proutes.view1', 'POST'\n        ]\n>       self.assertEqual(compare_to, expected)\nE       AssertionError: Lists differ: ['foo', '/a/b', 'r2e_tests.test_scripts.test_proutes.view1', 'POST'] != ['foo', '/a/b', 'pyramid.tests.test_scripts.test_proutes.view1', 'POST']\nE       \nE       First differing element 2:\nE       'r2e_tests.test_scripts.test_proutes.view1'\nE       'pyramid.tests.test_scripts.test_proutes.view1'\nE       \nE       - ['foo', '/a/b', 'r2e_tests.test_scripts.test_proutes.view1', 'POST']\nE       ?                   ^^^\nE       \nE       + ['foo', '/a/b', 'pyramid.tests.test_scripts.test_proutes.view1', 'POST']\nE       ?                  ++ ^^^^^\n\nr2e_tests/test_scripts/test_proutes.py:366: AssertionError\n________ TestPRoutesCommand.test_one_route_only_post_view_post_and_get _________\n\nself = <r2e_tests.test_scripts.test_proutes.TestPRoutesCommand testMethod=test_one_route_only_post_view_post_and_get>\n\n    def test_one_route_only_post_view_post_and_get(self):\n        from pyramid.renderers import null_renderer as nr\n    \n        def view1(context, request): return 'view1'\n    \n        config = self._makeConfig(autocommit=True)\n        config.add_route('foo', '/a/b', request_method='POST')\n        config.add_view(\n            route_name='foo',\n            view=view1,\n            renderer=nr,\n            request_method=('POST', 'GET')\n        )\n    \n        command = self._makeOne()\n        L = []\n        command.out = L.append\n        command.bootstrap = (dummy.DummyBootstrap(registry=config.registry),)\n        result = command.run()\n        self.assertEqual(result, 0)\n        self.assertEqual(len(L), 3)\n        compare_to = L[-1].split()\n        expected = [\n            'foo', '/a/b',\n            'pyramid.tests.test_scripts.test_proutes.view1', 'POST'\n        ]\n>       self.assertEqual(compare_to, expected)\nE       AssertionError: Lists differ: ['foo', '/a/b', 'r2e_tests.test_scripts.test_proutes.view1', 'POST'] != ['foo', '/a/b', 'pyramid.tests.test_scripts.test_proutes.view1', 'POST']\nE       \nE       First differing element 2:\nE       'r2e_tests.test_scripts.test_proutes.view1'\nE       'pyramid.tests.test_scripts.test_proutes.view1'\nE       \nE       - ['foo', '/a/b', 'r2e_tests.test_scripts.test_proutes.view1', 'POST']\nE       ?                   ^^^\nE       \nE       + ['foo', '/a/b', 'pyramid.tests.test_scripts.test_proutes.view1', 'POST']\nE       ?                  ++ ^^^^^\n\nr2e_tests/test_scripts/test_proutes.py:394: AssertionError\n_____ TestPRoutesCommand.test_one_route_with_long_name_one_view_registered _____\n\nself = <r2e_tests.test_scripts.test_proutes.TestPRoutesCommand testMethod=test_one_route_with_long_name_one_view_registered>\n\n    def test_one_route_with_long_name_one_view_registered(self):\n        from zope.interface import Interface\n        from pyramid.interfaces import IRouteRequest\n        from pyramid.interfaces import IViewClassifier\n        from pyramid.interfaces import IView\n        registry = self._makeRegistry()\n    \n        def view():pass\n    \n        class IMyRoute(Interface):\n            pass\n    \n        registry.registerAdapter(\n            view,\n            (IViewClassifier, IMyRoute, Interface),\n            IView, ''\n        )\n    \n        registry.registerUtility(IMyRoute, IRouteRequest,\n                                 name='very_long_name_123')\n    \n        command = self._makeOne()\n        route = dummy.DummyRoute(\n            'very_long_name_123',\n            '/and_very_long_pattern_as_well'\n        )\n        mapper = dummy.DummyMapper(route)\n        command._get_mapper = lambda *arg: mapper\n        L = []\n        command.out = L.append\n        command.bootstrap = (dummy.DummyBootstrap(registry=registry),)\n        result = command.run()\n        self.assertEqual(result, 0)\n        self.assertEqual(len(L), 3)\n        compare_to = L[-1].split()[:3]\n>       self.assertEqual(\n            compare_to,\n            ['very_long_name_123',\n             '/and_very_long_pattern_as_well',\n             'pyramid.tests.test_scripts.test_proutes.view']\n        )\nE       AssertionError: Lists differ: ['ver[36 chars]ttern_as_well', 'r2e_tests.test_scripts.test_proutes.view'] != ['ver[36 chars]ttern_as_well', 'pyramid.tests.test_scripts.test_proutes.view']\nE       \nE       First differing element 2:\nE       'r2e_tests.test_scripts.test_proutes.view'\nE       'pyramid.tests.test_scripts.test_proutes.view'\nE       \nE         ['very_long_name_123',\nE          '/and_very_long_pattern_as_well',\nE       -  'r2e_tests.test_scripts.test_proutes.view']\nE       ?    ^^^\nE       \nE       +  'pyramid.tests.test_scripts.test_proutes.view']\nE       ?   ++ ^^^^^\n\nr2e_tests/test_scripts/test_proutes.py:198: AssertionError\n______ TestPRoutesCommand.test_route_is_get_view_request_method_not_post _______\n\nself = <r2e_tests.test_scripts.test_proutes.TestPRoutesCommand testMethod=test_route_is_get_view_request_method_not_post>\n\n    def test_route_is_get_view_request_method_not_post(self):\n        from pyramid.renderers import null_renderer as nr\n        from pyramid.config import not_\n    \n        def view1(context, request): return 'view1'\n    \n        config = self._makeConfig(autocommit=True)\n        config.add_route('foo', '/a/b', request_method='GET')\n        config.add_view(\n            route_name='foo',\n            view=view1,\n            renderer=nr,\n            request_method=not_('POST')\n        )\n    \n        command = self._makeOne()\n        L = []\n        command.out = L.append\n        command.bootstrap = (dummy.DummyBootstrap(registry=config.registry),)\n        result = command.run()\n        self.assertEqual(result, 0)\n        self.assertEqual(len(L), 3)\n        compare_to = L[-1].split()\n        expected = [\n            'foo', '/a/b',\n            'pyramid.tests.test_scripts.test_proutes.view1',\n            'GET'\n        ]\n>       self.assertEqual(compare_to, expected)\nE       AssertionError: Lists differ: ['foo', '/a/b', 'r2e_tests.test_scripts.test_proutes.view1', 'GET'] != ['foo', '/a/b', 'pyramid.tests.test_scripts.test_proutes.view1', 'GET']\nE       \nE       First differing element 2:\nE       'r2e_tests.test_scripts.test_proutes.view1'\nE       'pyramid.tests.test_scripts.test_proutes.view1'\nE       \nE       - ['foo', '/a/b', 'r2e_tests.test_scripts.test_proutes.view1', 'GET']\nE       ?                   ^^^\nE       \nE       + ['foo', '/a/b', 'pyramid.tests.test_scripts.test_proutes.view1', 'GET']\nE       ?                  ++ ^^^^^\n\nr2e_tests/test_scripts/test_proutes.py:534: AssertionError\n____________ TestPRoutesCommand.test_route_request_method_mismatch _____________\n\nself = <r2e_tests.test_scripts.test_proutes.TestPRoutesCommand testMethod=test_route_request_method_mismatch>\n\n    def test_route_request_method_mismatch(self):\n        from pyramid.renderers import null_renderer as nr\n    \n        def view1(context, request): return 'view1'\n    \n        config = self._makeConfig(autocommit=True)\n        config.add_route('foo', '/a/b', request_method='POST')\n        config.add_view(\n            route_name='foo',\n            view=view1,\n            renderer=nr,\n            request_method='GET'\n        )\n    \n        command = self._makeOne()\n        L = []\n        command.out = L.append\n        command.bootstrap = (dummy.DummyBootstrap(registry=config.registry),)\n        result = command.run()\n        self.assertEqual(result, 0)\n        self.assertEqual(len(L), 3)\n        compare_to = L[-1].split()\n        expected = [\n            'foo', '/a/b',\n            'pyramid.tests.test_scripts.test_proutes.view1',\n            '<route', 'mismatch>'\n        ]\n>       self.assertEqual(compare_to, expected)\nE       AssertionError: Lists differ: ['foo', '/a/b', 'r2e_tests.test_scripts.test_proutes.view1[20 chars]ch>'] != ['foo', '/a/b', 'pyramid.tests.test_scripts.test_proutes.v[24 chars]ch>']\nE       \nE       First differing element 2:\nE       'r2e_tests.test_scripts.test_proutes.view1'\nE       'pyramid.tests.test_scripts.test_proutes.view1'\nE       \nE         ['foo',\nE          '/a/b',\nE       -  'r2e_tests.test_scripts.test_proutes.view1',\nE       ?    ^^^\nE       \nE       +  'pyramid.tests.test_scripts.test_proutes.view1',\nE       ?   ++ ^^^^^\nE       \nE          '<route',\nE          'mismatch>']\n\nr2e_tests/test_scripts/test_proutes.py:423: AssertionError\n__________________ TestPRoutesCommand.test_route_static_views __________________\n\nself = <r2e_tests.test_scripts.test_proutes.TestPRoutesCommand testMethod=test_route_static_views>\n\n    def test_route_static_views(self):\n        from pyramid.renderers import null_renderer as nr\n        config = self._makeConfig(autocommit=True)\n        config.add_static_view('static', 'static', cache_max_age=3600)\n        path2 = os.path.normpath('/var/www/static')\n        config.add_static_view(name='static2', path=path2)\n        config.add_static_view(\n            name='pyramid_scaffold',\n            path='pyramid:scaffolds/starter/+package+/static'\n        )\n    \n        command = self._makeOne()\n        L = []\n        command.out = L.append\n        command.bootstrap = (dummy.DummyBootstrap(registry=config.registry),)\n        result = command.run()\n        self.assertEqual(result, 0)\n        self.assertEqual(len(L), 5)\n    \n        expected = [\n            ['__static/', '/static/*subpath',\n             'pyramid.tests.test_scripts:static/', '*'],\n            ['__static2/', '/static2/*subpath', path2 + os.sep, '*'],\n            ['__pyramid_scaffold/', '/pyramid_scaffold/*subpath',\n             'pyramid:scaffolds/starter/+package+/static/',  '*'],\n        ]\n    \n        for index, line in enumerate(L[2:]):\n            data = line.split()\n>           self.assertEqual(data, expected[index])\nE           AssertionError: Lists differ: ['__static/', '/static/*subpath', 'r2e_tests.test_scripts:static/', '*'] != ['__static/', '/static/*subpath', 'pyramid.tests.test_scripts:static/', '*']\nE           \nE           First differing element 2:\nE           'r2e_tests.test_scripts:static/'\nE           'pyramid.tests.test_scripts:static/'\nE           \nE           - ['__static/', '/static/*subpath', 'r2e_tests.test_scripts:static/', '*']\nE           ?                                     ^^^\nE           \nE           + ['__static/', '/static/*subpath', 'pyramid.tests.test_scripts:static/', '*']\nE           ?                                    ++ ^^^^^\n\nr2e_tests/test_scripts/test_proutes.py:454: AssertionError\n___________ TestPRoutesCommand.test_single_route_one_view_registered ___________\n\nself = <r2e_tests.test_scripts.test_proutes.TestPRoutesCommand testMethod=test_single_route_one_view_registered>\n\n    def test_single_route_one_view_registered(self):\n        from zope.interface import Interface\n        from pyramid.interfaces import IRouteRequest\n        from pyramid.interfaces import IViewClassifier\n        from pyramid.interfaces import IView\n        registry = self._makeRegistry()\n    \n        def view():pass\n        class IMyRoute(Interface):\n            pass\n        registry.registerAdapter(view,\n                                 (IViewClassifier, IMyRoute, Interface),\n                                 IView, '')\n        registry.registerUtility(IMyRoute, IRouteRequest, name='a')\n        command = self._makeOne()\n        route = dummy.DummyRoute('a', '/a')\n        mapper = dummy.DummyMapper(route)\n        command._get_mapper = lambda *arg: mapper\n        L = []\n        command.out = L.append\n        command.bootstrap = (dummy.DummyBootstrap(registry=registry),)\n        result = command.run()\n        self.assertEqual(result, 0)\n        self.assertEqual(len(L), 3)\n        compare_to = L[-1].split()[:3]\n>       self.assertEqual(\n            compare_to,\n            ['a', '/a', 'pyramid.tests.test_scripts.test_proutes.view']\n        )\nE       AssertionError: Lists differ: ['a', '/a', 'r2e_tests.test_scripts.test_proutes.view'] != ['a', '/a', 'pyramid.tests.test_scripts.test_proutes.view']\nE       \nE       First differing element 2:\nE       'r2e_tests.test_scripts.test_proutes.view'\nE       'pyramid.tests.test_scripts.test_proutes.view'\nE       \nE       - ['a', '/a', 'r2e_tests.test_scripts.test_proutes.view']\nE       ?               ^^^\nE       \nE       + ['a', '/a', 'pyramid.tests.test_scripts.test_proutes.view']\nE       ?              ++ ^^^^^\n\nr2e_tests/test_scripts/test_proutes.py:158: AssertionError\n______________________ TestPRoutesCommand.test_view_glob _______________________\n\nself = <r2e_tests.test_scripts.test_proutes.TestPRoutesCommand testMethod=test_view_glob>\n\n    def test_view_glob(self):\n        from pyramid.renderers import null_renderer as nr\n        from pyramid.config import not_\n    \n        def view1(context, request): return 'view1'\n        def view2(context, request): return 'view2'\n    \n        config = self._makeConfig(autocommit=True)\n        config.add_route('foo', '/a/b')\n        config.add_view(\n            route_name='foo',\n            view=view1,\n            renderer=nr,\n            request_method=not_('POST')\n        )\n    \n        config.add_route('bar', '/b/a')\n        config.add_view(\n            route_name='bar',\n            view=view2,\n            renderer=nr,\n            request_method=not_('POST')\n        )\n    \n        command = self._makeOne()\n        command.args.glob = '*foo*'\n    \n        L = []\n        command.out = L.append\n        command.bootstrap = (dummy.DummyBootstrap(registry=config.registry),)\n        result = command.run()\n        self.assertEqual(result, 0)\n        self.assertEqual(len(L), 3)\n        compare_to = L[-1].split()\n        expected = [\n            'foo', '/a/b',\n            'pyramid.tests.test_scripts.test_proutes.view1',\n            '!POST,*'\n        ]\n>       self.assertEqual(compare_to, expected)\nE       AssertionError: Lists differ: ['foo', '/a/b', 'r2e_tests.test_scripts.test_proutes.view1', '!POST,*'] != ['foo', '/a/b', 'pyramid.tests.test_scripts.test_proutes.view1', '!POST,*']\nE       \nE       First differing element 2:\nE       'r2e_tests.test_scripts.test_proutes.view1'\nE       'pyramid.tests.test_scripts.test_proutes.view1'\nE       \nE       - ['foo', '/a/b', 'r2e_tests.test_scripts.test_proutes.view1', '!POST,*']\nE       ?                   ^^^\nE       \nE       + ['foo', '/a/b', 'pyramid.tests.test_scripts.test_proutes.view1', '!POST,*']\nE       ?                  ++ ^^^^^\n\nr2e_tests/test_scripts/test_proutes.py:605: AssertionError\n_____________ TestPRoutesCommand.test_view_request_method_not_post _____________\n\nself = <r2e_tests.test_scripts.test_proutes.TestPRoutesCommand testMethod=test_view_request_method_not_post>\n\n    def test_view_request_method_not_post(self):\n        from pyramid.renderers import null_renderer as nr\n        from pyramid.config import not_\n    \n        def view1(context, request): return 'view1'\n    \n        config = self._makeConfig(autocommit=True)\n        config.add_route('foo', '/a/b')\n        config.add_view(\n            route_name='foo',\n            view=view1,\n            renderer=nr,\n            request_method=not_('POST')\n        )\n    \n        command = self._makeOne()\n        L = []\n        command.out = L.append\n        command.bootstrap = (dummy.DummyBootstrap(registry=config.registry),)\n        result = command.run()\n        self.assertEqual(result, 0)\n        self.assertEqual(len(L), 3)\n        compare_to = L[-1].split()\n        expected = [\n            'foo', '/a/b',\n            'pyramid.tests.test_scripts.test_proutes.view1',\n            '!POST,*'\n        ]\n>       self.assertEqual(compare_to, expected)\nE       AssertionError: Lists differ: ['foo', '/a/b', 'r2e_tests.test_scripts.test_proutes.view1', '!POST,*'] != ['foo', '/a/b', 'pyramid.tests.test_scripts.test_proutes.view1', '!POST,*']\nE       \nE       First differing element 2:\nE       'r2e_tests.test_scripts.test_proutes.view1'\nE       'pyramid.tests.test_scripts.test_proutes.view1'\nE       \nE       - ['foo', '/a/b', 'r2e_tests.test_scripts.test_proutes.view1', '!POST,*']\nE       ?                   ^^^\nE       \nE       + ['foo', '/a/b', 'pyramid.tests.test_scripts.test_proutes.view1', '!POST,*']\nE       ?                  ++ ^^^^^\n\nr2e_tests/test_scripts/test_proutes.py:564: AssertionError\n_____________ TestPServeCommand.test_config_file_finds_watch_files _____________\n\nself = <r2e_tests.test_scripts.test_pserve.TestPServeCommand testMethod=test_config_file_finds_watch_files>\n\n    def test_config_file_finds_watch_files(self):\n        inst = self._makeOne('development.ini')\n        self.config_factory.items = [(\n            'watch_files',\n            'foo\\n/baz\\npyramid.tests.test_scripts:*.py',\n        )]\n        inst.pserve_file_config('/base/path.ini', global_conf={'a': '1'})\n        self.assertEqual(self.config_factory.defaults, {\n            'a': '1',\n            'here': os.path.abspath('/base'),\n        })\n>       self.assertEqual(inst.watch_files, set([\n            os.path.abspath('/base/foo'),\n            os.path.abspath('/baz'),\n            os.path.abspath(os.path.join(here, '*.py')),\n        ]))\nE       AssertionError: Items in the first set but not the second:\nE       '/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/pyramid/tests/test_scripts/*.py'\nE       Items in the second set but not the first:\nE       '/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_b536bd9db1c435586c476c6d03e3d314979af3ab/r2e_tests/test_scripts/*.py'\n\nr2e_tests/test_scripts/test_pserve.py:77: AssertionError\n_____ TestPViewsCommand.test_views_command_single_view_function_traversal ______\n\nself = <r2e_tests.test_scripts.test_pviews.TestPViewsCommand testMethod=test_views_command_single_view_function_traversal>\n\n    def test_views_command_single_view_function_traversal(self):\n        from pyramid.registry import Registry\n        registry = Registry()\n        command = self._makeOne(registry=registry)\n        L = []\n        command.out = L.append\n        def view(): pass\n        view.__request_attrs__ = {'context': 'context', 'view_name': 'a'}\n        command._find_view = lambda arg1: view\n        command.args.config_uri = '/foo/bar/myapp.ini#myapp'\n        command.args.url = '/a'\n        result = command.run()\n        self.assertEqual(result, 0)\n        self.assertEqual(L[1], 'URL = /a')\n        self.assertEqual(L[3], '    context: context')\n        self.assertEqual(L[4], '    view name: a')\n>       self.assertEqual(L[8],\n                         '    pyramid.tests.test_scripts.test_pviews.view')\nE       AssertionError: '    r2e_tests.test_scripts.test_pviews.view' != '    pyramid.tests.test_scripts.test_pviews.view'\nE       -     r2e_tests.test_scripts.test_pviews.view\nE       ?      ^^^\nE       +     pyramid.tests.test_scripts.test_pviews.view\nE       ?     ++ ^^^^^\n\nr2e_tests/test_scripts/test_pviews.py:300: AssertionError\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test___getattr__matches\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test___getattr__matches_no_action_wrap\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test___getattr__missing_when_directives_dont_exist\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test___getattr__missing_when_directives_exist\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test__fix_registry_adds__lock\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test__fix_registry_adds_clear_view_lookup_cache\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test__fix_registry_has_listeners\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test__fix_registry_notify\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test__fix_registry_queryAdapterOrSelf\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test__fix_registry_registerSelfAdapter\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_absolute_asset_spec_already_absolute\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_absolute_asset_spec_notastring\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_absolute_asset_spec_relative\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_action_autocommit_with_introspectables\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_action_autocommit_with_introspectables_introspection_off\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_action_branching_kw_is_None\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_action_branching_kw_is_not_None\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_action_branching_nonautocommit_with_config_info\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_action_branching_nonautocommit_with_introspectables\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_action_branching_nonautocommit_without_config_info\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_action_nonautocommit_with_introspectables_introspection_off\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_autocommit_no_conflicts\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_begin\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_begin_does_not_propagate_request_for_diff_registry\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_begin_overrides_request\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_begin_propagates_request_for_same_registry\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_begin_with_request\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_commit_conflict_resolved_with_include\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_commit_conflict_resolved_with_two_includes_and_local\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_commit_conflict_simple\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_commit_conflict_with_two_includes\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_conflict_set_forbidden_view\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_conflict_set_notfound_view\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_alternate_renderers\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_authentication_policy\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_authorization_policy_only\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_default_permission\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_default_renderers\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_default_view_mapper\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_default_webob_response_adapter_registered\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_exceptionresponse_view_None\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_exceptionresponse_view_custom\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_httpexception_view_default\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_no_root_factory\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_noreg_custom_settings\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_noreg_debug_logger_non_None\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_session_factory\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_with_introspection\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_with_package_registry\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_with_root_factory\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_end\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_hook_zca\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_include_with_dotted_name\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_include_with_missing_source_file\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_include_with_module_defaults_to_includeme\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_include_with_module_defaults_to_includeme_missing\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_include_with_nested_route_prefix\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_include_with_python_callable\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_include_with_route_prefix\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_introspector_decorator\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_make_wsgi_app\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_maybe_dotted_notstring_success\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_maybe_dotted_string_fail\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_maybe_dotted_string_success\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_scan_integration\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_scan_integration_dottedname_package\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_scan_integration_with_extra_kw\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_scan_integration_with_ignore\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_alternate_renderers\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_authentication_policy\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_authentication_policy_dottedname\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_authorization_policy_dottedname\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_authorization_policy_only\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_calls_fix_registry\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_custom_settings\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_debug_logger_name\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_debug_logger_non_None\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_default_permission\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_dottedname_root_factory\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_explicit_notfound_trumps_iexceptionresponse\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_includes\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_includes_spaces\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_locale_negotiator\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_locale_negotiator_dottedname\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_no_default_root_factory\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_registers_default_exceptionresponse_views\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_registers_default_view_predicates\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_registers_default_webob_iresponse_adapter\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_request_factory\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_request_factory_dottedname\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_response_factory\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_tweens\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_unhook_zca\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_with_package\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_with_package_module\nPASSED r2e_tests/test_1.py::ConfiguratorTests::test_with_package_package\nPASSED r2e_tests/test_1.py::TestConfigurator_add_directive::test_directive_persists_across_configurator_creations\nPASSED r2e_tests/test_1.py::TestConfigurator_add_directive::test_extend_action_method_successful\nPASSED r2e_tests/test_1.py::TestConfigurator_add_directive::test_extend_same_name_doesnt_conflict\nPASSED r2e_tests/test_1.py::TestConfigurator__add_predicate::test_factory_as_object\nPASSED r2e_tests/test_1.py::TestActionState::test_action_simple\nPASSED r2e_tests/test_1.py::TestActionState::test_action_with_includepath\nPASSED r2e_tests/test_1.py::TestActionState::test_action_with_includepath_and_info\nPASSED r2e_tests/test_1.py::TestActionState::test_action_with_info\nPASSED r2e_tests/test_1.py::TestActionState::test_action_with_introspectables\nPASSED r2e_tests/test_1.py::TestActionState::test_action_with_order\nPASSED r2e_tests/test_1.py::TestActionState::test_execute_actions_dicts\nPASSED r2e_tests/test_1.py::TestActionState::test_execute_actions_error\nPASSED r2e_tests/test_1.py::TestActionState::test_execute_actions_tuples\nPASSED r2e_tests/test_1.py::TestActionState::test_execute_actions_with_introspectable_no_callable\nPASSED r2e_tests/test_1.py::TestActionState::test_execute_actions_with_introspectables\nPASSED r2e_tests/test_1.py::TestActionState::test_executing_conflicting_action_across_orders\nPASSED r2e_tests/test_1.py::TestActionState::test_executing_conflicting_action_across_reentrant_orders\nPASSED r2e_tests/test_1.py::TestActionState::test_it\nPASSED r2e_tests/test_1.py::TestActionState::test_processSpec\nPASSED r2e_tests/test_1.py::TestActionState::test_reentrant_action\nPASSED r2e_tests/test_1.py::TestActionState::test_reentrant_action_error\nPASSED r2e_tests/test_1.py::TestActionState::test_reentrant_action_with_deferred_discriminator\nPASSED r2e_tests/test_1.py::TestActionState::test_reentrant_action_without_clear\nPASSED r2e_tests/test_1.py::Test_reentrant_action_functional::test_deferred_discriminator\nPASSED r2e_tests/test_1.py::Test_reentrant_action_functional::test_functional\nPASSED r2e_tests/test_1.py::Test_resolveConflicts::test_conflicts_across_orders\nPASSED r2e_tests/test_1.py::Test_resolveConflicts::test_it_conflict\nPASSED r2e_tests/test_1.py::Test_resolveConflicts::test_it_success_dicts\nPASSED r2e_tests/test_1.py::Test_resolveConflicts::test_it_success_tuples\nPASSED r2e_tests/test_1.py::Test_resolveConflicts::test_it_with_actions_grouped_by_order\nPASSED r2e_tests/test_1.py::Test_resolveConflicts::test_override_success_across_orders\nPASSED r2e_tests/test_1.py::TestGlobalRegistriesIntegration::test_global_registries\nPASSED r2e_tests/test_1.py::TestGlobalRegistriesIntegration::test_global_registries_empty\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_object_event_subscriber\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_resource_url_default_resource_iface_means_Interface\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_resource_url_nodefault_resource_iface\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_response_adapter\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_response_adapter_dottednames\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_response_adapter_self\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_subscriber_defaults\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_subscriber_dottednames\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_subscriber_iface_specified\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_subscriber_predicate\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_subscriber_with_default_type_predicates_False\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_subscriber_with_default_type_predicates_True\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_subscriber_with_specific_type_and_predicates_False\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_subscriber_with_specific_type_and_predicates_True\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_traverser_default_iface_means_Interface\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_traverser_introspectables\nPASSED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_traverser_nondefault_iface\nPASSED r2e_tests/test_config/test_adapters.py::Test_eventonly::test_defaults\nPASSED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test__override_already_registered\nPASSED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test__override_not_yet_registered\nPASSED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_directory_with_absdirectory\nPASSED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_directory_with_absfile\nPASSED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_directory_with_file\nPASSED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_file_with_absdirectory\nPASSED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_file_with_absfile\nPASSED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_file_with_directory\nPASSED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_file_with_missing_abspath\nPASSED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_file_with_package\nPASSED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_package_with_absdirectory\nPASSED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_samename\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_get_resource_filename_override_returns_value\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_get_resource_stream_no_overrides\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_get_resource_stream_override_returns_None\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_get_resource_stream_override_returns_value\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_get_resource_string_no_overrides\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_get_resource_string_override_returns_None\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_get_resource_string_override_returns_value\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_has_resource_no_overrides\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_has_resource_override_returns_None\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_has_resource_override_returns_True\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_resource_isdir_no_overrides\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_resource_isdir_override_returns_False\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_resource_isdir_override_returns_None\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_resource_listdir_no_overrides\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_resource_listdir_override_returns_None\nPASSED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_resource_listdir_override_returns_values\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_class_conforms_to_IPEP302Loader\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_class_conforms_to_IPackageOverrides\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_ctor_package_already_has_loader_of_different_type\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_ctor_package_already_has_loader_of_same_type\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_ctor_registers_loader_type\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_ctor_sets_loader\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_ctor_sets_local_state\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_filtered_sources\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_get_code_pkg_has___loader__\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_get_code_pkg_has_no___loader__\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_get_data_pkg_has___loader__\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_get_data_pkg_has_no___loader__\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_get_filename\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_get_filename_file_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_get_source_pkg_has___loader__\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_get_source_pkg_has_no___loader__\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_get_stream\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_get_stream_file_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_get_string\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_get_string_file_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_has_resource\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_has_resource_file_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_insert_directory\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_insert_emptystring\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_insert_file\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_instance_conforms_to_IPEP302Loader\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_instance_conforms_to_IPackageOverrides\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_is_package_pkg_has___loader__\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_is_package_pkg_has_no___loader__\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_isdir_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_isdir_false\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_isdir_true\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_listdir\nPASSED r2e_tests/test_config/test_assets.py::TestPackageOverrides::test_listdir_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_exists\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_exists_file_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_exists_with_prefix\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_get_filename_file_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_get_stream\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_get_stream_file_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_get_stream_with_prefix\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_get_string\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_get_string_file_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_get_string_with_prefix\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_isdir_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_isdir_false\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_isdir_true\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_listdir\nPASSED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_listdir_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_exists\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_exists_file_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_exists_with_prefix\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_get_filename\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_get_filename_file_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_get_filename_with_prefix\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_get_stream\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_get_stream_file_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_get_stream_with_prefix\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_get_string\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_get_string_file_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_get_string_with_prefix\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_isdir_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_isdir_false\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_isdir_true\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_listdir\nPASSED r2e_tests/test_config/test_assets.py::TestFSAssetSource::test_listdir_doesnt_exist\nPASSED r2e_tests/test_config/test_assets.py::TestDirectoryOverride::test_it_match\nPASSED r2e_tests/test_config/test_assets.py::TestDirectoryOverride::test_it_no_match\nPASSED r2e_tests/test_config/test_assets.py::TestFileOverride::test_it_match\nPASSED r2e_tests/test_config/test_assets.py::TestFileOverride::test_it_no_match\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_add_request_method_with_None_callable\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_add_request_method_with_None_callable_and_no_name\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_add_request_method_with_None_callable_conflict\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_add_request_method_with_callable\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_add_request_method_with_text_type_name\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_add_request_method_with_unnamed_callable\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_execution_policy\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_execution_policy_to_None\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_multiple_request_methods_conflict\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_request_factory\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_request_factory_dottedname\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_response_factory\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_response_factory_dottedname\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_root_factory\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_root_factory_as_None\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_root_factory_dottedname\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_session_factory\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_session_factory_dottedname\nPASSED r2e_tests/test_config/test_factories.py::TestDeprecatedFactoriesMixinMethods::test_set_multiple_request_properties\nPASSED r2e_tests/test_config/test_factories.py::TestDeprecatedFactoriesMixinMethods::test_set_multiple_request_properties_conflict\nPASSED r2e_tests/test_config/test_factories.py::TestDeprecatedFactoriesMixinMethods::test_set_request_property_with_callable\nPASSED r2e_tests/test_config/test_factories.py::TestDeprecatedFactoriesMixinMethods::test_set_request_property_with_property\nPASSED r2e_tests/test_config/test_factories.py::TestDeprecatedFactoriesMixinMethods::test_set_request_property_with_unnamed_callable\nPASSED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_add_translation_dirs_invalid_kwargs\nPASSED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_add_translation_dirs_missing_dir\nPASSED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_add_translation_dirs_no_specs\nPASSED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_set_locale_negotiator\nPASSED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_set_locale_negotiator_dottedname\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test___getattr__matches\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test___getattr__matches_no_action_wrap\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test___getattr__missing_when_directives_dont_exist\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test___getattr__missing_when_directives_exist\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test__fix_registry_adds__lock\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test__fix_registry_adds_clear_view_lookup_cache\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test__fix_registry_has_listeners\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test__fix_registry_notify\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test__fix_registry_queryAdapterOrSelf\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test__fix_registry_registerSelfAdapter\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_absolute_asset_spec_already_absolute\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_absolute_asset_spec_notastring\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_absolute_asset_spec_relative\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_action_autocommit_with_introspectables\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_action_autocommit_with_introspectables_introspection_off\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_action_branching_kw_is_None\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_action_branching_kw_is_not_None\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_action_branching_nonautocommit_with_config_info\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_action_branching_nonautocommit_with_introspectables\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_action_branching_nonautocommit_without_config_info\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_action_nonautocommit_with_introspectables_introspection_off\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_autocommit_no_conflicts\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_begin\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_begin_does_not_propagate_request_for_diff_registry\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_begin_overrides_request\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_begin_propagates_request_for_same_registry\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_begin_with_request\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_commit_conflict_resolved_with_include\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_commit_conflict_resolved_with_two_includes_and_local\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_commit_conflict_simple\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_commit_conflict_with_two_includes\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_conflict_set_forbidden_view\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_conflict_set_notfound_view\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_alternate_renderers\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_authentication_policy\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_authorization_policy_only\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_default_permission\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_default_renderers\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_default_view_mapper\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_default_webob_response_adapter_registered\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_exceptionresponse_view_None\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_exceptionresponse_view_custom\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_httpexception_view_default\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_no_root_factory\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_noreg_custom_settings\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_noreg_debug_logger_non_None\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_session_factory\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_with_introspection\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_with_package_registry\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_with_root_factory\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_end\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_hook_zca\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_include_with_dotted_name\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_include_with_missing_source_file\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_include_with_module_defaults_to_includeme\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_include_with_module_defaults_to_includeme_missing\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_include_with_nested_route_prefix\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_include_with_python_callable\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_include_with_route_prefix\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_introspector_decorator\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_make_wsgi_app\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_maybe_dotted_notstring_success\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_maybe_dotted_string_fail\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_maybe_dotted_string_success\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_scan_integration\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_scan_integration_dottedname_package\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_scan_integration_with_extra_kw\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_scan_integration_with_ignore\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_scan_integration_with_onerror\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_alternate_renderers\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_authentication_policy\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_authentication_policy_dottedname\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_authorization_policy_dottedname\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_authorization_policy_only\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_calls_fix_registry\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_custom_settings\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_debug_logger_name\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_debug_logger_non_None\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_default_permission\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_dottedname_root_factory\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_explicit_notfound_trumps_iexceptionresponse\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_includes\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_includes_spaces\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_locale_negotiator\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_locale_negotiator_dottedname\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_no_default_root_factory\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_registers_default_exceptionresponse_views\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_registers_default_view_predicates\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_registers_default_webob_iresponse_adapter\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_request_factory\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_request_factory_dottedname\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_response_factory\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_tweens\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_unhook_zca\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_with_package\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_with_package_module\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_with_package_package\nPASSED r2e_tests/test_config/test_init.py::TestConfigurator_add_directive::test_directive_persists_across_configurator_creations\nPASSED r2e_tests/test_config/test_init.py::TestConfigurator_add_directive::test_extend_action_method_successful\nPASSED r2e_tests/test_config/test_init.py::TestConfigurator_add_directive::test_extend_same_name_doesnt_conflict\nPASSED r2e_tests/test_config/test_init.py::TestConfigurator__add_predicate::test_factory_as_object\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_action_simple\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_action_with_includepath\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_action_with_includepath_and_info\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_action_with_info\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_action_with_introspectables\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_action_with_order\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_execute_actions_dicts\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_execute_actions_error\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_execute_actions_tuples\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_execute_actions_with_introspectable_no_callable\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_execute_actions_with_introspectables\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_executing_conflicting_action_across_orders\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_executing_conflicting_action_across_reentrant_orders\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_it\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_processSpec\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_reentrant_action\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_reentrant_action_error\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_reentrant_action_with_deferred_discriminator\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_reentrant_action_without_clear\nPASSED r2e_tests/test_config/test_init.py::Test_reentrant_action_functional::test_deferred_discriminator\nPASSED r2e_tests/test_config/test_init.py::Test_reentrant_action_functional::test_functional\nPASSED r2e_tests/test_config/test_init.py::Test_resolveConflicts::test_conflicts_across_orders\nPASSED r2e_tests/test_config/test_init.py::Test_resolveConflicts::test_it_conflict\nPASSED r2e_tests/test_config/test_init.py::Test_resolveConflicts::test_it_success_dicts\nPASSED r2e_tests/test_config/test_init.py::Test_resolveConflicts::test_it_success_tuples\nPASSED r2e_tests/test_config/test_init.py::Test_resolveConflicts::test_it_with_actions_grouped_by_order\nPASSED r2e_tests/test_config/test_init.py::Test_resolveConflicts::test_override_success_across_orders\nPASSED r2e_tests/test_config/test_init.py::TestGlobalRegistriesIntegration::test_global_registries\nPASSED r2e_tests/test_config/test_init.py::TestGlobalRegistriesIntegration::test_global_registries_empty\nPASSED r2e_tests/test_config/test_rendering.py::TestRenderingConfiguratorMixin::test_add_default_renderers\nPASSED r2e_tests/test_config/test_rendering.py::TestRenderingConfiguratorMixin::test_add_renderer\nPASSED r2e_tests/test_config/test_rendering.py::TestRenderingConfiguratorMixin::test_add_renderer_dottedname_factory\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_defaults\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_discriminator\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_no_path_no_pattern\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_no_pattern_with_path\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_no_view_with_view_attr\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_no_view_with_view_context\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_no_view_with_view_permission\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_no_view_with_view_renderer\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_accept\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_custom_predicates\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_factory\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_factory_dottedname\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_header\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_path_info\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_path_info_highorder\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_path_info_regex\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_pregenerator\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_request_method\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_request_param\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_route_prefix\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_static\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_add_route_with_xhr\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_get_routes_mapper_already_registered\nPASSED r2e_tests/test_config/test_routes.py::RoutesConfiguratorMixinTests::test_get_routes_mapper_not_yet_registered\nPASSED r2e_tests/test_config/test_security.py::ConfiguratorSecurityMethodsTests::test_add_permission\nPASSED r2e_tests/test_config/test_security.py::ConfiguratorSecurityMethodsTests::test_changing_set_default_csrf_options\nPASSED r2e_tests/test_config/test_security.py::ConfiguratorSecurityMethodsTests::test_set_authentication_policy_no_authz_policy\nPASSED r2e_tests/test_config/test_security.py::ConfiguratorSecurityMethodsTests::test_set_authentication_policy_no_authz_policy_autocommit\nPASSED r2e_tests/test_config/test_security.py::ConfiguratorSecurityMethodsTests::test_set_authentication_policy_with_authz_policy\nPASSED r2e_tests/test_config/test_security.py::ConfiguratorSecurityMethodsTests::test_set_authentication_policy_with_authz_policy_autocommit\nPASSED r2e_tests/test_config/test_security.py::ConfiguratorSecurityMethodsTests::test_set_authorization_policy_no_authn_policy\nPASSED r2e_tests/test_config/test_security.py::ConfiguratorSecurityMethodsTests::test_set_authorization_policy_no_authn_policy_autocommit\nPASSED r2e_tests/test_config/test_security.py::ConfiguratorSecurityMethodsTests::test_set_authorization_policy_with_authn_policy\nPASSED r2e_tests/test_config/test_security.py::ConfiguratorSecurityMethodsTests::test_set_authorization_policy_with_authn_policy_autocommit\nPASSED r2e_tests/test_config/test_security.py::ConfiguratorSecurityMethodsTests::test_set_default_csrf_options\nPASSED r2e_tests/test_config/test_security.py::ConfiguratorSecurityMethodsTests::test_set_default_permission\nPASSED r2e_tests/test_config/test_settings.py::TestSettingsConfiguratorMixin::test__set_settings_as_None\nPASSED r2e_tests/test_config/test_settings.py::TestSettingsConfiguratorMixin::test__set_settings_as_dictwithvalues\nPASSED r2e_tests/test_config/test_settings.py::TestSettingsConfiguratorMixin::test__set_settings_does_not_uses_original_dict\nPASSED r2e_tests/test_config/test_settings.py::TestSettingsConfiguratorMixin::test_add_settings_settings_None\nPASSED r2e_tests/test_config/test_settings.py::TestSettingsConfiguratorMixin::test_add_settings_settings_already_registered\nPASSED r2e_tests/test_config/test_settings.py::TestSettingsConfiguratorMixin::test_add_settings_settings_not_yet_registered\nPASSED r2e_tests/test_config/test_settings.py::TestSettingsConfiguratorMixin::test_get_settings_nosettings\nPASSED r2e_tests/test_config/test_settings.py::TestSettingsConfiguratorMixin::test_get_settings_withsettings\nPASSED r2e_tests/test_config/test_settings.py::TestSettingsConfiguratorMixin::test_settings_parameter_dict_is_never_updated\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_csrf_trusted_origins\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_debug_all\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_debug_authorization\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_debug_notfound\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_debug_routematch\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_debug_templates\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_default_locale_name\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_noargs\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_originals_kept\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_prevent_cachebust\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_prevent_http_cache\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_reload_all\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_reload_assets\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_reload_resources\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_reload_templates\nPASSED r2e_tests/test_config/test_testing.py::TestingConfiguratorMixinTests::test_testing_add_renderer\nPASSED r2e_tests/test_config/test_testing.py::TestingConfiguratorMixinTests::test_testing_add_renderer_explicitrenderer\nPASSED r2e_tests/test_config/test_testing.py::TestingConfiguratorMixinTests::test_testing_add_renderer_twice\nPASSED r2e_tests/test_config/test_testing.py::TestingConfiguratorMixinTests::test_testing_add_subscriber_defaults\nPASSED r2e_tests/test_config/test_testing.py::TestingConfiguratorMixinTests::test_testing_add_subscriber_dottedname\nPASSED r2e_tests/test_config/test_testing.py::TestingConfiguratorMixinTests::test_testing_add_subscriber_multiple\nPASSED r2e_tests/test_config/test_testing.py::TestingConfiguratorMixinTests::test_testing_add_subscriber_single\nPASSED r2e_tests/test_config/test_testing.py::TestingConfiguratorMixinTests::test_testing_add_template\nPASSED r2e_tests/test_config/test_testing.py::TestingConfiguratorMixinTests::test_testing_resources\nPASSED r2e_tests/test_config/test_testing.py::TestingConfiguratorMixinTests::test_testing_securitypolicy\nPASSED r2e_tests/test_config/test_testing.py::TestingConfiguratorMixinTests::test_testing_securitypolicy_forget_result\nPASSED r2e_tests/test_config/test_testing.py::TestingConfiguratorMixinTests::test_testing_securitypolicy_remember_result\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tween_dottedname\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tween_instance\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tween_name_ingress\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tween_name_main\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tween_over_ingress\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tween_over_ingress_iterable\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tween_under_main\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tween_under_main_iterable\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tween_unsuitable\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tweens_conflict\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tweens_names_distinct\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tweens_names_with_over_nonstringoriter\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tweens_names_with_under_nonstringoriter\nPASSED r2e_tests/test_config/test_tweens.py::TestTweensConfiguratorMixin::test_add_tweens_names_with_underover\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test___call___explicit\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test___call___implicit\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_add_explicit\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_add_implicit\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_1\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_2\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_3\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_4\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_5\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_conflict_direct\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_conflict_indirect\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_missing_over_and_under_partials\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_missing_over_partial\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_missing_over_partial_with_fallback\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_missing_under_partial\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_missing_under_partial_with_fallback\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_with_missing_fallbacks\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_with_multiple_matching_fallbacks\nPASSED r2e_tests/test_config/test_tweens.py::TestTweens::test_implicit_ordering_with_partial_fallbacks\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_custom_predicates_can_affect_traversal\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_different_custom_predicates_with_same_hash\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_match_param_from_dict\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_match_param_from_dict_fails\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_match_param_from_string\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_match_param_from_string_fails\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_notted\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_ordering_importance_and_number\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_ordering_importance_of_predicates\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_ordering_number_of_predicates\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_ordering_xhr_and_request_method_trump_only_containment\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_predicate_text_is_correct\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_request_method_ordering_hashes_same\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_request_method_sequence\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_traverse_has_remainder_already\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_traverse_matches\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_traverse_matches_with_highorder_chars\nPASSED r2e_tests/test_config/test_util.py::TestPredicateList::test_unknown_predicate\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_function_annotations\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_function_defaultargs_firstname_not_request\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_function_defaultargs_firstname_request\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_function_noargs\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_function_onearg_named_request\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_function_onearg_named_somethingelse\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_function_toomanyargs\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_function_with_attr_false\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_function_with_attr_true\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_instance_defaultargs_firstname_not_request\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_instance_defaultargs_firstname_request\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_instance_defaultargs_onearg_named_request\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_instance_defaultargs_onearg_named_somethingelse\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_instance_nocall\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_instance_toomanyargs\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_method_onearg_named_request\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_newstyle_class_init_defaultargs_firstname_not_request\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_newstyle_class_init_defaultargs_firstname_request\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_newstyle_class_init_firstname_request_with_secondname\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_newstyle_class_init_noargs\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_newstyle_class_init_onearg_named_somethingelse\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_oldstyle_class_init_defaultargs_firstname_not_request\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_oldstyle_class_init_defaultargs_firstname_request\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_oldstyle_class_init_noargs\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_oldstyle_class_init_onearg_named_request\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_oldstyle_class_init_onearg_named_somethingelse\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_oldstyle_class_init_toomanyargs\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_oldstyle_class_no_init\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_requestonly_newstyle_class_init_onearg_named_request\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_requestonly_newstyle_class_init_toomanyargs\nPASSED r2e_tests/test_config/test_util.py::Test_takes_one_arg::test_requestonly_newstyle_class_no_init\nPASSED r2e_tests/test_config/test_util.py::TestNotted::test_it_with_phash_val\nPASSED r2e_tests/test_config/test_util.py::TestNotted::test_it_without_phash_val\nPASSED r2e_tests/test_config/test_util.py::TestDeprecatedPredicates::test_it\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_exception_view\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_exception_view_disallows_exception_only\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_exception_view_disallows_for_\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_exception_view_disallows_name\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_exception_view_disallows_permission\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_exception_view_disallows_require_csrf\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_exception_view_with_subclass\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_exception_view_with_view_defaults\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_forbidden_view\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_forbidden_view_allows_other_predicates\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_forbidden_view_disallows_context\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_forbidden_view_disallows_for_\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_forbidden_view_disallows_name\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_forbidden_view_disallows_permission\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_forbidden_view_disallows_require_csrf\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_forbidden_view_no_view_argument\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_forbidden_view_with_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_forbidden_view_with_view_defaults\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_normal_and_exception_view_intr_derived_callable\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_notfound_view\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_notfound_view_allows_other_predicates\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_notfound_view_append_slash\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_notfound_view_append_slash_custom_response\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_notfound_view_disallows_context\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_notfound_view_disallows_for_\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_notfound_view_disallows_name\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_notfound_view_disallows_permission\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_notfound_view_disallows_require_csrf\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_notfound_view_no_view_argument\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_notfound_view_with_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_notfound_view_with_view_defaults\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_static_view_absolute\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_static_view_here_no_utility_registered\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_static_view_package_relative\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_as_instance\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_as_instance_requestonly\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_as_instancemethod\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_as_instancemethod_requestonly\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_as_oldstyle_class\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_as_oldstyle_class_requestonly\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_class_method_no_attr\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_context_as_class\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_context_as_dottedname\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_context_as_iface\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_context_trumps_for\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_custom_more_preds_first_bests_fewer_preds_last\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_custom_predicate_bests_standard_predicate\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_default_phash_overrides_default_phash\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_default_phash_overrides_no_phash\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_exc_default_phash_overrides_default_phash\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_exc_default_phash_overrides_no_phash\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_exc_multiview_replaces_existing_securedview\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_exc_multiview_replaces_existing_view\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_exc_multiview_replaces_multiviews\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_exc_multiview_replaces_only_exc_multiview\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_exc_mulview_replaces_existing_view_with___accept__\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_exc_same_phash_overrides_existing_single_view\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_exc_with_accept_multiview_replaces_existing_view\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_exception_only\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_exception_only_misconfiguration\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_exception_only_no_regular_view\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_exception_register_secured_view\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_for__as_dottedname\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_for_as_class\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_for_as_iface\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_mixed_case_replaces_existing_view\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_multiview___discriminator__\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_multiview_call_ordering\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_multiview_context_superclass_then_subclass\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_multiview_exception_superclass_then_subclass\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_multiview_replaces_existing_securedview\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_multiview_replaces_existing_view\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_multiview_replaces_existing_view_with___accept__\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_multiview_replaces_multiview\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_register_secured_view\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_same_phash_overrides_existing_single_view\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_same_predicates\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_view_callable_None_no_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_view_callable_None_with_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_view_callable_dottedname\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_accept_match\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_accept_multiview_replaces_existing_view\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_accept_nomatch\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_check_csrf_predicates_match\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_containment_dottedname\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_containment_false\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_containment_true\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_csrf_header\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_csrf_param\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_custom_predicates_match\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_custom_predicates_nomatch\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_decorator\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_decorator_tuple\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_default_permission_no_explicit_permission\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_default_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_function_callable\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_function_callable_requestonly\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_header_badregex\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_header_noval_match\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_header_noval_nomatch\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_header_val_match\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_header_val_missing\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_header_val_nomatch\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_http_cache\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_mapper\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_missing_csrf_header\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_name\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_name_unicode\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_no_default_permission_no_explicit_permission\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_nonexistant_route_name\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_path_info_badregex\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_path_info_match\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_path_info_nomatch\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_permission\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_method_false\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_method_get_implies_head\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_method_sequence_conflict\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_method_sequence_false\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_method_sequence_true\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_method_true\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_param_noval_false\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_param_noval_true\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_param_val_false\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_param_val_true\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_type\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_type_and_route_name\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_type_as_iface\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_request_type_as_noniface\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_route_name\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_route_name_exception\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_tmpl_renderer_factory_introspector_missing\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_tmpl_renderer_factory_no_renderer_factory\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_tmpl_renderer_factory_with_renderer_factory\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_view_config_and_view_defaults_conflicts\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_view_config_and_view_defaults_doesnt_conflict\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_view_defaults\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_view_defaults_viewname_is_dottedname_kwarg\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_view_defaults_viewname_is_dottedname_nonkwarg\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_xhr_false\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_xhr_true\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_wrapped_view_is_decorated\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_views_with_accept_multiview_replaces_existing\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_derive_view_dottedname\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_derive_view_function\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_derive_view_with_default_renderer_no_explicit_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_derive_view_with_default_renderer_with_explicit_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_set_view_mapper\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_set_view_mapper_dottedname\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_view_with_most_specific_predicate\nPASSED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_view_with_most_specific_predicate_with_mismatch\nPASSED r2e_tests/test_config/test_views.py::Test_runtime_exc_view::test_call\nPASSED r2e_tests/test_config/test_views.py::Test_runtime_exc_view::test_call_dispatches_on_exception\nPASSED r2e_tests/test_config/test_views.py::Test_runtime_exc_view::test_permitted\nPASSED r2e_tests/test_config/test_views.py::Test_runtime_exc_view::test_permitted_dispatches_on_exception\nPASSED r2e_tests/test_config/test_views.py::Test_requestonly::test_defaults\nPASSED r2e_tests/test_config/test_views.py::Test_requestonly::test_otherattr\nPASSED r2e_tests/test_config/test_views.py::Test_isexception::test_is_IException\nPASSED r2e_tests/test_config/test_views.py::Test_isexception::test_is_IException_subinterface\nPASSED r2e_tests/test_config/test_views.py::Test_isexception::test_is_exception_class\nPASSED r2e_tests/test_config/test_views.py::Test_isexception::test_is_exception_instance\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test___call__\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test___call__intermediate_not_found\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test___call__raise_not_found_isnt_interpreted_as_pred_mismatch\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test___call_permissive_has_call_permissive\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test___call_permissive_has_no_call_permissive\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test__call__not_found\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test__call__with_accept_match\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test__call__with_accept_miss\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test__call_permissive__not_found\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_add\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_add_with_phash\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_add_with_phash_override_accept\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_add_with_phash_override_accept2\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_class_implements_ISecuredView\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_get_views\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_get_views_best_match_returns_None\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_get_views_no_self_accepts\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_get_views_request_has_no_accept\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_instance_implements_ISecuredView\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_match_not_found\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_match_predicate_fails\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_match_predicate_succeeds\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_multiple_with_functions_as_views\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_permitted\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_permitted_no_match_with__permitted__\nPASSED r2e_tests/test_config/test_views.py::TestMultiView::test_permitted_no_views\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test__view_as_function_with_attr\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_function_context_and_request\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_function_requestonly\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_function_requestonly_with_attr\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_instance_context_and_request\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_instance_context_and_request_and_attr\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_instance_requestonly\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_instance_requestonly_with_attr\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_newstyle_class_context_and_request\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_newstyle_class_context_and_request_with_attr\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_newstyle_class_requestonly\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_newstyle_class_requestonly_with_attr\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_oldstyle_class_context_and_request\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_oldstyle_class_context_and_request_with_attr\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_oldstyle_class_requestonly\nPASSED r2e_tests/test_config/test_views.py::TestDefaultViewMapper::test_view_as_oldstyle_class_requestonly_with_attr\nPASSED r2e_tests/test_config/test_views.py::Test_preserve_view_attrs::test_it_different\nPASSED r2e_tests/test_config/test_views.py::Test_preserve_view_attrs::test_it_different_with_existing_original_view\nPASSED r2e_tests/test_config/test_views.py::Test_preserve_view_attrs::test_it_same\nPASSED r2e_tests/test_config/test_views.py::Test_preserve_view_attrs::test_it_view_is_None\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_already_exists\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_cachebust_prevented\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_cachebuster\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_cachebuster_abspath\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_cachebuster_for_more_specific_path\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_cachebuster_overwrite\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_cachebuster_overwrite_explicit\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_package_root\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_url_noendslash\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_url_noscheme\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_url_withendslash\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_viewname\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_viewname_with_context\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_viewname_with_for_\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_viewname_with_permission\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_viewname_with_renderer\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_viewname_with_route_prefix\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_missing\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_quoting\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_registration_miss\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_route_url\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_slash_in_name1\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_slash_in_name2\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_url_cachebust\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_url_cachebust_abspath\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_url_cachebust_nomatch\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_url_quoted_remote\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_url_unquoted_local\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_url_with_custom_anchor\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_url_with_custom_query\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_verifyClass\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_verifyObject\nPASSED r2e_tests/test_config/test_views.py::Test_view_description::test_with_text\nPASSED r2e_tests/test_scripts/test_common.py::TestParseVars::test_parse_vars_bad\nPASSED r2e_tests/test_scripts/test_common.py::TestParseVars::test_parse_vars_good\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_confirm_override_conflicting_name\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_force_override_conflicting_name\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_force_override_site_name\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_known_scaffold_absolute_path\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_known_scaffold_multiple_rendered\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_known_scaffold_single_rendered\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_known_scaffold_with_path_as_project_target_rendered\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_no_project_name\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_run_no_scaffold_name\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_run_no_scaffold_no_args\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_run_show_scaffolds_exist\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_run_show_scaffolds_none_exist\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_scaffold_with_dev_pyramid_long_version\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_scaffold_with_dev_pyramid_version\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_scaffold_with_hyphen_in_project_name\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_scaffold_with_package_name\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_scaffold_with_prod_pyramid_long_version\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_scaffold_with_prod_pyramid_unparsable_version\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_scaffold_with_prod_pyramid_version\nPASSED r2e_tests/test_scripts/test_pcreate.py::TestPCreateCommand::test_unknown_scaffold_name\nPASSED r2e_tests/test_scripts/test_pcreate.py::Test_main::test_it\nPASSED r2e_tests/test_scripts/test_pdistreport.py::TestPDistReportCommand::test_no_dists\nPASSED r2e_tests/test_scripts/test_pdistreport.py::TestPDistReportCommand::test_with_dists\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_display_headers\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_has_bad_config_header\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_has_content_type_header_var\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_has_good_header_var\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_has_multiple_header_vars\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_method_configures_logging\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_method_get\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_method_options\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_method_patch\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_method_post\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_method_propfind\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_method_put\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_not_enough_args\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_path_doesnt_start_with_slash\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_response_has_no_charset\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_two_args\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_w_basic_auth\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_with_query_string\nPASSED r2e_tests/test_scripts/test_prequest.py::Test_main::test_it\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test__get_mapper\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_bad_args\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_bad_format\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_class_view\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_config_format_ini_commas\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_config_format_ini_newlines\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_config_format_ini_spaces\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_good_args\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_good_format\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_no_mapper\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_no_routes\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_route_as_wsgiapp\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_route_no_view\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_route_with_no_slash_prefix\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_single_route_multiview_registered\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_single_route_no_route_registered\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_single_route_no_views_registered\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_single_route_one_view_registered_with_factory\nPASSED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_static_routes_included_in_list\nPASSED r2e_tests/test_scripts/test_proutes.py::Test_main::test_it\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test__guess_server_url\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_config_file_finds_open_url\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_config_vars_no_command\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_parse_vars_bad\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_parse_vars_good\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_reload_call_hupper_with_correct_args\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_run_no_args\nPASSED r2e_tests/test_scripts/test_pserve.py::Test_main::test_it\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_command_custom_section_override\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_command_default_shell_option\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_command_errors_with_unknown_shell\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_command_loads_check_variable_override_order\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_command_loads_custom_items\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_command_loads_default_shell\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_command_loads_ipython\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_command_loads_pythonstartup\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_command_loads_setup_from_options\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_command_setup\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_list_shells\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_shell_entry_points\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_shell_ordering\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_shell_override\nPASSED r2e_tests/test_scripts/test_pshell.py::Test_python_shell_runner::test_it\nPASSED r2e_tests/test_scripts/test_pshell.py::Test_main::test_it\nPASSED r2e_tests/test_scripts/test_ptweens.py::TestPTweensCommand::test__get_tweens\nPASSED r2e_tests/test_scripts/test_ptweens.py::TestPTweensCommand::test_command_implicit_and_explicit_tweens\nPASSED r2e_tests/test_scripts/test_ptweens.py::TestPTweensCommand::test_command_implicit_tweens_only\nPASSED r2e_tests/test_scripts/test_ptweens.py::TestPTweensCommand::test_command_no_tweens\nPASSED r2e_tests/test_scripts/test_ptweens.py::Test_main::test_it\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test__find_multi_routes_all_match\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test__find_multi_routes_none_match\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test__find_multi_routes_some_match\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test__find_view_no_match\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test__find_view_no_match_multiview_registered\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test__find_view_route_multiview\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test__find_view_route_multiview_no_view_registered\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test__find_view_route_no_multiview\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test__find_view_traversal\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test__find_view_traversal_multiview\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test_views_command_multi_view_nested\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test_views_command_multiview\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test_views_command_multiview_with_permission\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test_views_command_multiview_with_predicates\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test_views_command_not_found\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test_views_command_not_found_url_starts_without_slash\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test_views_command_single_view_route\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test_views_command_single_view_route_with_route_predicates\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test_views_command_single_view_traversal\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test_views_command_single_view_traversal_with_permission\nPASSED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test_views_command_single_view_traversal_with_predicates\nPASSED r2e_tests/test_scripts/test_pviews.py::Test_main::test_it\nFAILED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_no_registry - Assert...\nFAILED r2e_tests/test_1.py::ConfiguratorTests::test_ctor_noreg_debug_logger_None_default\nFAILED r2e_tests/test_1.py::ConfiguratorTests::test_include_constant_root_package\nFAILED r2e_tests/test_1.py::ConfiguratorTests::test_include_threadlocals_active\nFAILED r2e_tests/test_1.py::ConfiguratorTests::test_scan_integration_conflict\nFAILED r2e_tests/test_1.py::ConfiguratorTests::test_scan_integration_with_onerror\nFAILED r2e_tests/test_1.py::ConfiguratorTests::test_setup_registry_debug_logger_None_default\nFAILED r2e_tests/test_1.py::TestConfigurator_add_directive::test_add_directive_with_custom_callable\nFAILED r2e_tests/test_1.py::TestConfigurator_add_directive::test_add_directive_with_partial\nFAILED r2e_tests/test_1.py::TestConfigurator_add_directive::test_extend_with_dotted_name\nFAILED r2e_tests/test_1.py::TestConfigurator_add_directive::test_extend_with_python_callable\nFAILED r2e_tests/test_1.py::TestConfigurator__add_predicate::test_factory_as_dotted_name\nFAILED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_resource_url_adapter_dotted_names\nFAILED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_resource_url_adapter_introspectables\nFAILED r2e_tests/test_config/test_adapters.py::AdaptersConfiguratorMixinTests::test_add_traverser_dotted_names\nFAILED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_directory_with_directory\nFAILED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_directory_with_package\nFAILED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_file_with_file\nFAILED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_package_with_directory\nFAILED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_package_with_package\nFAILED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_get_resource_filename_no_overrides\nFAILED r2e_tests/test_config/test_assets.py::TestOverrideProvider::test_get_resource_filename_override_returns_None\nFAILED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_get_filename\nFAILED r2e_tests/test_config/test_assets.py::TestPackageAssetSource::test_get_filename_with_prefix\nFAILED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_add_translation_dirs_abspath\nFAILED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_add_translation_dirs_asset_spec\nFAILED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_add_translation_dirs_asset_spec_existing_translation_dirs\nFAILED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_add_translation_dirs_doesnt_use_override_w_autocommit\nFAILED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_add_translation_dirs_multiple_specs\nFAILED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_add_translation_dirs_multiple_specs_multiple_calls\nFAILED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_add_translation_dirs_override_multiple_specs_multiple_calls\nFAILED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_add_translation_dirs_uses_override_out_of_order\nFAILED r2e_tests/test_config/test_i18n.py::TestI18NConfiguratorMixin::test_add_translation_dirs_uses_override_w_autocommit\nFAILED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_no_registry\nFAILED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_ctor_noreg_debug_logger_None_default\nFAILED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_include_constant_root_package\nFAILED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_include_threadlocals_active\nFAILED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_scan_integration_conflict\nFAILED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_debug_logger_None_default\nFAILED r2e_tests/test_config/test_init.py::TestConfigurator_add_directive::test_add_directive_with_custom_callable\nFAILED r2e_tests/test_config/test_init.py::TestConfigurator_add_directive::test_add_directive_with_partial\nFAILED r2e_tests/test_config/test_init.py::TestConfigurator_add_directive::test_extend_with_dotted_name\nFAILED r2e_tests/test_config/test_init.py::TestConfigurator_add_directive::test_extend_with_python_callable\nFAILED r2e_tests/test_config/test_init.py::TestConfigurator__add_predicate::test_factory_as_dotted_name\nFAILED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_static_view_package_here_relative\nFAILED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_template_renderer\nFAILED r2e_tests/test_config/test_views.py::TestViewsConfigurationMixin::test_add_view_with_template_renderer_no_callable\nFAILED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_generate_url_cachebust_with_overrides\nFAILED r2e_tests/test_config/test_views.py::Test_view_description::test_without_text\nFAILED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_one_route_all_methods_view_only_post\nFAILED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_one_route_only_post_view_all_methods\nFAILED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_one_route_only_post_view_post_and_get\nFAILED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_one_route_with_long_name_one_view_registered\nFAILED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_route_is_get_view_request_method_not_post\nFAILED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_route_request_method_mismatch\nFAILED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_route_static_views\nFAILED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_single_route_one_view_registered\nFAILED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_view_glob\nFAILED r2e_tests/test_scripts/test_proutes.py::TestPRoutesCommand::test_view_request_method_not_post\nFAILED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_config_file_finds_watch_files\nFAILED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test_views_command_single_view_function_traversal\n======================== 61 failed, 917 passed in 5.25s ========================\n",
    "old_commit_res_stderr": ""
}
CHANGES.txt pyramid/config/__init__.py pyramid/tests/test_config/test_init.py
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]
**Title:** Thread locals are inactive during `config.include` executions

**Description**
When using the `config.include` function to include configuration modules, the thread-local registry is not active. This causes functions executed within `config.include` to retrieve an incorrect registry instance, leading to unexpected behavior.

**Example Code**
```python
from pyramid.config import Configurator
from pyramid.threadlocal import get_current_registry

def include_function(config):
    registry = get_current_registry()
    # Expecting registry to be the current Configurator's registry
    print(registry)

config = Configurator()
config.include(include_function)
```

**Expected Behavior**
Within the `include_function`, `get_current_registry()` should return the current `Configurator`'s registry instance, ensuring that all thread-local operations are correctly associated with the active configuration.

**Actual Behavior**
`get_current_registry()` does not return the expected registry instance inside the `include_function`, indicating that thread locals are not active during the execution of `config.include`. This leads to inconsistencies and potential errors in configuration-dependent operations.

[/ISSUE]
--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.

--- BEGIN FILE ---
```
### pyramid/config/__init__.py
import inspect
import itertools
import logging
import operator
import os
import sys
import threading
import venusian

from webob.exc import WSGIHTTPException as WebobWSGIHTTPException

from pyramid.interfaces import (
    IDebugLogger,
    IExceptionResponse,
    IPredicateList,
    PHASE0_CONFIG,
    PHASE1_CONFIG,
    PHASE2_CONFIG,
    PHASE3_CONFIG,
    )

from pyramid.asset import resolve_asset_spec

from pyramid.authorization import ACLAuthorizationPolicy

from pyramid.compat import (
    text_,
    reraise,
    string_types,
    )

from pyramid.events import ApplicationCreated

from pyramid.exceptions import (
    ConfigurationConflictError,
    ConfigurationError,
    ConfigurationExecutionError,
    )

from pyramid.httpexceptions import default_exceptionresponse_view

from pyramid.path import (
    caller_package,
    package_of,
    )

from pyramid.registry import (
    Introspectable,
    Introspector,
    Registry,
    undefer,
    )

from pyramid.router import Router

from pyramid.settings import aslist

from pyramid.threadlocal import manager

from pyramid.util import (
    ActionInfo,
    WeakOrderedSet,
    action_method,
    object_description,
    )

from pyramid.config.adapters import AdaptersConfiguratorMixin
from pyramid.config.assets import AssetsConfiguratorMixin
from pyramid.config.factories import FactoriesConfiguratorMixin
from pyramid.config.i18n import I18NConfiguratorMixin
from pyramid.config.rendering import RenderingConfiguratorMixin
from pyramid.config.routes import RoutesConfiguratorMixin
from pyramid.config.security import SecurityConfiguratorMixin
from pyramid.config.settings import SettingsConfiguratorMixin
from pyramid.config.testing import TestingConfiguratorMixin
from pyramid.config.tweens import TweensConfiguratorMixin
from pyramid.config.util import PredicateList, not_
from pyramid.config.views import ViewsConfiguratorMixin
from pyramid.config.zca import ZCAConfiguratorMixin

from pyramid.path import DottedNameResolver

empty = text_('')
_marker = object()

ConfigurationError = ConfigurationError # pyflakes

not_ = not_ # pyflakes, this is an API

PHASE0_CONFIG = PHASE0_CONFIG  # api
PHASE1_CONFIG = PHASE1_CONFIG  # api
PHASE2_CONFIG = PHASE2_CONFIG  # api
PHASE3_CONFIG = PHASE3_CONFIG  # api

class Configurator(
    TestingConfiguratorMixin,
    TweensConfiguratorMixin,
    SecurityConfiguratorMixin,
    ViewsConfiguratorMixin,
    RoutesConfiguratorMixin,
    ZCAConfiguratorMixin,
    I18NConfiguratorMixin,
    RenderingConfiguratorMixin,
    AssetsConfiguratorMixin,
    SettingsConfiguratorMixin,
    FactoriesConfiguratorMixin,
    AdaptersConfiguratorMixin,
    ):
    """
    A Configurator is used to configure a :app:`Pyramid`
    :term:`application registry`.

    If the ``registry`` argument is not ``None``, it must
    be an instance of the :class:`pyramid.registry.Registry` class
    representing the registry to configure.  If ``registry`` is ``None``, the
    configurator will create a :class:`pyramid.registry.Registry` instance
    itself; it will also perform some default configuration that would not
    otherwise be done.  After its construction, the configurator may be used
    to add further configuration to the registry.

    .. warning:: If ``registry`` is assigned the above-mentioned class
       instance, all other constructor arguments are ignored,
       with the exception of ``package``.

    If the ``package`` argument is passed, it must be a reference to a Python
    :term:`package` (e.g. ``sys.modules['thepackage']``) or a :term:`dotted
    Python name` to the same.  This value is used as a basis to convert
    relative paths passed to various configuration methods, such as methods
    which accept a ``renderer`` argument, into absolute paths.  If ``None``
    is passed (the default), the package is assumed to be the Python package
    in which the *caller* of the ``Configurator`` constructor lives.

    If the ``root_package`` is passed, it will propagate through the
    configuration hierarchy as a way for included packages to locate
    resources relative to the package in which the main ``Configurator`` was
    created. If ``None`` is passed (the default), the ``root_package`` will
    be derived from the ``package`` argument. The ``package`` attribute is
    always pointing at the package being included when using :meth:`.include`,
    whereas the ``root_package`` does not change.

    If the ``settings`` argument is passed, it should be a Python dictionary
    representing the :term:`deployment settings` for this application.  These
    are later retrievable using the
    :attr:`pyramid.registry.Registry.settings` attribute (aka
    ``request.registry.settings``).

    If the ``root_factory`` argument is passed, it should be an object
    representing the default :term:`root factory` for your application or a
    :term:`dotted Python name` to the same.  If it is ``None``, a default
    root factory will be used.

    If ``authentication_policy`` is passed, it should be an instance
    of an :term:`authentication policy` or a :term:`dotted Python
    name` to the same.

    If ``authorization_policy`` is passed, it should be an instance of
    an :term:`authorization policy` or a :term:`dotted Python name` to
    the same.

    .. note:: A ``ConfigurationError`` will be raised when an
       authorization policy is supplied without also supplying an
       authentication policy (authorization requires authentication).

    If ``renderers`` is ``None`` (the default), a default set of
    :term:`renderer` factories is used. Else, it should be a list of
    tuples representing a set of renderer factories which should be
    configured into this application, and each tuple representing a set of
    positional values that should be passed to
    :meth:`pyramid.config.Configurator.add_renderer`.

    If ``debug_logger`` is not passed, a default debug logger that logs to a
    logger will be used (the logger name will be the package name of the
    *caller* of this configurator).  If it is passed, it should be an
    instance of the :class:`logging.Logger` (PEP 282) standard library class
    or a Python logger name.  The debug logger is used by :app:`Pyramid`
    itself to log warnings and authorization debugging information.

    If ``locale_negotiator`` is passed, it should be a :term:`locale
    negotiator` implementation or a :term:`dotted Python name` to
    same.  See :ref:`custom_locale_negotiator`.

    If ``request_factory`` is passed, it should be a :term:`request
    factory` implementation or a :term:`dotted Python name` to the same.
    See :ref:`changing_the_request_factory`.  By default it is ``None``,
    which means use the default request factory.

    If ``response_factory`` is passed, it should be a :term:`response
    factory` implementation or a :term:`dotted Python name` to the same.
    See :ref:`changing_the_response_factory`.  By default it is ``None``,
    which means use the default response factory.

    If ``default_permission`` is passed, it should be a
    :term:`permission` string to be used as the default permission for
    all view configuration registrations performed against this
    Configurator.  An example of a permission string:``'view'``.
    Adding a default permission makes it unnecessary to protect each
    view configuration with an explicit permission, unless your
    application policy requires some exception for a particular view.
    By default, ``default_permission`` is ``None``, meaning that view
    configurations which do not explicitly declare a permission will
    always be executable by entirely anonymous users (any
    authorization policy in effect is ignored).

    .. seealso::

        See also :ref:`setting_a_default_permission`.

    If ``session_factory`` is passed, it should be an object which
    implements the :term:`session factory` interface.  If a nondefault
    value is passed, the ``session_factory`` will be used to create a
    session object when ``request.session`` is accessed.  Note that
    the same outcome can be achieved by calling
    :meth:`pyramid.config.Configurator.set_session_factory`.  By
    default, this argument is ``None``, indicating that no session
    factory will be configured (and thus accessing ``request.session``
    will throw an error) unless ``set_session_factory`` is called later
    during configuration.

    If ``autocommit`` is ``True``, every method called on the configurator
    will cause an immediate action, and no configuration conflict detection
    will be used. If ``autocommit`` is ``False``, most methods of the
    configurator will defer their action until
    :meth:`pyramid.config.Configurator.commit` is called.  When
    :meth:`pyramid.config.Configurator.commit` is called, the actions implied
    by the called methods will be checked for configuration conflicts unless
    ``autocommit`` is ``True``.  If a conflict is detected, a
    ``ConfigurationConflictError`` will be raised.  Calling
    :meth:`pyramid.config.Configurator.make_wsgi_app` always implies a final
    commit.

    If ``default_view_mapper`` is passed, it will be used as the default
    :term:`view mapper` factory for view configurations that don't otherwise
    specify one (see :class:`pyramid.interfaces.IViewMapperFactory`).  If
    ``default_view_mapper`` is not passed, a superdefault view mapper will be
    used.

    If ``exceptionresponse_view`` is passed, it must be a :term:`view
    callable` or ``None``.  If it is a view callable, it will be used as an
    exception view callable when an :term:`exception response` is raised. If
    ``exceptionresponse_view`` is ``None``, no exception response view will
    be registered, and all raised exception responses will be bubbled up to
    Pyramid's caller.  By
    default, the ``pyramid.httpexceptions.default_exceptionresponse_view``
    function is used as the ``exceptionresponse_view``.

    If ``route_prefix`` is passed, all routes added with
    :meth:`pyramid.config.Configurator.add_route` will have the specified path
    prepended to their pattern.

    If ``introspection`` is passed, it must be a boolean value.  If it's
    ``True``, introspection values during actions will be kept for use
    for tools like the debug toolbar.  If it's ``False``, introspection
    values provided by registrations will be ignored.  By default, it is
    ``True``.

    .. versionadded:: 1.1
       The ``exceptionresponse_view`` argument.

    .. versionadded:: 1.2
       The ``route_prefix`` argument.

    .. versionadded:: 1.3
       The ``introspection`` argument.

    .. versionadded:: 1.6
       The ``root_package`` argument.
       The ``response_factory`` argument.
    """
    manager = manager # for testing injection
    venusian = venusian # for testing injection
    _ainfo = None
    basepath = None
    includepath = ()
    info = ''
    object_description = staticmethod(object_description)
    introspectable = Introspectable
    inspect = inspect

    def __init__(self,
                 registry=None,
                 package=None,
                 settings=None,
                 root_factory=None,
                 authentication_policy=None,
                 authorization_policy=None,
                 renderers=None,
                 debug_logger=None,
                 locale_negotiator=None,
                 request_factory=None,
                 response_factory=None,
                 default_permission=None,
                 session_factory=None,
                 default_view_mapper=None,
                 autocommit=False,
                 exceptionresponse_view=default_exceptionresponse_view,
                 route_prefix=None,
                 introspection=True,
                 root_package=None,
                 ):
        if package is None:
            package = caller_package()
        if root_package is None:
            root_package = package
        name_resolver = DottedNameResolver(package)
        self.name_resolver = name_resolver
        self.package_name = name_resolver.get_package_name()
        self.package = name_resolver.get_package()
        self.root_package = root_package
        self.registry = registry
        self.autocommit = autocommit
        self.route_prefix = route_prefix
        self.introspection = introspection
        if registry is None:
            registry = Registry(self.package_name)
            self.registry = registry
            self.setup_registry(
                settings=settings,
                root_factory=root_factory,
                authentication_policy=authentication_policy,
                authorization_policy=authorization_policy,
                renderers=renderers,
                debug_logger=debug_logger,
                locale_negotiator=locale_negotiator,
                request_factory=request_factory,
                response_factory=response_factory,
                default_permission=default_permission,
                session_factory=session_factory,
                default_view_mapper=default_view_mapper,
                exceptionresponse_view=exceptionresponse_view,
                )

    def setup_registry(self,
                       settings=None,
                       root_factory=None,
                       authentication_policy=None,
                       authorization_policy=None,
                       renderers=None,
                       debug_logger=None,
                       locale_negotiator=None,
                       request_factory=None,
                       response_factory=None,
                       default_permission=None,
                       session_factory=None,
                       default_view_mapper=None,
                       exceptionresponse_view=default_exceptionresponse_view,
                       ):
        """ When you pass a non-``None`` ``registry`` argument to the
        :term:`Configurator` constructor, no initial setup is performed
        against the registry.  This is because the registry you pass in may
        have already been initialized for use under :app:`Pyramid` via a
        different configurator.  However, in some circumstances (such as when
        you want to use a global registry instead of a registry created as a
        result of the Configurator constructor), or when you want to reset
        the initial setup of a registry, you *do* want to explicitly
        initialize the registry associated with a Configurator for use under
        :app:`Pyramid`.  Use ``setup_registry`` to do this initialization.

        ``setup_registry`` configures settings, a root factory, security
        policies, renderers, a debug logger, a locale negotiator, and various
        other settings using the configurator's current registry, as per the
        descriptions in the Configurator constructor."""

        registry = self.registry

        self._fix_registry()

        self._set_settings(settings)

        if isinstance(debug_logger, string_types):
            debug_logger = logging.getLogger(debug_logger)

        if debug_logger is None:
            debug_logger = logging.getLogger(self.package_name)

        registry.registerUtility(debug_logger, IDebugLogger)

        self.add_default_response_adapters()
        self.add_default_renderers()
        self.add_default_view_predicates()
        self.add_default_view_derivers()
        self.add_default_route_predicates()
        self.add_default_tweens()

        if exceptionresponse_view is not None:
            exceptionresponse_view = self.maybe_dotted(exceptionresponse_view)
            self.add_view(exceptionresponse_view, context=IExceptionResponse)
            self.add_view(exceptionresponse_view,context=WebobWSGIHTTPException)

        # commit below because:
        #
        # - the default exceptionresponse_view requires the superdefault view
        #   mapper, so we need to configure it before adding default_view_mapper
        #
        # - superdefault renderers should be overrideable without requiring
        #   the user to commit before calling config.add_renderer

        self.commit()

        # self.commit() should not be called within this method after this
        # point because the following registrations should be treated as
        # analogues of methods called by the user after configurator
        # construction.  Rationale: user-supplied implementations should be
        # preferred rather than add-on author implementations with the help of
        # automatic conflict resolution.

        if authentication_policy and not authorization_policy:
            authorization_policy = ACLAuthorizationPolicy() # default

        if authorization_policy:
            self.set_authorization_policy(authorization_policy)

        if authentication_policy:
            self.set_authentication_policy(authentication_policy)

        if default_view_mapper is not None:
            self.set_view_mapper(default_view_mapper)

        if renderers:
            for name, renderer in renderers:
                self.add_renderer(name, renderer)

        if root_factory is not None:
            self.set_root_factory(root_factory)

        if locale_negotiator:
            self.set_locale_negotiator(locale_negotiator)

        if request_factory:
            self.set_request_factory(request_factory)

        if response_factory:
            self.set_response_factory(response_factory)

        if default_permission:
            self.set_default_permission(default_permission)

        if session_factory is not None:
            self.set_session_factory(session_factory)

        tweens = aslist(registry.settings.get('pyramid.tweens', []))
        for factory in tweens:
            self._add_tween(factory, explicit=True)

        includes = aslist(registry.settings.get('pyramid.includes', []))
        for inc in includes:
            self.include(inc)

    def _make_spec(self, path_or_spec):
        package, filename = resolve_asset_spec(path_or_spec, self.package_name)
        if package is None:
            return filename # absolute filename
        return '%s:%s' % (package, filename)

    def _fix_registry(self):
        """ Fix up a ZCA component registry that is not a
        pyramid.registry.Registry by adding analogues of ``has_listeners``,
        ``notify``, ``queryAdapterOrSelf``, and ``registerSelfAdapter``
        through monkey-patching."""

        _registry = self.registry

        if not hasattr(_registry, 'notify'):
            def notify(*events):
                [ _ for _ in _registry.subscribers(events, None) ]
            _registry.notify = notify

        if not hasattr(_registry, 'has_listeners'):
            _registry.has_listeners = True

        if not hasattr(_registry, 'queryAdapterOrSelf'):
            def queryAdapterOrSelf(object, interface, default=None):
                if not interface.providedBy(object):
                    return _registry.queryAdapter(object, interface,
                                                  default=default)
                return object
            _registry.queryAdapterOrSelf = queryAdapterOrSelf

        if not hasattr(_registry, 'registerSelfAdapter'):
            def registerSelfAdapter(required=None, provided=None,
                                    name=empty, info=empty, event=True):
                return _registry.registerAdapter(lambda x: x,
                                                 required=required,
                                                 provided=provided, name=name,
                                                 info=info, event=event)
            _registry.registerSelfAdapter = registerSelfAdapter

        if not hasattr(_registry, '_lock'):
            _registry._lock = threading.Lock()

        if not hasattr(_registry, '_clear_view_lookup_cache'):
            def _clear_view_lookup_cache():
                _registry._view_lookup_cache = {}
            _registry._clear_view_lookup_cache = _clear_view_lookup_cache


    # API

    def _get_introspector(self):
        introspector = getattr(self.registry, 'introspector', _marker)
        if introspector is _marker:
            introspector = Introspector()
            self._set_introspector(introspector)
        return introspector

    def _set_introspector(self, introspector):
        self.registry.introspector = introspector

    def _del_introspector(self):
        del self.registry.introspector

    introspector = property(
        _get_introspector, _set_introspector, _del_introspector
        )

    def get_predlist(self, name):
        predlist = self.registry.queryUtility(IPredicateList, name=name)
        if predlist is None:
            predlist = PredicateList()
            self.registry.registerUtility(predlist, IPredicateList, name=name)
        return predlist


    def _add_predicate(self, type, name, factory, weighs_more_than=None,
                       weighs_less_than=None):
        factory = self.maybe_dotted(factory)
        discriminator = ('%s option' % type, name)
        intr = self.introspectable(
            '%s predicates' % type,
            discriminator,
            '%s predicate named %s' % (type, name),
            '%s predicate' % type)
        intr['name'] = name
        intr['factory'] = factory
        intr['weighs_more_than'] = weighs_more_than
        intr['weighs_less_than'] = weighs_less_than
        def register():
            predlist = self.get_predlist(type)
            predlist.add(name, factory, weighs_more_than=weighs_more_than,
                         weighs_less_than=weighs_less_than)
        self.action(discriminator, register, introspectables=(intr,),
                    order=PHASE1_CONFIG) # must be registered early

    @property
    def action_info(self):
        info = self.info # usually a ZCML action (ParserInfo) if self.info
        if not info:
            # Try to provide more accurate info for conflict reports
            if self._ainfo:
                info = self._ainfo[0]
            else:
                info = ActionInfo(None, 0, '', '')
        return info

    def action(self, discriminator, callable=None, args=(), kw=None, order=0,
               introspectables=(), **extra):
        """ Register an action which will be executed when
        :meth:`pyramid.config.Configurator.commit` is called (or executed
        immediately if ``autocommit`` is ``True``).

        .. warning:: This method is typically only used by :app:`Pyramid`
           framework extension authors, not by :app:`Pyramid` application
           developers.

        The ``discriminator`` uniquely identifies the action.  It must be
        given, but it can be ``None``, to indicate that the action never
        conflicts.  It must be a hashable value.

        The ``callable`` is a callable object which performs the task
        associated with the action when the action is executed.  It is
        optional.

        ``args`` and ``kw`` are tuple and dict objects respectively, which
        are passed to ``callable`` when this action is executed.  Both are
        optional.

        ``order`` is a grouping mechanism; an action with a lower order will
        be executed before an action with a higher order (has no effect when
        autocommit is ``True``).

        ``introspectables`` is a sequence of :term:`introspectable` objects
        (or the empty sequence if no introspectable objects are associated
        with this action).  If this configurator's ``introspection``
        attribute is ``False``, these introspectables will be ignored.

        ``extra`` provides a facility for inserting extra keys and values
        into an action dictionary.
        """
        # catch nonhashable discriminators here; most unit tests use
        # autocommit=False, which won't catch unhashable discriminators
        assert hash(discriminator) 

        if kw is None:
            kw = {}

        autocommit = self.autocommit
        action_info = self.action_info

        if not self.introspection:
            # if we're not introspecting, ignore any introspectables passed
            # to us
            introspectables = ()

        if autocommit:
            # callables can depend on the side effects of resolving a
            # deferred discriminator
            self.begin()
            try:
                undefer(discriminator)
                if callable is not None:
                    callable(*args, **kw)
                for introspectable in introspectables:
                    introspectable.register(self.introspector, action_info)
            finally:
                self.end()

        else:
            action = extra
            action.update(
                dict(
                    discriminator=discriminator,
                    callable=callable,
                    args=args,
                    kw=kw,
                    order=order,
                    info=action_info,
                    includepath=self.includepath,
                    introspectables=introspectables,
                    )
                )
            self.action_state.action(**action)

    def _get_action_state(self):
        registry = self.registry
        try:
            state = registry.action_state
        except AttributeError:
            state = ActionState()
            registry.action_state = state
        return state

    def _set_action_state(self, state):
        self.registry.action_state = state

    action_state = property(_get_action_state, _set_action_state)

    _ctx = action_state # bw compat

    def commit(self):
        """ Commit any pending configuration actions. If a configuration
        conflict is detected in the pending configuration actions, this method
        will raise a :exc:`ConfigurationConflictError`; within the traceback
        of this error will be information about the source of the conflict,
        usually including file names and line numbers of the cause of the
        configuration conflicts."""
        self.begin()
        try:
            self.action_state.execute_actions(introspector=self.introspector)
        finally:
            self.end()
        self.action_state = ActionState() # old actions have been processed

    def include(self, callable, route_prefix=None):
        """Include a configuration callable, to support imperative
        application extensibility.

        .. warning:: In versions of :app:`Pyramid` prior to 1.2, this
            function accepted ``*callables``, but this has been changed
            to support only a single callable.

        A configuration callable should be a callable that accepts a single
        argument named ``config``, which will be an instance of a
        :term:`Configurator`.  However, be warned that it will not be the same
        configurator instance on which you call this method.  The
        code which runs as a result of calling the callable should invoke
        methods on the configurator passed to it which add configuration
        state.  The return value of a callable will be ignored.

        Values allowed to be presented via the ``callable`` argument to
        this method: any callable Python object or any :term:`dotted Python
        name` which resolves to a callable Python object.  It may also be a
        Python :term:`module`, in which case, the module will be searched for
        a callable named ``includeme``, which will be treated as the
        configuration callable.

        For example, if the ``includeme`` function below lives in a module
        named ``myapp.myconfig``:

        .. code-block:: python
           :linenos:

           # myapp.myconfig module

           def my_view(request):
               from pyramid.response import Response
               return Response('OK')

           def includeme(config):
               config.add_view(my_view)

        You might cause it to be included within your Pyramid application like
        so:

        .. code-block:: python
           :linenos:

           from pyramid.config import Configurator

           def main(global_config, **settings):
               config = Configurator()
               config.include('myapp.myconfig.includeme')

        Because the function is named ``includeme``, the function name can
        also be omitted from the dotted name reference:

        .. code-block:: python
           :linenos:

           from pyramid.config import Configurator

           def main(global_config, **settings):
               config = Configurator()
               config.include('myapp.myconfig')

        Included configuration statements will be overridden by local
        configuration statements if an included callable causes a
        configuration conflict by registering something with the same
        configuration parameters.

        If the ``route_prefix`` is supplied, it must be a string.  Any calls
        to :meth:`pyramid.config.Configurator.add_route` within the included
        callable will have their pattern prefixed with the value of
        ``route_prefix``. This can be used to help mount a set of routes at a
        different location than the included callable's author intended, while
        still maintaining the same route names.  For example:

        .. code-block:: python
           :linenos:

           from pyramid.config import Configurator

           def included(config):
               config.add_route('show_users', '/show')

           def main(global_config, **settings):
               config = Configurator()
               config.include(included, route_prefix='/users')

        In the above configuration, the ``show_users`` route will have an
        effective route pattern of ``/users/show``, instead of ``/show``
        because the ``route_prefix`` argument will be prepended to the
        pattern.

        .. versionadded:: 1.2
           The ``route_prefix`` parameter.

        """
        # """ <-- emacs

        action_state = self.action_state

        if route_prefix is None:
            route_prefix = ''

        old_route_prefix = self.route_prefix
        if old_route_prefix is None:
            old_route_prefix = ''

        route_prefix = '%s/%s' % (
            old_route_prefix.rstrip('/'),
            route_prefix.lstrip('/')
            )
        route_prefix = route_prefix.strip('/')
        if not route_prefix:
            route_prefix = None

        c = self.maybe_dotted(callable)
        module = self.inspect.getmodule(c)
        if module is c:
            try:
                c = getattr(module, 'includeme')
            except AttributeError:
                raise ConfigurationError(
                    "module %r has no attribute 'includeme'" % (module.__name__)
                    )
                                                       
        spec = module.__name__ + ':' + c.__name__
        sourcefile = self.inspect.getsourcefile(c)

        if sourcefile is None:
            raise ConfigurationError(
                'No source file for module %r (.py file must exist, '
                'refusing to use orphan .pyc or .pyo file).' % module.__name__)
            

        if action_state.processSpec(spec):
            configurator = self.__class__(
                registry=self.registry,
                package=package_of(module),
                root_package=self.root_package,
                autocommit=self.autocommit,
                route_prefix=route_prefix,
                )
            configurator.basepath = os.path.dirname(sourcefile)
            configurator.includepath = self.includepath + (spec,)
            c(configurator)

    def add_directive(self, name, directive, action_wrap=True):
        """
        Add a directive method to the configurator.

        .. warning:: This method is typically only used by :app:`Pyramid`
           framework extension authors, not by :app:`Pyramid` application
           developers.

        Framework extenders can add directive methods to a configurator by
        instructing their users to call ``config.add_directive('somename',
        'some.callable')``.  This will make ``some.callable`` accessible as
        ``config.somename``.  ``some.callable`` should be a function which
        accepts ``config`` as a first argument, and arbitrary positional and
        keyword arguments following.  It should use config.action as
        necessary to perform actions.  Directive methods can then be invoked
        like 'built-in' directives such as ``add_view``, ``add_route``, etc.

        The ``action_wrap`` argument should be ``True`` for directives which
        perform ``config.action`` with potentially conflicting
        discriminators.  ``action_wrap`` will cause the directive to be
        wrapped in a decorator which provides more accurate conflict
        cause information.

        ``add_directive`` does not participate in conflict detection, and
        later calls to ``add_directive`` will override earlier calls.
        """
        c = self.maybe_dotted(directive)
        if not hasattr(self.registry, '_directives'):
            self.registry._directives = {}
        self.registry._directives[name] = (c, action_wrap)

    def __getattr__(self, name):
        # allow directive extension names to work
        directives = getattr(self.registry, '_directives', {})
        c = directives.get(name)
        if c is None:
            raise AttributeError(name)
        c, action_wrap = c
        if action_wrap:
            c = action_method(c)
        # Create a bound method (works on both Py2 and Py3)
        # http://stackoverflow.com/a/1015405/209039
        m = c.__get__(self, self.__class__)
        return m

    def with_package(self, package):
        """ Return a new Configurator instance with the same registry
        as this configurator. ``package`` may be an actual Python package
        object or a :term:`dotted Python name` representing a package."""
        configurator = self.__class__(
            registry=self.registry,
            package=package,
            root_package=self.root_package,
            autocommit=self.autocommit,
            route_prefix=self.route_prefix,
            introspection=self.introspection,
            )
        configurator.basepath = self.basepath
        configurator.includepath = self.includepath
        configurator.info = self.info
        return configurator

    def maybe_dotted(self, dotted):
        """ Resolve the :term:`dotted Python name` ``dotted`` to a
        global Python object.  If ``dotted`` is not a string, return
        it without attempting to do any name resolution.  If
        ``dotted`` is a relative dotted name (e.g. ``.foo.bar``,
        consider it relative to the ``package`` argument supplied to
        this Configurator's constructor."""
        return self.name_resolver.maybe_resolve(dotted)

    def absolute_asset_spec(self, relative_spec):
        """ Resolve the potentially relative :term:`asset
        specification` string passed as ``relative_spec`` into an
        absolute asset specification string and return the string.
        Use the ``package`` of this configurator as the package to
        which the asset specification will be considered relative
        when generating an absolute asset specification.  If the
        provided ``relative_spec`` argument is already absolute, or if
        the ``relative_spec`` is not a string, it is simply returned."""
        if not isinstance(relative_spec, string_types):
            return relative_spec
        return self._make_spec(relative_spec)

    absolute_resource_spec = absolute_asset_spec # b/w compat forever

    def begin(self, request=_marker):
        """ Indicate that application or test configuration has begun.
        This pushes a dictionary containing the :term:`application
        registry` implied by ``registry`` attribute of this
        configurator and the :term:`request` implied by the
        ``request`` argument onto the :term:`thread local` stack
        consulted by various :mod:`pyramid.threadlocal` API
        functions.

        If ``request`` is not specified and the registry owned by the
        configurator is already pushed as the current threadlocal registry
        then this method will keep the current threadlocal request unchanged.

        .. versionchanged:: 1.8
           The current threadlocal request is propagated if the current
           threadlocal registry remains unchanged.

        """
        if request is _marker:
            current = self.manager.get()
            if current['registry'] == self.registry:
                request = current['request']
            else:
                request = None
        self.manager.push({'registry':self.registry, 'request':request})

    def end(self):
        """ Indicate that application or test configuration has ended.
        This pops the last value pushed onto the :term:`thread local`
        stack (usually by the ``begin`` method) and returns that
        value.
        """
        return self.manager.pop()

    # this is *not* an action method (uses caller_package)
    def scan(self, package=None, categories=None, onerror=None, ignore=None,
             **kw):
        """Scan a Python package and any of its subpackages for objects
        marked with :term:`configuration decoration` such as
        :class:`pyramid.view.view_config`.  Any decorated object found will
        influence the current configuration state.

        The ``package`` argument should be a Python :term:`package` or module
        object (or a :term:`dotted Python name` which refers to such a
        package or module).  If ``package`` is ``None``, the package of the
        *caller* is used.

        The ``categories`` argument, if provided, should be the
        :term:`Venusian` 'scan categories' to use during scanning.  Providing
        this argument is not often necessary; specifying scan categories is
        an extremely advanced usage.  By default, ``categories`` is ``None``
        which will execute *all* Venusian decorator callbacks including
        :app:`Pyramid`-related decorators such as
        :class:`pyramid.view.view_config`.  See the :term:`Venusian`
        documentation for more information about limiting a scan by using an
        explicit set of categories.

        The ``onerror`` argument, if provided, should be a Venusian
        ``onerror`` callback function.  The onerror function is passed to
        :meth:`venusian.Scanner.scan` to influence error behavior when an
        exception is raised during the scanning process.  See the
        :term:`Venusian` documentation for more information about ``onerror``
        callbacks.

        The ``ignore`` argument, if provided, should be a Venusian ``ignore``
        value.  Providing an ``ignore`` argument allows the scan to ignore
        particular modules, packages, or global objects during a scan.
        ``ignore`` can be a string or a callable, or a list containing
        strings or callables.  The simplest usage of ``ignore`` is to provide
        a module or package by providing a full path to its dotted name.  For
        example: ``config.scan(ignore='my.module.subpackage')`` would ignore
        the ``my.module.subpackage`` package during a scan, which would
        prevent the subpackage and any of its submodules from being imported
        and scanned.  See the :term:`Venusian` documentation for more
        information about the ``ignore`` argument.

        To perform a ``scan``, Pyramid creates a Venusian ``Scanner`` object.
        The ``kw`` argument represents a set of keyword arguments to pass to
        the Venusian ``Scanner`` object's constructor.  See the
        :term:`venusian` documentation (its ``Scanner`` class) for more
        information about the constructor.  By default, the only keyword
        arguments passed to the Scanner constructor are ``{'config':self}``
        where ``self`` is this configurator object.  This services the
        requirement of all built-in Pyramid decorators, but extension systems
        may require additional arguments.  Providing this argument is not
        often necessary; it's an advanced usage.

        .. versionadded:: 1.1
           The ``**kw`` argument.

        .. versionadded:: 1.3
           The ``ignore`` argument.

        """
        package = self.maybe_dotted(package)
        if package is None: # pragma: no cover
            package = caller_package()

        ctorkw = {'config': self}
        ctorkw.update(kw)

        scanner = self.venusian.Scanner(**ctorkw)

        scanner.scan(package, categories=categories, onerror=onerror,
                     ignore=ignore)

    def make_wsgi_app(self):
        """ Commits any pending configuration statements, sends a
        :class:`pyramid.events.ApplicationCreated` event to all listeners,
        adds this configuration's registry to
        :attr:`pyramid.config.global_registries`, and returns a
        :app:`Pyramid` WSGI application representing the committed
        configuration state."""
        self.commit()
        app = Router(self.registry)

        # Allow tools like "pshell development.ini" to find the 'last'
        # registry configured.
        global_registries.add(self.registry)

        # Push the registry onto the stack in case any code that depends on
        # the registry threadlocal APIs used in listeners subscribed to the
        # IApplicationCreated event.
        self.begin()
        try:
            self.registry.notify(ApplicationCreated(app))
        finally:
            self.end()

        return app


# this class is licensed under the ZPL (stolen from Zope)
class ActionState(object):
    def __init__(self):
        # NB "actions" is an API, dep'd upon by pyramid_zcml's load_zcml func
        self.actions = []
        self._seen_files = set()

    def processSpec(self, spec):
        """Check whether a callable needs to be processed.  The ``spec``
        refers to a unique identifier for the callable.

        Return True if processing is needed and False otherwise. If
        the callable needs to be processed, it will be marked as
        processed, assuming that the caller will procces the callable if
        it needs to be processed.
        """
        if spec in self._seen_files:
            return False
        self._seen_files.add(spec)
        return True

    def action(self, discriminator, callable=None, args=(), kw=None, order=0,
               includepath=(), info=None, introspectables=(), **extra):
        """Add an action with the given discriminator, callable and arguments
        """
        if kw is None:
            kw = {}
        action = extra
        action.update(
            dict(
                discriminator=discriminator,
                callable=callable,
                args=args,
                kw=kw,
                includepath=includepath,
                info=info,
                order=order,
                introspectables=introspectables,
                )
            )
        self.actions.append(action)

    def execute_actions(self, clear=True, introspector=None):
        """Execute the configuration actions

        This calls the action callables after resolving conflicts

        For example:

        >>> output = []
        >>> def f(*a, **k):
        ...    output.append(('f', a, k))
        >>> context = ActionState()
        >>> context.actions = [
        ...   (1, f, (1,)),
        ...   (1, f, (11,), {}, ('x', )),
        ...   (2, f, (2,)),
        ...   ]
        >>> context.execute_actions()
        >>> output
        [('f', (1,), {}), ('f', (2,), {})]

        If the action raises an error, we convert it to a
        ConfigurationExecutionError.

        >>> output = []
        >>> def bad():
        ...    bad.xxx
        >>> context.actions = [
        ...   (1, f, (1,)),
        ...   (1, f, (11,), {}, ('x', )),
        ...   (2, f, (2,)),
        ...   (3, bad, (), {}, (), 'oops')
        ...   ]
        >>> try:
        ...    v = context.execute_actions()
        ... except ConfigurationExecutionError, v:
        ...    pass
        >>> print(v)
        exceptions.AttributeError: 'function' object has no attribute 'xxx'
          in:
          oops

        Note that actions executed before the error still have an effect:

        >>> output
        [('f', (1,), {}), ('f', (2,), {})]

        The execution is re-entrant such that actions may be added by other
        actions with the one caveat that the order of any added actions must
        be equal to or larger than the current action.

        >>> output = []
        >>> def f(*a, **k):
        ...   output.append(('f', a, k))
        ...   context.actions.append((3, g, (8,), {}))
        >>> def g(*a, **k):
        ...    output.append(('g', a, k))
        >>> context.actions = [
        ...   (1, f, (1,)),
        ...   ]
        >>> context.execute_actions()
        >>> output
        [('f', (1,), {}), ('g', (8,), {})]

        """
        try:
            all_actions = []
            executed_actions = []
            action_iter = iter([])
            conflict_state = ConflictResolverState()

            while True:
                # We clear the actions list prior to execution so if there
                # are some new actions then we add them to the mix and resolve
                # conflicts again. This orders the new actions as well as
                # ensures that the previously executed actions have no new
                # conflicts.
                if self.actions:
                    all_actions.extend(self.actions)
                    action_iter = resolveConflicts(
                        self.actions,
                        state=conflict_state,
                    )
                    self.actions = []

                action = next(action_iter, None)
                if action is None:
                    # we are done!
                    break

                callable = action['callable']
                args = action['args']
                kw = action['kw']
                info = action['info']
                # we use "get" below in case an action was added via a ZCML
                # directive that did not know about introspectables
                introspectables = action.get('introspectables', ())

                try:
                    if callable is not None:
                        callable(*args, **kw)
                except Exception:
                    t, v, tb = sys.exc_info()
                    try:
                        reraise(ConfigurationExecutionError,
                                ConfigurationExecutionError(t, v, info),
                                tb)
                    finally:
                        del t, v, tb

                if introspector is not None:
                    for introspectable in introspectables:
                        introspectable.register(introspector, info)

                executed_actions.append(action)

            self.actions = all_actions
            return executed_actions

        finally:
            if clear:
                self.actions = []


class ConflictResolverState(object):
    def __init__(self):
        # keep a set of resolved discriminators to test against to ensure
        # that a new action does not conflict with something already executed
        self.resolved_ainfos = {}

        # actions left over from a previous iteration
        self.remaining_actions = []

        # after executing an action we memoize its order to avoid any new
        # actions sending us backward
        self.min_order = None

        # unique tracks the index of the action so we need it to increase
        # monotonically across invocations to resolveConflicts
        self.start = 0


# this function is licensed under the ZPL (stolen from Zope)
def resolveConflicts(actions, state=None):
    """Resolve conflicting actions

    Given an actions list, identify and try to resolve conflicting actions.
    Actions conflict if they have the same non-None discriminator.

    Conflicting actions can be resolved if the include path of one of
    the actions is a prefix of the includepaths of the other
    conflicting actions and is unequal to the include paths in the
    other conflicting actions.

    Actions are resolved on a per-order basis because some discriminators
    cannot be computed until earlier actions have executed. An action in an
    earlier order may execute successfully only to find out later that it was
    overridden by another action with a smaller include path. This will result
    in a conflict as there is no way to revert the original action.

    ``state`` may be an instance of ``ConflictResolverState`` that
    can be used to resume execution and resolve the new actions against the
    list of executed actions from a previous call.

    """
    if state is None:
        state = ConflictResolverState()

    # pick up where we left off last time, but track the new actions as well
    state.remaining_actions.extend(normalize_actions(actions))
    actions = state.remaining_actions

    def orderandpos(v):
        n, v = v
        return (v['order'] or 0, n)

    def orderonly(v):
        n, v = v
        return v['order'] or 0

    sactions = sorted(enumerate(actions, start=state.start), key=orderandpos)
    for order, actiongroup in itertools.groupby(sactions, orderonly):
        # "order" is an integer grouping. Actions in a lower order will be
        # executed before actions in a higher order.  All of the actions in
        # one grouping will be executed (its callable, if any will be called)
        # before any of the actions in the next.
        output = []
        unique = {}

        # error out if we went backward in order
        if state.min_order is not None and order < state.min_order:
            r = ['Actions were added to order={0} after execution had moved '
                 'on to order={1}. Conflicting actions: '
                 .format(order, state.min_order)]
            for i, action in actiongroup:
                for line in str(action['info']).rstrip().split('\n'):
                    r.append("  " + line)
            raise ConfigurationError('\n'.join(r))

        for i, action in actiongroup:
            # Within an order, actions are executed sequentially based on
            # original action ordering ("i").

            # "ainfo" is a tuple of (i, action) where "i" is an integer
            # expressing the relative position of this action in the action
            # list being resolved, and "action" is an action dictionary.  The
            # purpose of an ainfo is to associate an "i" with a particular
            # action; "i" exists for sorting after conflict resolution.
            ainfo = (i, action)

            # wait to defer discriminators until we are on their order because
            # the discriminator may depend on state from a previous order
            discriminator = undefer(action['discriminator'])
            action['discriminator'] = discriminator

            if discriminator is None:
                # The discriminator is None, so this action can never conflict.
                # We can add it directly to the result.
                output.append(ainfo)
                continue

            L = unique.setdefault(discriminator, [])
            L.append(ainfo)

        # Check for conflicts
        conflicts = {}
        for discriminator, ainfos in unique.items():
            # We use (includepath, i) as a sort key because we need to
            # sort the actions by the paths so that the shortest path with a
            # given prefix comes first.  The "first" action is the one with the
            # shortest include path.  We break sorting ties using "i".
            def bypath(ainfo):
                path, i = ainfo[1]['includepath'], ainfo[0]
                return path, order, i

            ainfos.sort(key=bypath)
            ainfo, rest = ainfos[0], ainfos[1:]
            _, action = ainfo

            # ensure this new action does not conflict with a previously
            # resolved action from an earlier order / invocation
            prev_ainfo = state.resolved_ainfos.get(discriminator)
            if prev_ainfo is not None:
                _, paction = prev_ainfo
                basepath, baseinfo = paction['includepath'], paction['info']
                includepath = action['includepath']
                # if the new action conflicts with the resolved action then
                # note the conflict, otherwise drop the action as it's
                # effectively overriden by the previous action
                if (includepath[:len(basepath)] != basepath or
                        includepath == basepath):
                    L = conflicts.setdefault(discriminator, [baseinfo])
                    L.append(action['info'])

            else:
                output.append(ainfo)

            basepath, baseinfo = action['includepath'], action['info']
            for _, action in rest:
                includepath = action['includepath']
                # Test whether path is a prefix of opath
                if (includepath[:len(basepath)] != basepath or  # not a prefix
                        includepath == basepath):
                    L = conflicts.setdefault(discriminator, [baseinfo])
                    L.append(action['info'])

        if conflicts:
            raise ConfigurationConflictError(conflicts)

        # sort resolved actions by "i" and yield them one by one
        for i, action in sorted(output, key=operator.itemgetter(0)):
            # do not memoize the order until we resolve an action inside it
            state.min_order = action['order']
            state.start = i + 1
            state.remaining_actions.remove(action)
            state.resolved_ainfos[action['discriminator']] = (i, action)
            yield action


def normalize_actions(actions):
    """Convert old-style tuple actions to new-style dicts."""
    result = []
    for v in actions:
        if not isinstance(v, dict):
            v = expand_action_tuple(*v)
        result.append(v)
    return result


def expand_action_tuple(
    discriminator, callable=None, args=(), kw=None, includepath=(),
    info=None, order=0, introspectables=(),
):
    if kw is None:
        kw = {}
    return dict(
        discriminator=discriminator,
        callable=callable,
        args=args,
        kw=kw,
        includepath=includepath,
        info=info,
        order=order,
        introspectables=introspectables,
        )


global_registries = WeakOrderedSet()

```
--- END FILE ---

Please first localize the bug based on the issue statement, and then generate *SEARCH/REPLACE* edits to fix the issue.

Every *SEARCH/REPLACE* edit must use this format:
1. The file path
2. The start of search block: <<<<<<< SEARCH
3. A contiguous chunk of lines to search for in the existing source code
4. The dividing line: =======
5. The lines to replace into the source code
6. The end of the replace block: >>>>>>> REPLACE

Here is an example:

```python
### mathweb/flask/app.py
<<<<<<< SEARCH
from flask import Flask
=======
import math
from flask import Flask
>>>>>>> REPLACE
```
</solution>

Please note that the *SEARCH/REPLACE* edit REQUIRES PROPER INDENTATION. If you would like to add the line '        print(x)', you must fully write that out, with all those spaces before the code!
Wrap each *SEARCH/REPLACE* edit in a code block as shown in the example above. If you have multiple *SEARCH/REPLACE* edits, use a separate code block for each one.
[ISSUE]
**Title:** Thread locals are inactive during `config.include` executions

**Description**
When using the `config.include` function to include configuration modules, the thread-local registry is not active. This causes functions executed within `config.include` to retrieve an incorrect registry instance, leading to unexpected behavior.

**Example Code**
```python
from pyramid.config import Configurator
from pyramid.threadlocal import get_current_registry

def include_function(config):
    registry = get_current_registry()
    # Expecting registry to be the current Configurator's registry
    print(registry)

config = Configurator()
config.include(include_function)
```

**Expected Behavior**
Within the `include_function`, `get_current_registry()` should return the current `Configurator`'s registry instance, ensuring that all thread-local operations are correctly associated with the active configuration.

**Actual Behavior**
`get_current_registry()` does not return the expected registry instance inside the `include_function`, indicating that thread locals are not active during the execution of `config.include`. This leads to inconsistencies and potential errors in configuration-dependent operations.

[/ISSUE]
{
    "ConfiguratorTests.test___getattr__matches": "PASSED",
    "ConfiguratorTests.test___getattr__matches_no_action_wrap": "PASSED",
    "ConfiguratorTests.test___getattr__missing_when_directives_dont_exist": "PASSED",
    "ConfiguratorTests.test___getattr__missing_when_directives_exist": "PASSED",
    "ConfiguratorTests.test__fix_registry_adds__lock": "PASSED",
    "ConfiguratorTests.test__fix_registry_adds_clear_view_lookup_cache": "PASSED",
    "ConfiguratorTests.test__fix_registry_has_listeners": "PASSED",
    "ConfiguratorTests.test__fix_registry_notify": "PASSED",
    "ConfiguratorTests.test__fix_registry_queryAdapterOrSelf": "PASSED",
    "ConfiguratorTests.test__fix_registry_registerSelfAdapter": "PASSED",
    "ConfiguratorTests.test_absolute_asset_spec_already_absolute": "PASSED",
    "ConfiguratorTests.test_absolute_asset_spec_notastring": "PASSED",
    "ConfiguratorTests.test_absolute_asset_spec_relative": "PASSED",
    "ConfiguratorTests.test_action_autocommit_with_introspectables": "PASSED",
    "ConfiguratorTests.test_action_autocommit_with_introspectables_introspection_off": "PASSED",
    "ConfiguratorTests.test_action_branching_kw_is_None": "PASSED",
    "ConfiguratorTests.test_action_branching_kw_is_not_None": "PASSED",
    "ConfiguratorTests.test_action_branching_nonautocommit_with_config_info": "PASSED",
    "ConfiguratorTests.test_action_branching_nonautocommit_with_introspectables": "PASSED",
    "ConfiguratorTests.test_action_branching_nonautocommit_without_config_info": "PASSED",
    "ConfiguratorTests.test_action_nonautocommit_with_introspectables_introspection_off": "PASSED",
    "ConfiguratorTests.test_autocommit_no_conflicts": "PASSED",
    "ConfiguratorTests.test_begin": "PASSED",
    "ConfiguratorTests.test_begin_does_not_propagate_request_for_diff_registry": "PASSED",
    "ConfiguratorTests.test_begin_overrides_request": "PASSED",
    "ConfiguratorTests.test_begin_propagates_request_for_same_registry": "PASSED",
    "ConfiguratorTests.test_begin_with_request": "PASSED",
    "ConfiguratorTests.test_commit_conflict_resolved_with_include": "PASSED",
    "ConfiguratorTests.test_commit_conflict_resolved_with_two_includes_and_local": "PASSED",
    "ConfiguratorTests.test_commit_conflict_simple": "PASSED",
    "ConfiguratorTests.test_commit_conflict_with_two_includes": "PASSED",
    "ConfiguratorTests.test_conflict_set_forbidden_view": "PASSED",
    "ConfiguratorTests.test_conflict_set_notfound_view": "PASSED",
    "ConfiguratorTests.test_ctor_alternate_renderers": "PASSED",
    "ConfiguratorTests.test_ctor_authentication_policy": "PASSED",
    "ConfiguratorTests.test_ctor_authorization_policy_only": "PASSED",
    "ConfiguratorTests.test_ctor_default_permission": "PASSED",
    "ConfiguratorTests.test_ctor_default_renderers": "PASSED",
    "ConfiguratorTests.test_ctor_default_view_mapper": "PASSED",
    "ConfiguratorTests.test_ctor_default_webob_response_adapter_registered": "PASSED",
    "ConfiguratorTests.test_ctor_exceptionresponse_view_None": "PASSED",
    "ConfiguratorTests.test_ctor_exceptionresponse_view_custom": "PASSED",
    "ConfiguratorTests.test_ctor_httpexception_view_default": "PASSED",
    "ConfiguratorTests.test_ctor_no_root_factory": "PASSED",
    "ConfiguratorTests.test_ctor_noreg_custom_settings": "PASSED",
    "ConfiguratorTests.test_ctor_noreg_debug_logger_non_None": "PASSED",
    "ConfiguratorTests.test_ctor_session_factory": "PASSED",
    "ConfiguratorTests.test_ctor_with_introspection": "PASSED",
    "ConfiguratorTests.test_ctor_with_package_registry": "PASSED",
    "ConfiguratorTests.test_ctor_with_root_factory": "PASSED",
    "ConfiguratorTests.test_end": "PASSED",
    "ConfiguratorTests.test_hook_zca": "PASSED",
    "ConfiguratorTests.test_include_threadlocals_active": "PASSED",
    "ConfiguratorTests.test_include_with_dotted_name": "PASSED",
    "ConfiguratorTests.test_include_with_missing_source_file": "PASSED",
    "ConfiguratorTests.test_include_with_module_defaults_to_includeme": "PASSED",
    "ConfiguratorTests.test_include_with_module_defaults_to_includeme_missing": "PASSED",
    "ConfiguratorTests.test_include_with_nested_route_prefix": "PASSED",
    "ConfiguratorTests.test_include_with_python_callable": "PASSED",
    "ConfiguratorTests.test_include_with_route_prefix": "PASSED",
    "ConfiguratorTests.test_introspector_decorator": "PASSED",
    "ConfiguratorTests.test_make_wsgi_app": "PASSED",
    "ConfiguratorTests.test_maybe_dotted_notstring_success": "PASSED",
    "ConfiguratorTests.test_maybe_dotted_string_fail": "PASSED",
    "ConfiguratorTests.test_maybe_dotted_string_success": "PASSED",
    "ConfiguratorTests.test_scan_integration": "PASSED",
    "ConfiguratorTests.test_scan_integration_dottedname_package": "PASSED",
    "ConfiguratorTests.test_scan_integration_with_extra_kw": "PASSED",
    "ConfiguratorTests.test_scan_integration_with_ignore": "PASSED",
    "ConfiguratorTests.test_setup_registry_alternate_renderers": "PASSED",
    "ConfiguratorTests.test_setup_registry_authentication_policy": "PASSED",
    "ConfiguratorTests.test_setup_registry_authentication_policy_dottedname": "PASSED",
    "ConfiguratorTests.test_setup_registry_authorization_policy_dottedname": "PASSED",
    "ConfiguratorTests.test_setup_registry_authorization_policy_only": "PASSED",
    "ConfiguratorTests.test_setup_registry_calls_fix_registry": "PASSED",
    "ConfiguratorTests.test_setup_registry_custom_settings": "PASSED",
    "ConfiguratorTests.test_setup_registry_debug_logger_name": "PASSED",
    "ConfiguratorTests.test_setup_registry_debug_logger_non_None": "PASSED",
    "ConfiguratorTests.test_setup_registry_default_permission": "PASSED",
    "ConfiguratorTests.test_setup_registry_dottedname_root_factory": "PASSED",
    "ConfiguratorTests.test_setup_registry_explicit_notfound_trumps_iexceptionresponse": "PASSED",
    "ConfiguratorTests.test_setup_registry_includes": "PASSED",
    "ConfiguratorTests.test_setup_registry_includes_spaces": "PASSED",
    "ConfiguratorTests.test_setup_registry_locale_negotiator": "PASSED",
    "ConfiguratorTests.test_setup_registry_locale_negotiator_dottedname": "PASSED",
    "ConfiguratorTests.test_setup_registry_no_default_root_factory": "PASSED",
    "ConfiguratorTests.test_setup_registry_registers_default_exceptionresponse_views": "PASSED",
    "ConfiguratorTests.test_setup_registry_registers_default_view_predicates": "PASSED",
    "ConfiguratorTests.test_setup_registry_registers_default_webob_iresponse_adapter": "PASSED",
    "ConfiguratorTests.test_setup_registry_request_factory": "PASSED",
    "ConfiguratorTests.test_setup_registry_request_factory_dottedname": "PASSED",
    "ConfiguratorTests.test_setup_registry_response_factory": "PASSED",
    "ConfiguratorTests.test_setup_registry_tweens": "PASSED",
    "ConfiguratorTests.test_unhook_zca": "PASSED",
    "ConfiguratorTests.test_with_package": "PASSED",
    "ConfiguratorTests.test_with_package_module": "PASSED",
    "ConfiguratorTests.test_with_package_package": "PASSED",
    "TestConfigurator_add_directive.test_directive_persists_across_configurator_creations": "PASSED",
    "TestConfigurator_add_directive.test_extend_action_method_successful": "PASSED",
    "TestConfigurator_add_directive.test_extend_same_name_doesnt_conflict": "PASSED",
    "TestConfigurator__add_predicate.test_factory_as_object": "PASSED",
    "TestActionState.test_action_simple": "PASSED",
    "TestActionState.test_action_with_includepath": "PASSED",
    "TestActionState.test_action_with_includepath_and_info": "PASSED",
    "TestActionState.test_action_with_info": "PASSED",
    "TestActionState.test_action_with_introspectables": "PASSED",
    "TestActionState.test_action_with_order": "PASSED",
    "TestActionState.test_execute_actions_dicts": "PASSED",
    "TestActionState.test_execute_actions_error": "PASSED",
    "TestActionState.test_execute_actions_tuples": "PASSED",
    "TestActionState.test_execute_actions_with_introspectable_no_callable": "PASSED",
    "TestActionState.test_execute_actions_with_introspectables": "PASSED",
    "TestActionState.test_executing_conflicting_action_across_orders": "PASSED",
    "TestActionState.test_executing_conflicting_action_across_reentrant_orders": "PASSED",
    "TestActionState.test_it": "PASSED",
    "TestActionState.test_processSpec": "PASSED",
    "TestActionState.test_reentrant_action": "PASSED",
    "TestActionState.test_reentrant_action_error": "PASSED",
    "TestActionState.test_reentrant_action_with_deferred_discriminator": "PASSED",
    "TestActionState.test_reentrant_action_without_clear": "PASSED",
    "Test_reentrant_action_functional.test_deferred_discriminator": "PASSED",
    "Test_reentrant_action_functional.test_functional": "PASSED",
    "Test_resolveConflicts.test_conflicts_across_orders": "PASSED",
    "Test_resolveConflicts.test_it_conflict": "PASSED",
    "Test_resolveConflicts.test_it_success_dicts": "PASSED",
    "Test_resolveConflicts.test_it_success_tuples": "PASSED",
    "Test_resolveConflicts.test_it_with_actions_grouped_by_order": "PASSED",
    "Test_resolveConflicts.test_override_success_across_orders": "PASSED",
    "TestGlobalRegistriesIntegration.test_global_registries": "PASSED",
    "TestGlobalRegistriesIntegration.test_global_registries_empty": "PASSED",
    "AdaptersConfiguratorMixinTests.test_add_object_event_subscriber": "PASSED",
    "AdaptersConfiguratorMixinTests.test_add_resource_url_default_resource_iface_means_Interface": "PASSED",
    "AdaptersConfiguratorMixinTests.test_add_resource_url_nodefault_resource_iface": "PASSED",
    "AdaptersConfiguratorMixinTests.test_add_response_adapter": "PASSED",
    "AdaptersConfiguratorMixinTests.test_add_response_adapter_dottednames": "PASSED",
    "AdaptersConfiguratorMixinTests.test_add_response_adapter_self": "PASSED",
    "AdaptersConfiguratorMixinTests.test_add_subscriber_defaults": "PASSED",
    "AdaptersConfiguratorMixinTests.test_add_subscriber_dottednames": "PASSED",
    "AdaptersConfiguratorMixinTests.test_add_subscriber_iface_specified": "PASSED",
    "AdaptersConfiguratorMixinTests.test_add_subscriber_predicate": "PASSED",
    "AdaptersConfiguratorMixinTests.test_add_subscriber_with_default_type_predicates_False": "PASSED",
    "AdaptersConfiguratorMixinTests.test_add_subscriber_with_default_type_predicates_True": "PASSED",
    "AdaptersConfiguratorMixinTests.test_add_subscriber_with_specific_type_and_predicates_False": "PASSED",
    "AdaptersConfiguratorMixinTests.test_add_subscriber_with_specific_type_and_predicates_True": "PASSED",
    "AdaptersConfiguratorMixinTests.test_add_traverser_default_iface_means_Interface": "PASSED",
    "AdaptersConfiguratorMixinTests.test_add_traverser_introspectables": "PASSED",
    "AdaptersConfiguratorMixinTests.test_add_traverser_nondefault_iface": "PASSED",
    "Test_eventonly.test_defaults": "PASSED",
    "TestAssetsConfiguratorMixin.test__override_already_registered": "PASSED",
    "TestAssetsConfiguratorMixin.test__override_not_yet_registered": "PASSED",
    "TestAssetsConfiguratorMixin.test_override_asset_directory_with_absdirectory": "PASSED",
    "TestAssetsConfiguratorMixin.test_override_asset_directory_with_absfile": "PASSED",
    "TestAssetsConfiguratorMixin.test_override_asset_directory_with_file": "PASSED",
    "TestAssetsConfiguratorMixin.test_override_asset_file_with_absdirectory": "PASSED",
    "TestAssetsConfiguratorMixin.test_override_asset_file_with_absfile": "PASSED",
    "TestAssetsConfiguratorMixin.test_override_asset_file_with_directory": "PASSED",
    "TestAssetsConfiguratorMixin.test_override_asset_file_with_missing_abspath": "PASSED",
    "TestAssetsConfiguratorMixin.test_override_asset_file_with_package": "PASSED",
    "TestAssetsConfiguratorMixin.test_override_asset_package_with_absdirectory": "PASSED",
    "TestAssetsConfiguratorMixin.test_override_asset_samename": "PASSED",
    "TestOverrideProvider.test_get_resource_filename_override_returns_value": "PASSED",
    "TestOverrideProvider.test_get_resource_stream_no_overrides": "PASSED",
    "TestOverrideProvider.test_get_resource_stream_override_returns_None": "PASSED",
    "TestOverrideProvider.test_get_resource_stream_override_returns_value": "PASSED",
    "TestOverrideProvider.test_get_resource_string_no_overrides": "PASSED",
    "TestOverrideProvider.test_get_resource_string_override_returns_None": "PASSED",
    "TestOverrideProvider.test_get_resource_string_override_returns_value": "PASSED",
    "TestOverrideProvider.test_has_resource_no_overrides": "PASSED",
    "TestOverrideProvider.test_has_resource_override_returns_None": "PASSED",
    "TestOverrideProvider.test_has_resource_override_returns_True": "PASSED",
    "TestOverrideProvider.test_resource_isdir_no_overrides": "PASSED",
    "TestOverrideProvider.test_resource_isdir_override_returns_False": "PASSED",
    "TestOverrideProvider.test_resource_isdir_override_returns_None": "PASSED",
    "TestOverrideProvider.test_resource_listdir_no_overrides": "PASSED",
    "TestOverrideProvider.test_resource_listdir_override_returns_None": "PASSED",
    "TestOverrideProvider.test_resource_listdir_override_returns_values": "PASSED",
    "TestPackageOverrides.test_class_conforms_to_IPEP302Loader": "PASSED",
    "TestPackageOverrides.test_class_conforms_to_IPackageOverrides": "PASSED",
    "TestPackageOverrides.test_ctor_package_already_has_loader_of_different_type": "PASSED",
    "TestPackageOverrides.test_ctor_package_already_has_loader_of_same_type": "PASSED",
    "TestPackageOverrides.test_ctor_registers_loader_type": "PASSED",
    "TestPackageOverrides.test_ctor_sets_loader": "PASSED",
    "TestPackageOverrides.test_ctor_sets_local_state": "PASSED",
    "TestPackageOverrides.test_filtered_sources": "PASSED",
    "TestPackageOverrides.test_get_code_pkg_has___loader__": "PASSED",
    "TestPackageOverrides.test_get_code_pkg_has_no___loader__": "PASSED",
    "TestPackageOverrides.test_get_data_pkg_has___loader__": "PASSED",
    "TestPackageOverrides.test_get_data_pkg_has_no___loader__": "PASSED",
    "TestPackageOverrides.test_get_filename": "PASSED",
    "TestPackageOverrides.test_get_filename_file_doesnt_exist": "PASSED",
    "TestPackageOverrides.test_get_source_pkg_has___loader__": "PASSED",
    "TestPackageOverrides.test_get_source_pkg_has_no___loader__": "PASSED",
    "TestPackageOverrides.test_get_stream": "PASSED",
    "TestPackageOverrides.test_get_stream_file_doesnt_exist": "PASSED",
    "TestPackageOverrides.test_get_string": "PASSED",
    "TestPackageOverrides.test_get_string_file_doesnt_exist": "PASSED",
    "TestPackageOverrides.test_has_resource": "PASSED",
    "TestPackageOverrides.test_has_resource_file_doesnt_exist": "PASSED",
    "TestPackageOverrides.test_insert_directory": "PASSED",
    "TestPackageOverrides.test_insert_emptystring": "PASSED",
    "TestPackageOverrides.test_insert_file": "PASSED",
    "TestPackageOverrides.test_instance_conforms_to_IPEP302Loader": "PASSED",
    "TestPackageOverrides.test_instance_conforms_to_IPackageOverrides": "PASSED",
    "TestPackageOverrides.test_is_package_pkg_has___loader__": "PASSED",
    "TestPackageOverrides.test_is_package_pkg_has_no___loader__": "PASSED",
    "TestPackageOverrides.test_isdir_doesnt_exist": "PASSED",
    "TestPackageOverrides.test_isdir_false": "PASSED",
    "TestPackageOverrides.test_isdir_true": "PASSED",
    "TestPackageOverrides.test_listdir": "PASSED",
    "TestPackageOverrides.test_listdir_doesnt_exist": "PASSED",
    "TestPackageAssetSource.test_exists": "PASSED",
    "TestPackageAssetSource.test_exists_file_doesnt_exist": "PASSED",
    "TestPackageAssetSource.test_exists_with_prefix": "PASSED",
    "TestPackageAssetSource.test_get_filename_file_doesnt_exist": "PASSED",
    "TestPackageAssetSource.test_get_stream": "PASSED",
    "TestPackageAssetSource.test_get_stream_file_doesnt_exist": "PASSED",
    "TestPackageAssetSource.test_get_stream_with_prefix": "PASSED",
    "TestPackageAssetSource.test_get_string": "PASSED",
    "TestPackageAssetSource.test_get_string_file_doesnt_exist": "PASSED",
    "TestPackageAssetSource.test_get_string_with_prefix": "PASSED",
    "TestPackageAssetSource.test_isdir_doesnt_exist": "PASSED",
    "TestPackageAssetSource.test_isdir_false": "PASSED",
    "TestPackageAssetSource.test_isdir_true": "PASSED",
    "TestPackageAssetSource.test_listdir": "PASSED",
    "TestPackageAssetSource.test_listdir_doesnt_exist": "PASSED",
    "TestFSAssetSource.test_exists": "PASSED",
    "TestFSAssetSource.test_exists_file_doesnt_exist": "PASSED",
    "TestFSAssetSource.test_exists_with_prefix": "PASSED",
    "TestFSAssetSource.test_get_filename": "PASSED",
    "TestFSAssetSource.test_get_filename_file_doesnt_exist": "PASSED",
    "TestFSAssetSource.test_get_filename_with_prefix": "PASSED",
    "TestFSAssetSource.test_get_stream": "PASSED",
    "TestFSAssetSource.test_get_stream_file_doesnt_exist": "PASSED",
    "TestFSAssetSource.test_get_stream_with_prefix": "PASSED",
    "TestFSAssetSource.test_get_string": "PASSED",
    "TestFSAssetSource.test_get_string_file_doesnt_exist": "PASSED",
    "TestFSAssetSource.test_get_string_with_prefix": "PASSED",
    "TestFSAssetSource.test_isdir_doesnt_exist": "PASSED",
    "TestFSAssetSource.test_isdir_false": "PASSED",
    "TestFSAssetSource.test_isdir_true": "PASSED",
    "TestFSAssetSource.test_listdir": "PASSED",
    "TestFSAssetSource.test_listdir_doesnt_exist": "PASSED",
    "TestDirectoryOverride.test_it_match": "PASSED",
    "TestDirectoryOverride.test_it_no_match": "PASSED",
    "TestFileOverride.test_it_match": "PASSED",
    "TestFileOverride.test_it_no_match": "PASSED",
    "TestFactoriesMixin.test_add_request_method_with_None_callable": "PASSED",
    "TestFactoriesMixin.test_add_request_method_with_None_callable_and_no_name": "PASSED",
    "TestFactoriesMixin.test_add_request_method_with_None_callable_conflict": "PASSED",
    "TestFactoriesMixin.test_add_request_method_with_callable": "PASSED",
    "TestFactoriesMixin.test_add_request_method_with_text_type_name": "PASSED",
    "TestFactoriesMixin.test_add_request_method_with_unnamed_callable": "PASSED",
    "TestFactoriesMixin.test_set_execution_policy": "PASSED",
    "TestFactoriesMixin.test_set_execution_policy_to_None": "PASSED",
    "TestFactoriesMixin.test_set_multiple_request_methods_conflict": "PASSED",
    "TestFactoriesMixin.test_set_request_factory": "PASSED",
    "TestFactoriesMixin.test_set_request_factory_dottedname": "PASSED",
    "TestFactoriesMixin.test_set_response_factory": "PASSED",
    "TestFactoriesMixin.test_set_response_factory_dottedname": "PASSED",
    "TestFactoriesMixin.test_set_root_factory": "PASSED",
    "TestFactoriesMixin.test_set_root_factory_as_None": "PASSED",
    "TestFactoriesMixin.test_set_root_factory_dottedname": "PASSED",
    "TestFactoriesMixin.test_set_session_factory": "PASSED",
    "TestFactoriesMixin.test_set_session_factory_dottedname": "PASSED",
    "TestDeprecatedFactoriesMixinMethods.test_set_multiple_request_properties": "PASSED",
    "TestDeprecatedFactoriesMixinMethods.test_set_multiple_request_properties_conflict": "PASSED",
    "TestDeprecatedFactoriesMixinMethods.test_set_request_property_with_callable": "PASSED",
    "TestDeprecatedFactoriesMixinMethods.test_set_request_property_with_property": "PASSED",
    "TestDeprecatedFactoriesMixinMethods.test_set_request_property_with_unnamed_callable": "PASSED",
    "TestI18NConfiguratorMixin.test_add_translation_dirs_invalid_kwargs": "PASSED",
    "TestI18NConfiguratorMixin.test_add_translation_dirs_missing_dir": "PASSED",
    "TestI18NConfiguratorMixin.test_add_translation_dirs_no_specs": "PASSED",
    "TestI18NConfiguratorMixin.test_set_locale_negotiator": "PASSED",
    "TestI18NConfiguratorMixin.test_set_locale_negotiator_dottedname": "PASSED",
    "ConfiguratorTests.test_scan_integration_with_onerror": "FAILED",
    "TestRenderingConfiguratorMixin.test_add_default_renderers": "PASSED",
    "TestRenderingConfiguratorMixin.test_add_renderer": "PASSED",
    "TestRenderingConfiguratorMixin.test_add_renderer_dottedname_factory": "PASSED",
    "RoutesConfiguratorMixinTests.test_add_route_defaults": "PASSED",
    "RoutesConfiguratorMixinTests.test_add_route_discriminator": "PASSED",
    "RoutesConfiguratorMixinTests.test_add_route_no_path_no_pattern": "PASSED",
    "RoutesConfiguratorMixinTests.test_add_route_no_pattern_with_path": "PASSED",
    "RoutesConfiguratorMixinTests.test_add_route_no_view_with_view_attr": "PASSED",
    "RoutesConfiguratorMixinTests.test_add_route_no_view_with_view_context": "PASSED",
    "RoutesConfiguratorMixinTests.test_add_route_no_view_with_view_permission": "PASSED",
    "RoutesConfiguratorMixinTests.test_add_route_no_view_with_view_renderer": "PASSED",
    "RoutesConfiguratorMixinTests.test_add_route_with_accept": "PASSED",
    "RoutesConfiguratorMixinTests.test_add_route_with_custom_predicates": "PASSED",
    "RoutesConfiguratorMixinTests.test_add_route_with_factory": "PASSED",
    "RoutesConfiguratorMixinTests.test_add_route_with_factory_dottedname": "PASSED",
    "RoutesConfiguratorMixinTests.test_add_route_with_header": "PASSED",
    "RoutesConfiguratorMixinTests.test_add_route_with_path_info": "PASSED",
    "RoutesConfiguratorMixinTests.test_add_route_with_path_info_highorder": "PASSED",
    "RoutesConfiguratorMixinTests.test_add_route_with_path_info_regex": "PASSED",
    "RoutesConfiguratorMixinTests.test_add_route_with_pregenerator": "PASSED",
    "RoutesConfiguratorMixinTests.test_add_route_with_request_method": "PASSED",
    "RoutesConfiguratorMixinTests.test_add_route_with_request_param": "PASSED",
    "RoutesConfiguratorMixinTests.test_add_route_with_route_prefix": "PASSED",
    "RoutesConfiguratorMixinTests.test_add_route_with_static": "PASSED",
    "RoutesConfiguratorMixinTests.test_add_route_with_xhr": "PASSED",
    "RoutesConfiguratorMixinTests.test_get_routes_mapper_already_registered": "PASSED",
    "RoutesConfiguratorMixinTests.test_get_routes_mapper_not_yet_registered": "PASSED",
    "ConfiguratorSecurityMethodsTests.test_add_permission": "PASSED",
    "ConfiguratorSecurityMethodsTests.test_changing_set_default_csrf_options": "PASSED",
    "ConfiguratorSecurityMethodsTests.test_set_authentication_policy_no_authz_policy": "PASSED",
    "ConfiguratorSecurityMethodsTests.test_set_authentication_policy_no_authz_policy_autocommit": "PASSED",
    "ConfiguratorSecurityMethodsTests.test_set_authentication_policy_with_authz_policy": "PASSED",
    "ConfiguratorSecurityMethodsTests.test_set_authentication_policy_with_authz_policy_autocommit": "PASSED",
    "ConfiguratorSecurityMethodsTests.test_set_authorization_policy_no_authn_policy": "PASSED",
    "ConfiguratorSecurityMethodsTests.test_set_authorization_policy_no_authn_policy_autocommit": "PASSED",
    "ConfiguratorSecurityMethodsTests.test_set_authorization_policy_with_authn_policy": "PASSED",
    "ConfiguratorSecurityMethodsTests.test_set_authorization_policy_with_authn_policy_autocommit": "PASSED",
    "ConfiguratorSecurityMethodsTests.test_set_default_csrf_options": "PASSED",
    "ConfiguratorSecurityMethodsTests.test_set_default_permission": "PASSED",
    "TestSettingsConfiguratorMixin.test__set_settings_as_None": "PASSED",
    "TestSettingsConfiguratorMixin.test__set_settings_as_dictwithvalues": "PASSED",
    "TestSettingsConfiguratorMixin.test__set_settings_does_not_uses_original_dict": "PASSED",
    "TestSettingsConfiguratorMixin.test_add_settings_settings_None": "PASSED",
    "TestSettingsConfiguratorMixin.test_add_settings_settings_already_registered": "PASSED",
    "TestSettingsConfiguratorMixin.test_add_settings_settings_not_yet_registered": "PASSED",
    "TestSettingsConfiguratorMixin.test_get_settings_nosettings": "PASSED",
    "TestSettingsConfiguratorMixin.test_get_settings_withsettings": "PASSED",
    "TestSettingsConfiguratorMixin.test_settings_parameter_dict_is_never_updated": "PASSED",
    "TestSettings.test_csrf_trusted_origins": "PASSED",
    "TestSettings.test_debug_all": "PASSED",
    "TestSettings.test_debug_authorization": "PASSED",
    "TestSettings.test_debug_notfound": "PASSED",
    "TestSettings.test_debug_routematch": "PASSED",
    "TestSettings.test_debug_templates": "PASSED",
    "TestSettings.test_default_locale_name": "PASSED",
    "TestSettings.test_noargs": "PASSED",
    "TestSettings.test_originals_kept": "PASSED",
    "TestSettings.test_prevent_cachebust": "PASSED",
    "TestSettings.test_prevent_http_cache": "PASSED",
    "TestSettings.test_reload_all": "PASSED",
    "TestSettings.test_reload_assets": "PASSED",
    "TestSettings.test_reload_resources": "PASSED",
    "TestSettings.test_reload_templates": "PASSED",
    "TestingConfiguratorMixinTests.test_testing_add_renderer": "PASSED",
    "TestingConfiguratorMixinTests.test_testing_add_renderer_explicitrenderer": "PASSED",
    "TestingConfiguratorMixinTests.test_testing_add_renderer_twice": "PASSED",
    "TestingConfiguratorMixinTests.test_testing_add_subscriber_defaults": "PASSED",
    "TestingConfiguratorMixinTests.test_testing_add_subscriber_dottedname": "PASSED",
    "TestingConfiguratorMixinTests.test_testing_add_subscriber_multiple": "PASSED",
    "TestingConfiguratorMixinTests.test_testing_add_subscriber_single": "PASSED",
    "TestingConfiguratorMixinTests.test_testing_add_template": "PASSED",
    "TestingConfiguratorMixinTests.test_testing_resources": "PASSED",
    "TestingConfiguratorMixinTests.test_testing_securitypolicy": "PASSED",
    "TestingConfiguratorMixinTests.test_testing_securitypolicy_forget_result": "PASSED",
    "TestingConfiguratorMixinTests.test_testing_securitypolicy_remember_result": "PASSED",
    "TestTweensConfiguratorMixin.test_add_tween_dottedname": "PASSED",
    "TestTweensConfiguratorMixin.test_add_tween_instance": "PASSED",
    "TestTweensConfiguratorMixin.test_add_tween_name_ingress": "PASSED",
    "TestTweensConfiguratorMixin.test_add_tween_name_main": "PASSED",
    "TestTweensConfiguratorMixin.test_add_tween_over_ingress": "PASSED",
    "TestTweensConfiguratorMixin.test_add_tween_over_ingress_iterable": "PASSED",
    "TestTweensConfiguratorMixin.test_add_tween_under_main": "PASSED",
    "TestTweensConfiguratorMixin.test_add_tween_under_main_iterable": "PASSED",
    "TestTweensConfiguratorMixin.test_add_tween_unsuitable": "PASSED",
    "TestTweensConfiguratorMixin.test_add_tweens_conflict": "PASSED",
    "TestTweensConfiguratorMixin.test_add_tweens_names_distinct": "PASSED",
    "TestTweensConfiguratorMixin.test_add_tweens_names_with_over_nonstringoriter": "PASSED",
    "TestTweensConfiguratorMixin.test_add_tweens_names_with_under_nonstringoriter": "PASSED",
    "TestTweensConfiguratorMixin.test_add_tweens_names_with_underover": "PASSED",
    "TestTweens.test___call___explicit": "PASSED",
    "TestTweens.test___call___implicit": "PASSED",
    "TestTweens.test_add_explicit": "PASSED",
    "TestTweens.test_add_implicit": "PASSED",
    "TestTweens.test_implicit_ordering_1": "PASSED",
    "TestTweens.test_implicit_ordering_2": "PASSED",
    "TestTweens.test_implicit_ordering_3": "PASSED",
    "TestTweens.test_implicit_ordering_4": "PASSED",
    "TestTweens.test_implicit_ordering_5": "PASSED",
    "TestTweens.test_implicit_ordering_conflict_direct": "PASSED",
    "TestTweens.test_implicit_ordering_conflict_indirect": "PASSED",
    "TestTweens.test_implicit_ordering_missing_over_and_under_partials": "PASSED",
    "TestTweens.test_implicit_ordering_missing_over_partial": "PASSED",
    "TestTweens.test_implicit_ordering_missing_over_partial_with_fallback": "PASSED",
    "TestTweens.test_implicit_ordering_missing_under_partial": "PASSED",
    "TestTweens.test_implicit_ordering_missing_under_partial_with_fallback": "PASSED",
    "TestTweens.test_implicit_ordering_with_missing_fallbacks": "PASSED",
    "TestTweens.test_implicit_ordering_with_multiple_matching_fallbacks": "PASSED",
    "TestTweens.test_implicit_ordering_with_partial_fallbacks": "PASSED",
    "TestPredicateList.test_custom_predicates_can_affect_traversal": "PASSED",
    "TestPredicateList.test_different_custom_predicates_with_same_hash": "PASSED",
    "TestPredicateList.test_match_param_from_dict": "PASSED",
    "TestPredicateList.test_match_param_from_dict_fails": "PASSED",
    "TestPredicateList.test_match_param_from_string": "PASSED",
    "TestPredicateList.test_match_param_from_string_fails": "PASSED",
    "TestPredicateList.test_notted": "PASSED",
    "TestPredicateList.test_ordering_importance_and_number": "PASSED",
    "TestPredicateList.test_ordering_importance_of_predicates": "PASSED",
    "TestPredicateList.test_ordering_number_of_predicates": "PASSED",
    "TestPredicateList.test_ordering_xhr_and_request_method_trump_only_containment": "PASSED",
    "TestPredicateList.test_predicate_text_is_correct": "PASSED",
    "TestPredicateList.test_request_method_ordering_hashes_same": "PASSED",
    "TestPredicateList.test_request_method_sequence": "PASSED",
    "TestPredicateList.test_traverse_has_remainder_already": "PASSED",
    "TestPredicateList.test_traverse_matches": "PASSED",
    "TestPredicateList.test_traverse_matches_with_highorder_chars": "PASSED",
    "TestPredicateList.test_unknown_predicate": "PASSED",
    "Test_takes_one_arg.test_function_annotations": "PASSED",
    "Test_takes_one_arg.test_function_defaultargs_firstname_not_request": "PASSED",
    "Test_takes_one_arg.test_function_defaultargs_firstname_request": "PASSED",
    "Test_takes_one_arg.test_function_noargs": "PASSED",
    "Test_takes_one_arg.test_function_onearg_named_request": "PASSED",
    "Test_takes_one_arg.test_function_onearg_named_somethingelse": "PASSED",
    "Test_takes_one_arg.test_function_toomanyargs": "PASSED",
    "Test_takes_one_arg.test_function_with_attr_false": "PASSED",
    "Test_takes_one_arg.test_function_with_attr_true": "PASSED",
    "Test_takes_one_arg.test_instance_defaultargs_firstname_not_request": "PASSED",
    "Test_takes_one_arg.test_instance_defaultargs_firstname_request": "PASSED",
    "Test_takes_one_arg.test_instance_defaultargs_onearg_named_request": "PASSED",
    "Test_takes_one_arg.test_instance_defaultargs_onearg_named_somethingelse": "PASSED",
    "Test_takes_one_arg.test_instance_nocall": "PASSED",
    "Test_takes_one_arg.test_instance_toomanyargs": "PASSED",
    "Test_takes_one_arg.test_method_onearg_named_request": "PASSED",
    "Test_takes_one_arg.test_newstyle_class_init_defaultargs_firstname_not_request": "PASSED",
    "Test_takes_one_arg.test_newstyle_class_init_defaultargs_firstname_request": "PASSED",
    "Test_takes_one_arg.test_newstyle_class_init_firstname_request_with_secondname": "PASSED",
    "Test_takes_one_arg.test_newstyle_class_init_noargs": "PASSED",
    "Test_takes_one_arg.test_newstyle_class_init_onearg_named_somethingelse": "PASSED",
    "Test_takes_one_arg.test_oldstyle_class_init_defaultargs_firstname_not_request": "PASSED",
    "Test_takes_one_arg.test_oldstyle_class_init_defaultargs_firstname_request": "PASSED",
    "Test_takes_one_arg.test_oldstyle_class_init_noargs": "PASSED",
    "Test_takes_one_arg.test_oldstyle_class_init_onearg_named_request": "PASSED",
    "Test_takes_one_arg.test_oldstyle_class_init_onearg_named_somethingelse": "PASSED",
    "Test_takes_one_arg.test_oldstyle_class_init_toomanyargs": "PASSED",
    "Test_takes_one_arg.test_oldstyle_class_no_init": "PASSED",
    "Test_takes_one_arg.test_requestonly_newstyle_class_init_onearg_named_request": "PASSED",
    "Test_takes_one_arg.test_requestonly_newstyle_class_init_toomanyargs": "PASSED",
    "Test_takes_one_arg.test_requestonly_newstyle_class_no_init": "PASSED",
    "TestNotted.test_it_with_phash_val": "PASSED",
    "TestNotted.test_it_without_phash_val": "PASSED",
    "TestDeprecatedPredicates.test_it": "PASSED",
    "TestViewsConfigurationMixin.test_add_exception_view": "PASSED",
    "TestViewsConfigurationMixin.test_add_exception_view_disallows_exception_only": "PASSED",
    "TestViewsConfigurationMixin.test_add_exception_view_disallows_for_": "PASSED",
    "TestViewsConfigurationMixin.test_add_exception_view_disallows_name": "PASSED",
    "TestViewsConfigurationMixin.test_add_exception_view_disallows_permission": "PASSED",
    "TestViewsConfigurationMixin.test_add_exception_view_disallows_require_csrf": "PASSED",
    "TestViewsConfigurationMixin.test_add_exception_view_with_subclass": "PASSED",
    "TestViewsConfigurationMixin.test_add_exception_view_with_view_defaults": "PASSED",
    "TestViewsConfigurationMixin.test_add_forbidden_view": "PASSED",
    "TestViewsConfigurationMixin.test_add_forbidden_view_allows_other_predicates": "PASSED",
    "TestViewsConfigurationMixin.test_add_forbidden_view_disallows_context": "PASSED",
    "TestViewsConfigurationMixin.test_add_forbidden_view_disallows_for_": "PASSED",
    "TestViewsConfigurationMixin.test_add_forbidden_view_disallows_name": "PASSED",
    "TestViewsConfigurationMixin.test_add_forbidden_view_disallows_permission": "PASSED",
    "TestViewsConfigurationMixin.test_add_forbidden_view_disallows_require_csrf": "PASSED",
    "TestViewsConfigurationMixin.test_add_forbidden_view_no_view_argument": "PASSED",
    "TestViewsConfigurationMixin.test_add_forbidden_view_with_renderer": "PASSED",
    "TestViewsConfigurationMixin.test_add_forbidden_view_with_view_defaults": "PASSED",
    "TestViewsConfigurationMixin.test_add_normal_and_exception_view_intr_derived_callable": "PASSED",
    "TestViewsConfigurationMixin.test_add_notfound_view": "PASSED",
    "TestViewsConfigurationMixin.test_add_notfound_view_allows_other_predicates": "PASSED",
    "TestViewsConfigurationMixin.test_add_notfound_view_append_slash": "PASSED",
    "TestViewsConfigurationMixin.test_add_notfound_view_append_slash_custom_response": "PASSED",
    "TestViewsConfigurationMixin.test_add_notfound_view_disallows_context": "PASSED",
    "TestViewsConfigurationMixin.test_add_notfound_view_disallows_for_": "PASSED",
    "TestViewsConfigurationMixin.test_add_notfound_view_disallows_name": "PASSED",
    "TestViewsConfigurationMixin.test_add_notfound_view_disallows_permission": "PASSED",
    "TestViewsConfigurationMixin.test_add_notfound_view_disallows_require_csrf": "PASSED",
    "TestViewsConfigurationMixin.test_add_notfound_view_no_view_argument": "PASSED",
    "TestViewsConfigurationMixin.test_add_notfound_view_with_renderer": "PASSED",
    "TestViewsConfigurationMixin.test_add_notfound_view_with_view_defaults": "PASSED",
    "TestViewsConfigurationMixin.test_add_static_view_absolute": "PASSED",
    "TestViewsConfigurationMixin.test_add_static_view_here_no_utility_registered": "PASSED",
    "TestViewsConfigurationMixin.test_add_static_view_package_relative": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_as_instance": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_as_instance_requestonly": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_as_instancemethod": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_as_instancemethod_requestonly": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_as_oldstyle_class": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_as_oldstyle_class_requestonly": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_class_method_no_attr": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_context_as_class": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_context_as_dottedname": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_context_as_iface": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_context_trumps_for": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_custom_more_preds_first_bests_fewer_preds_last": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_custom_predicate_bests_standard_predicate": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_default_phash_overrides_default_phash": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_default_phash_overrides_no_phash": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_exc_default_phash_overrides_default_phash": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_exc_default_phash_overrides_no_phash": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_exc_multiview_replaces_existing_securedview": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_exc_multiview_replaces_existing_view": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_exc_multiview_replaces_multiviews": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_exc_multiview_replaces_only_exc_multiview": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_exc_mulview_replaces_existing_view_with___accept__": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_exc_same_phash_overrides_existing_single_view": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_exc_with_accept_multiview_replaces_existing_view": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_exception_only": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_exception_only_misconfiguration": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_exception_only_no_regular_view": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_exception_register_secured_view": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_for__as_dottedname": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_for_as_class": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_for_as_iface": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_mixed_case_replaces_existing_view": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_multiview___discriminator__": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_multiview_call_ordering": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_multiview_context_superclass_then_subclass": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_multiview_exception_superclass_then_subclass": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_multiview_replaces_existing_securedview": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_multiview_replaces_existing_view": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_multiview_replaces_existing_view_with___accept__": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_multiview_replaces_multiview": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_register_secured_view": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_same_phash_overrides_existing_single_view": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_same_predicates": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_view_callable_None_no_renderer": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_view_callable_None_with_renderer": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_view_callable_dottedname": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_accept_match": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_accept_multiview_replaces_existing_view": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_accept_nomatch": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_check_csrf_predicates_match": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_containment_dottedname": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_containment_false": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_containment_true": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_csrf_header": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_csrf_param": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_custom_predicates_match": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_custom_predicates_nomatch": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_decorator": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_decorator_tuple": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_default_permission_no_explicit_permission": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_default_renderer": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_function_callable": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_function_callable_requestonly": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_header_badregex": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_header_noval_match": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_header_noval_nomatch": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_header_val_match": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_header_val_missing": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_header_val_nomatch": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_http_cache": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_mapper": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_missing_csrf_header": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_name": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_name_unicode": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_no_default_permission_no_explicit_permission": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_nonexistant_route_name": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_path_info_badregex": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_path_info_match": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_path_info_nomatch": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_permission": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_request_method_false": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_request_method_get_implies_head": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_request_method_sequence_conflict": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_request_method_sequence_false": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_request_method_sequence_true": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_request_method_true": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_request_param_noval_false": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_request_param_noval_true": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_request_param_val_false": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_request_param_val_true": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_request_type": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_request_type_and_route_name": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_request_type_as_iface": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_request_type_as_noniface": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_route_name": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_route_name_exception": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_tmpl_renderer_factory_introspector_missing": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_tmpl_renderer_factory_no_renderer_factory": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_tmpl_renderer_factory_with_renderer_factory": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_view_config_and_view_defaults_conflicts": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_view_config_and_view_defaults_doesnt_conflict": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_view_defaults": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_view_defaults_viewname_is_dottedname_kwarg": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_view_defaults_viewname_is_dottedname_nonkwarg": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_xhr_false": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_xhr_true": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_wrapped_view_is_decorated": "PASSED",
    "TestViewsConfigurationMixin.test_add_views_with_accept_multiview_replaces_existing": "PASSED",
    "TestViewsConfigurationMixin.test_derive_view_dottedname": "PASSED",
    "TestViewsConfigurationMixin.test_derive_view_function": "PASSED",
    "TestViewsConfigurationMixin.test_derive_view_with_default_renderer_no_explicit_renderer": "PASSED",
    "TestViewsConfigurationMixin.test_derive_view_with_default_renderer_with_explicit_renderer": "PASSED",
    "TestViewsConfigurationMixin.test_set_view_mapper": "PASSED",
    "TestViewsConfigurationMixin.test_set_view_mapper_dottedname": "PASSED",
    "TestViewsConfigurationMixin.test_view_with_most_specific_predicate": "PASSED",
    "TestViewsConfigurationMixin.test_view_with_most_specific_predicate_with_mismatch": "PASSED",
    "Test_runtime_exc_view.test_call": "PASSED",
    "Test_runtime_exc_view.test_call_dispatches_on_exception": "PASSED",
    "Test_runtime_exc_view.test_permitted": "PASSED",
    "Test_runtime_exc_view.test_permitted_dispatches_on_exception": "PASSED",
    "Test_requestonly.test_defaults": "PASSED",
    "Test_requestonly.test_otherattr": "PASSED",
    "Test_isexception.test_is_IException": "PASSED",
    "Test_isexception.test_is_IException_subinterface": "PASSED",
    "Test_isexception.test_is_exception_class": "PASSED",
    "Test_isexception.test_is_exception_instance": "PASSED",
    "TestMultiView.test___call__": "PASSED",
    "TestMultiView.test___call__intermediate_not_found": "PASSED",
    "TestMultiView.test___call__raise_not_found_isnt_interpreted_as_pred_mismatch": "PASSED",
    "TestMultiView.test___call_permissive_has_call_permissive": "PASSED",
    "TestMultiView.test___call_permissive_has_no_call_permissive": "PASSED",
    "TestMultiView.test__call__not_found": "PASSED",
    "TestMultiView.test__call__with_accept_match": "PASSED",
    "TestMultiView.test__call__with_accept_miss": "PASSED",
    "TestMultiView.test__call_permissive__not_found": "PASSED",
    "TestMultiView.test_add": "PASSED",
    "TestMultiView.test_add_with_phash": "PASSED",
    "TestMultiView.test_add_with_phash_override_accept": "PASSED",
    "TestMultiView.test_add_with_phash_override_accept2": "PASSED",
    "TestMultiView.test_class_implements_ISecuredView": "PASSED",
    "TestMultiView.test_get_views": "PASSED",
    "TestMultiView.test_get_views_best_match_returns_None": "PASSED",
    "TestMultiView.test_get_views_no_self_accepts": "PASSED",
    "TestMultiView.test_get_views_request_has_no_accept": "PASSED",
    "TestMultiView.test_instance_implements_ISecuredView": "PASSED",
    "TestMultiView.test_match_not_found": "PASSED",
    "TestMultiView.test_match_predicate_fails": "PASSED",
    "TestMultiView.test_match_predicate_succeeds": "PASSED",
    "TestMultiView.test_multiple_with_functions_as_views": "PASSED",
    "TestMultiView.test_permitted": "PASSED",
    "TestMultiView.test_permitted_no_match_with__permitted__": "PASSED",
    "TestMultiView.test_permitted_no_views": "PASSED",
    "TestDefaultViewMapper.test__view_as_function_with_attr": "PASSED",
    "TestDefaultViewMapper.test_view_as_function_context_and_request": "PASSED",
    "TestDefaultViewMapper.test_view_as_function_requestonly": "PASSED",
    "TestDefaultViewMapper.test_view_as_function_requestonly_with_attr": "PASSED",
    "TestDefaultViewMapper.test_view_as_instance_context_and_request": "PASSED",
    "TestDefaultViewMapper.test_view_as_instance_context_and_request_and_attr": "PASSED",
    "TestDefaultViewMapper.test_view_as_instance_requestonly": "PASSED",
    "TestDefaultViewMapper.test_view_as_instance_requestonly_with_attr": "PASSED",
    "TestDefaultViewMapper.test_view_as_newstyle_class_context_and_request": "PASSED",
    "TestDefaultViewMapper.test_view_as_newstyle_class_context_and_request_with_attr": "PASSED",
    "TestDefaultViewMapper.test_view_as_newstyle_class_requestonly": "PASSED",
    "TestDefaultViewMapper.test_view_as_newstyle_class_requestonly_with_attr": "PASSED",
    "TestDefaultViewMapper.test_view_as_oldstyle_class_context_and_request": "PASSED",
    "TestDefaultViewMapper.test_view_as_oldstyle_class_context_and_request_with_attr": "PASSED",
    "TestDefaultViewMapper.test_view_as_oldstyle_class_requestonly": "PASSED",
    "TestDefaultViewMapper.test_view_as_oldstyle_class_requestonly_with_attr": "PASSED",
    "Test_preserve_view_attrs.test_it_different": "PASSED",
    "Test_preserve_view_attrs.test_it_different_with_existing_original_view": "PASSED",
    "Test_preserve_view_attrs.test_it_same": "PASSED",
    "Test_preserve_view_attrs.test_it_view_is_None": "PASSED",
    "TestStaticURLInfo.test_add_already_exists": "PASSED",
    "TestStaticURLInfo.test_add_cachebust_prevented": "PASSED",
    "TestStaticURLInfo.test_add_cachebuster": "PASSED",
    "TestStaticURLInfo.test_add_cachebuster_abspath": "PASSED",
    "TestStaticURLInfo.test_add_cachebuster_for_more_specific_path": "PASSED",
    "TestStaticURLInfo.test_add_cachebuster_overwrite": "PASSED",
    "TestStaticURLInfo.test_add_cachebuster_overwrite_explicit": "PASSED",
    "TestStaticURLInfo.test_add_package_root": "PASSED",
    "TestStaticURLInfo.test_add_url_noendslash": "PASSED",
    "TestStaticURLInfo.test_add_url_noscheme": "PASSED",
    "TestStaticURLInfo.test_add_url_withendslash": "PASSED",
    "TestStaticURLInfo.test_add_viewname": "PASSED",
    "TestStaticURLInfo.test_add_viewname_with_context": "PASSED",
    "TestStaticURLInfo.test_add_viewname_with_for_": "PASSED",
    "TestStaticURLInfo.test_add_viewname_with_permission": "PASSED",
    "TestStaticURLInfo.test_add_viewname_with_renderer": "PASSED",
    "TestStaticURLInfo.test_add_viewname_with_route_prefix": "PASSED",
    "TestStaticURLInfo.test_generate_missing": "PASSED",
    "TestStaticURLInfo.test_generate_quoting": "PASSED",
    "TestStaticURLInfo.test_generate_registration_miss": "PASSED",
    "TestStaticURLInfo.test_generate_route_url": "PASSED",
    "TestStaticURLInfo.test_generate_slash_in_name1": "PASSED",
    "TestStaticURLInfo.test_generate_slash_in_name2": "PASSED",
    "TestStaticURLInfo.test_generate_url_cachebust": "PASSED",
    "TestStaticURLInfo.test_generate_url_cachebust_abspath": "PASSED",
    "TestStaticURLInfo.test_generate_url_cachebust_nomatch": "PASSED",
    "TestStaticURLInfo.test_generate_url_quoted_remote": "PASSED",
    "TestStaticURLInfo.test_generate_url_unquoted_local": "PASSED",
    "TestStaticURLInfo.test_generate_url_with_custom_anchor": "PASSED",
    "TestStaticURLInfo.test_generate_url_with_custom_query": "PASSED",
    "TestStaticURLInfo.test_verifyClass": "PASSED",
    "TestStaticURLInfo.test_verifyObject": "PASSED",
    "Test_view_description.test_with_text": "PASSED",
    "TestParseVars.test_parse_vars_bad": "PASSED",
    "TestParseVars.test_parse_vars_good": "PASSED",
    "TestPCreateCommand.test_confirm_override_conflicting_name": "PASSED",
    "TestPCreateCommand.test_force_override_conflicting_name": "PASSED",
    "TestPCreateCommand.test_force_override_site_name": "PASSED",
    "TestPCreateCommand.test_known_scaffold_absolute_path": "PASSED",
    "TestPCreateCommand.test_known_scaffold_multiple_rendered": "PASSED",
    "TestPCreateCommand.test_known_scaffold_single_rendered": "PASSED",
    "TestPCreateCommand.test_known_scaffold_with_path_as_project_target_rendered": "PASSED",
    "TestPCreateCommand.test_no_project_name": "PASSED",
    "TestPCreateCommand.test_run_no_scaffold_name": "PASSED",
    "TestPCreateCommand.test_run_no_scaffold_no_args": "PASSED",
    "TestPCreateCommand.test_run_show_scaffolds_exist": "PASSED",
    "TestPCreateCommand.test_run_show_scaffolds_none_exist": "PASSED",
    "TestPCreateCommand.test_scaffold_with_dev_pyramid_long_version": "PASSED",
    "TestPCreateCommand.test_scaffold_with_dev_pyramid_version": "PASSED",
    "TestPCreateCommand.test_scaffold_with_hyphen_in_project_name": "PASSED",
    "TestPCreateCommand.test_scaffold_with_package_name": "PASSED",
    "TestPCreateCommand.test_scaffold_with_prod_pyramid_long_version": "PASSED",
    "TestPCreateCommand.test_scaffold_with_prod_pyramid_unparsable_version": "PASSED",
    "TestPCreateCommand.test_scaffold_with_prod_pyramid_version": "PASSED",
    "TestPCreateCommand.test_unknown_scaffold_name": "PASSED",
    "Test_main.test_it": "PASSED",
    "TestPDistReportCommand.test_no_dists": "PASSED",
    "TestPDistReportCommand.test_with_dists": "PASSED",
    "TestPRequestCommand.test_command_display_headers": "PASSED",
    "TestPRequestCommand.test_command_has_bad_config_header": "PASSED",
    "TestPRequestCommand.test_command_has_content_type_header_var": "PASSED",
    "TestPRequestCommand.test_command_has_good_header_var": "PASSED",
    "TestPRequestCommand.test_command_has_multiple_header_vars": "PASSED",
    "TestPRequestCommand.test_command_method_configures_logging": "PASSED",
    "TestPRequestCommand.test_command_method_get": "PASSED",
    "TestPRequestCommand.test_command_method_options": "PASSED",
    "TestPRequestCommand.test_command_method_patch": "PASSED",
    "TestPRequestCommand.test_command_method_post": "PASSED",
    "TestPRequestCommand.test_command_method_propfind": "PASSED",
    "TestPRequestCommand.test_command_method_put": "PASSED",
    "TestPRequestCommand.test_command_not_enough_args": "PASSED",
    "TestPRequestCommand.test_command_path_doesnt_start_with_slash": "PASSED",
    "TestPRequestCommand.test_command_response_has_no_charset": "PASSED",
    "TestPRequestCommand.test_command_two_args": "PASSED",
    "TestPRequestCommand.test_command_w_basic_auth": "PASSED",
    "TestPRequestCommand.test_command_with_query_string": "PASSED",
    "TestPRoutesCommand.test__get_mapper": "PASSED",
    "TestPRoutesCommand.test_bad_args": "PASSED",
    "TestPRoutesCommand.test_bad_format": "PASSED",
    "TestPRoutesCommand.test_class_view": "PASSED",
    "TestPRoutesCommand.test_config_format_ini_commas": "PASSED",
    "TestPRoutesCommand.test_config_format_ini_newlines": "PASSED",
    "TestPRoutesCommand.test_config_format_ini_spaces": "PASSED",
    "TestPRoutesCommand.test_good_args": "PASSED",
    "TestPRoutesCommand.test_good_format": "PASSED",
    "TestPRoutesCommand.test_no_mapper": "PASSED",
    "TestPRoutesCommand.test_no_routes": "PASSED",
    "TestPRoutesCommand.test_route_as_wsgiapp": "PASSED",
    "TestPRoutesCommand.test_route_no_view": "PASSED",
    "TestPRoutesCommand.test_route_with_no_slash_prefix": "PASSED",
    "TestPRoutesCommand.test_single_route_multiview_registered": "PASSED",
    "TestPRoutesCommand.test_single_route_no_route_registered": "PASSED",
    "TestPRoutesCommand.test_single_route_no_views_registered": "PASSED",
    "TestPRoutesCommand.test_single_route_one_view_registered_with_factory": "PASSED",
    "TestPRoutesCommand.test_static_routes_included_in_list": "PASSED",
    "TestPServeCommand.test__guess_server_url": "PASSED",
    "TestPServeCommand.test_config_file_finds_open_url": "PASSED",
    "TestPServeCommand.test_config_vars_no_command": "PASSED",
    "TestPServeCommand.test_parse_vars_bad": "PASSED",
    "TestPServeCommand.test_parse_vars_good": "PASSED",
    "TestPServeCommand.test_reload_call_hupper_with_correct_args": "PASSED",
    "TestPServeCommand.test_run_no_args": "PASSED",
    "TestPShellCommand.test_command_custom_section_override": "PASSED",
    "TestPShellCommand.test_command_default_shell_option": "PASSED",
    "TestPShellCommand.test_command_errors_with_unknown_shell": "PASSED",
    "TestPShellCommand.test_command_loads_check_variable_override_order": "PASSED",
    "TestPShellCommand.test_command_loads_custom_items": "PASSED",
    "TestPShellCommand.test_command_loads_default_shell": "PASSED",
    "TestPShellCommand.test_command_loads_ipython": "PASSED",
    "TestPShellCommand.test_command_loads_pythonstartup": "PASSED",
    "TestPShellCommand.test_command_loads_setup_from_options": "PASSED",
    "TestPShellCommand.test_command_setup": "PASSED",
    "TestPShellCommand.test_list_shells": "PASSED",
    "TestPShellCommand.test_shell_entry_points": "PASSED",
    "TestPShellCommand.test_shell_ordering": "PASSED",
    "TestPShellCommand.test_shell_override": "PASSED",
    "Test_python_shell_runner.test_it": "PASSED",
    "TestPTweensCommand.test__get_tweens": "PASSED",
    "TestPTweensCommand.test_command_implicit_and_explicit_tweens": "PASSED",
    "TestPTweensCommand.test_command_implicit_tweens_only": "PASSED",
    "TestPTweensCommand.test_command_no_tweens": "PASSED",
    "TestPViewsCommand.test__find_multi_routes_all_match": "PASSED",
    "TestPViewsCommand.test__find_multi_routes_none_match": "PASSED",
    "TestPViewsCommand.test__find_multi_routes_some_match": "PASSED",
    "TestPViewsCommand.test__find_view_no_match": "PASSED",
    "TestPViewsCommand.test__find_view_no_match_multiview_registered": "PASSED",
    "TestPViewsCommand.test__find_view_route_multiview": "PASSED",
    "TestPViewsCommand.test__find_view_route_multiview_no_view_registered": "PASSED",
    "TestPViewsCommand.test__find_view_route_no_multiview": "PASSED",
    "TestPViewsCommand.test__find_view_traversal": "PASSED",
    "TestPViewsCommand.test__find_view_traversal_multiview": "PASSED",
    "TestPViewsCommand.test_views_command_multi_view_nested": "PASSED",
    "TestPViewsCommand.test_views_command_multiview": "PASSED",
    "TestPViewsCommand.test_views_command_multiview_with_permission": "PASSED",
    "TestPViewsCommand.test_views_command_multiview_with_predicates": "PASSED",
    "TestPViewsCommand.test_views_command_not_found": "PASSED",
    "TestPViewsCommand.test_views_command_not_found_url_starts_without_slash": "PASSED",
    "TestPViewsCommand.test_views_command_single_view_route": "PASSED",
    "TestPViewsCommand.test_views_command_single_view_route_with_route_predicates": "PASSED",
    "TestPViewsCommand.test_views_command_single_view_traversal": "PASSED",
    "TestPViewsCommand.test_views_command_single_view_traversal_with_permission": "PASSED",
    "TestPViewsCommand.test_views_command_single_view_traversal_with_predicates": "PASSED",
    "ConfiguratorTests.test_ctor_no_registry": "FAILED",
    "ConfiguratorTests.test_ctor_noreg_debug_logger_None_default": "FAILED",
    "ConfiguratorTests.test_include_constant_root_package": "FAILED",
    "ConfiguratorTests.test_scan_integration_conflict": "FAILED",
    "ConfiguratorTests.test_setup_registry_debug_logger_None_default": "FAILED",
    "TestConfigurator_add_directive.test_add_directive_with_custom_callable": "FAILED",
    "TestConfigurator_add_directive.test_add_directive_with_partial": "FAILED",
    "TestConfigurator_add_directive.test_extend_with_dotted_name": "FAILED",
    "TestConfigurator_add_directive.test_extend_with_python_callable": "FAILED",
    "TestConfigurator__add_predicate.test_factory_as_dotted_name": "FAILED",
    "AdaptersConfiguratorMixinTests.test_add_resource_url_adapter_dotted_names": "FAILED",
    "AdaptersConfiguratorMixinTests.test_add_resource_url_adapter_introspectables": "FAILED",
    "AdaptersConfiguratorMixinTests.test_add_traverser_dotted_names": "FAILED",
    "TestAssetsConfiguratorMixin.test_override_asset_directory_with_directory": "FAILED",
    "TestAssetsConfiguratorMixin.test_override_asset_directory_with_package": "FAILED",
    "TestAssetsConfiguratorMixin.test_override_asset_file_with_file": "FAILED",
    "TestAssetsConfiguratorMixin.test_override_asset_package_with_directory": "FAILED",
    "TestAssetsConfiguratorMixin.test_override_asset_package_with_package": "FAILED",
    "TestOverrideProvider.test_get_resource_filename_no_overrides": "FAILED",
    "TestOverrideProvider.test_get_resource_filename_override_returns_None": "FAILED",
    "TestPackageAssetSource.test_get_filename": "FAILED",
    "TestPackageAssetSource.test_get_filename_with_prefix": "FAILED",
    "TestI18NConfiguratorMixin.test_add_translation_dirs_abspath": "FAILED",
    "TestI18NConfiguratorMixin.test_add_translation_dirs_asset_spec": "FAILED",
    "TestI18NConfiguratorMixin.test_add_translation_dirs_asset_spec_existing_translation_dirs": "FAILED",
    "TestI18NConfiguratorMixin.test_add_translation_dirs_doesnt_use_override_w_autocommit": "FAILED",
    "TestI18NConfiguratorMixin.test_add_translation_dirs_multiple_specs": "FAILED",
    "TestI18NConfiguratorMixin.test_add_translation_dirs_multiple_specs_multiple_calls": "FAILED",
    "TestI18NConfiguratorMixin.test_add_translation_dirs_override_multiple_specs_multiple_calls": "FAILED",
    "TestI18NConfiguratorMixin.test_add_translation_dirs_uses_override_out_of_order": "FAILED",
    "TestI18NConfiguratorMixin.test_add_translation_dirs_uses_override_w_autocommit": "FAILED",
    "TestViewsConfigurationMixin.test_add_static_view_package_here_relative": "FAILED",
    "TestViewsConfigurationMixin.test_add_view_with_template_renderer": "FAILED",
    "TestViewsConfigurationMixin.test_add_view_with_template_renderer_no_callable": "FAILED",
    "TestStaticURLInfo.test_generate_url_cachebust_with_overrides": "FAILED",
    "Test_view_description.test_without_text": "FAILED",
    "TestPRoutesCommand.test_one_route_all_methods_view_only_post": "FAILED",
    "TestPRoutesCommand.test_one_route_only_post_view_all_methods": "FAILED",
    "TestPRoutesCommand.test_one_route_only_post_view_post_and_get": "FAILED",
    "TestPRoutesCommand.test_one_route_with_long_name_one_view_registered": "FAILED",
    "TestPRoutesCommand.test_route_is_get_view_request_method_not_post": "FAILED",
    "TestPRoutesCommand.test_route_request_method_mismatch": "FAILED",
    "TestPRoutesCommand.test_route_static_views": "FAILED",
    "TestPRoutesCommand.test_single_route_one_view_registered": "FAILED",
    "TestPRoutesCommand.test_view_glob": "FAILED",
    "TestPRoutesCommand.test_view_request_method_not_post": "FAILED",
    "TestPServeCommand.test_config_file_finds_watch_files": "FAILED",
    "TestPViewsCommand.test_views_command_single_view_function_traversal": "FAILED"
}
diff --git a/pyramid/config/__init__.py b/pyramid/config/__init__.py
index 304d3a85e..6c661aa59 100644
--- a/pyramid/config/__init__.py
+++ b/pyramid/config/__init__.py
@@ -753,6 +753,11 @@ class Configurator(
         .. versionadded:: 1.2
            The ``route_prefix`` parameter.
 
+        .. versionchanged:: 1.9
+           The included function is wrapped with a call to
+           :meth:`pyramid.config.Configurator.begin` and
+           :meth:`pyramid.config.Configurator.end` while it is executed.
+
         """
         # """ <-- emacs
 
@@ -802,7 +807,11 @@ class Configurator(
                 )
             configurator.basepath = os.path.dirname(sourcefile)
             configurator.includepath = self.includepath + (spec,)
-            c(configurator)
+            self.begin()
+            try:
+                c(configurator)
+            finally:
+                self.end()
 
     def add_directive(self, name, directive, action_wrap=True):
         """

{"pyramid/config/__init__.py": "import inspect\nimport itertools\nimport logging\nimport operator\nimport os\nimport sys\nimport threading\nimport venusian\n\nfrom webob.exc import WSGIHTTPException as WebobWSGIHTTPException\n\nfrom pyramid.interfaces import (\n    IDebugLogger,\n    IExceptionResponse,\n    IPredicateList,\n    PHASE0_CONFIG,\n    PHASE1_CONFIG,\n    PHASE2_CONFIG,\n    PHASE3_CONFIG,\n    )\n\nfrom pyramid.asset import resolve_asset_spec\n\nfrom pyramid.authorization import ACLAuthorizationPolicy\n\nfrom pyramid.compat import (\n    text_,\n    reraise,\n    string_types,\n    )\n\nfrom pyramid.events import ApplicationCreated\n\nfrom pyramid.exceptions import (\n    ConfigurationConflictError,\n    ConfigurationError,\n    ConfigurationExecutionError,\n    )\n\nfrom pyramid.httpexceptions import default_exceptionresponse_view\n\nfrom pyramid.path import (\n    caller_package,\n    package_of,\n    )\n\nfrom pyramid.registry import (\n    Introspectable,\n    Introspector,\n    Registry,\n    undefer,\n    )\n\nfrom pyramid.router import Router\n\nfrom pyramid.settings import aslist\n\nfrom pyramid.threadlocal import manager\n\nfrom pyramid.util import (\n    ActionInfo,\n    WeakOrderedSet,\n    action_method,\n    object_description,\n    )\n\nfrom pyramid.config.adapters import AdaptersConfiguratorMixin\nfrom pyramid.config.assets import AssetsConfiguratorMixin\nfrom pyramid.config.factories import FactoriesConfiguratorMixin\nfrom pyramid.config.i18n import I18NConfiguratorMixin\nfrom pyramid.config.rendering import RenderingConfiguratorMixin\nfrom pyramid.config.routes import RoutesConfiguratorMixin\nfrom pyramid.config.security import SecurityConfiguratorMixin\nfrom pyramid.config.settings import SettingsConfiguratorMixin\nfrom pyramid.config.testing import TestingConfiguratorMixin\nfrom pyramid.config.tweens import TweensConfiguratorMixin\nfrom pyramid.config.util import PredicateList, not_\nfrom pyramid.config.views import ViewsConfiguratorMixin\nfrom pyramid.config.zca import ZCAConfiguratorMixin\n\nfrom pyramid.path import DottedNameResolver\n\nempty = text_('')\n_marker = object()\n\nConfigurationError = ConfigurationError # pyflakes\n\nnot_ = not_ # pyflakes, this is an API\n\nPHASE0_CONFIG = PHASE0_CONFIG  # api\nPHASE1_CONFIG = PHASE1_CONFIG  # api\nPHASE2_CONFIG = PHASE2_CONFIG  # api\nPHASE3_CONFIG = PHASE3_CONFIG  # api\n\nclass Configurator(\n    TestingConfiguratorMixin,\n    TweensConfiguratorMixin,\n    SecurityConfiguratorMixin,\n    ViewsConfiguratorMixin,\n    RoutesConfiguratorMixin,\n    ZCAConfiguratorMixin,\n    I18NConfiguratorMixin,\n    RenderingConfiguratorMixin,\n    AssetsConfiguratorMixin,\n    SettingsConfiguratorMixin,\n    FactoriesConfiguratorMixin,\n    AdaptersConfiguratorMixin,\n    ):\n    \"\"\"\n    A Configurator is used to configure a :app:`Pyramid`\n    :term:`application registry`.\n\n    If the ``registry`` argument is not ``None``, it must\n    be an instance of the :class:`pyramid.registry.Registry` class\n    representing the registry to configure.  If ``registry`` is ``None``, the\n    configurator will create a :class:`pyramid.registry.Registry` instance\n    itself; it will also perform some default configuration that would not\n    otherwise be done.  After its construction, the configurator may be used\n    to add further configuration to the registry.\n\n    .. warning:: If ``registry`` is assigned the above-mentioned class\n       instance, all other constructor arguments are ignored,\n       with the exception of ``package``.\n\n    If the ``package`` argument is passed, it must be a reference to a Python\n    :term:`package` (e.g. ``sys.modules['thepackage']``) or a :term:`dotted\n    Python name` to the same.  This value is used as a basis to convert\n    relative paths passed to various configuration methods, such as methods\n    which accept a ``renderer`` argument, into absolute paths.  If ``None``\n    is passed (the default), the package is assumed to be the Python package\n    in which the *caller* of the ``Configurator`` constructor lives.\n\n    If the ``root_package`` is passed, it will propagate through the\n    configuration hierarchy as a way for included packages to locate\n    resources relative to the package in which the main ``Configurator`` was\n    created. If ``None`` is passed (the default), the ``root_package`` will\n    be derived from the ``package`` argument. The ``package`` attribute is\n    always pointing at the package being included when using :meth:`.include`,\n    whereas the ``root_package`` does not change.\n\n    If the ``settings`` argument is passed, it should be a Python dictionary\n    representing the :term:`deployment settings` for this application.  These\n    are later retrievable using the\n    :attr:`pyramid.registry.Registry.settings` attribute (aka\n    ``request.registry.settings``).\n\n    If the ``root_factory`` argument is passed, it should be an object\n    representing the default :term:`root factory` for your application or a\n    :term:`dotted Python name` to the same.  If it is ``None``, a default\n    root factory will be used.\n\n    If ``authentication_policy`` is passed, it should be an instance\n    of an :term:`authentication policy` or a :term:`dotted Python\n    name` to the same.\n\n    If ``authorization_policy`` is passed, it should be an instance of\n    an :term:`authorization policy` or a :term:`dotted Python name` to\n    the same.\n\n    .. note:: A ``ConfigurationError`` will be raised when an\n       authorization policy is supplied without also supplying an\n       authentication policy (authorization requires authentication).\n\n    If ``renderers`` is ``None`` (the default), a default set of\n    :term:`renderer` factories is used. Else, it should be a list of\n    tuples representing a set of renderer factories which should be\n    configured into this application, and each tuple representing a set of\n    positional values that should be passed to\n    :meth:`pyramid.config.Configurator.add_renderer`.\n\n    If ``debug_logger`` is not passed, a default debug logger that logs to a\n    logger will be used (the logger name will be the package name of the\n    *caller* of this configurator).  If it is passed, it should be an\n    instance of the :class:`logging.Logger` (PEP 282) standard library class\n    or a Python logger name.  The debug logger is used by :app:`Pyramid`\n    itself to log warnings and authorization debugging information.\n\n    If ``locale_negotiator`` is passed, it should be a :term:`locale\n    negotiator` implementation or a :term:`dotted Python name` to\n    same.  See :ref:`custom_locale_negotiator`.\n\n    If ``request_factory`` is passed, it should be a :term:`request\n    factory` implementation or a :term:`dotted Python name` to the same.\n    See :ref:`changing_the_request_factory`.  By default it is ``None``,\n    which means use the default request factory.\n\n    If ``response_factory`` is passed, it should be a :term:`response\n    factory` implementation or a :term:`dotted Python name` to the same.\n    See :ref:`changing_the_response_factory`.  By default it is ``None``,\n    which means use the default response factory.\n\n    If ``default_permission`` is passed, it should be a\n    :term:`permission` string to be used as the default permission for\n    all view configuration registrations performed against this\n    Configurator.  An example of a permission string:``'view'``.\n    Adding a default permission makes it unnecessary to protect each\n    view configuration with an explicit permission, unless your\n    application policy requires some exception for a particular view.\n    By default, ``default_permission`` is ``None``, meaning that view\n    configurations which do not explicitly declare a permission will\n    always be executable by entirely anonymous users (any\n    authorization policy in effect is ignored).\n\n    .. seealso::\n\n        See also :ref:`setting_a_default_permission`.\n\n    If ``session_factory`` is passed, it should be an object which\n    implements the :term:`session factory` interface.  If a nondefault\n    value is passed, the ``session_factory`` will be used to create a\n    session object when ``request.session`` is accessed.  Note that\n    the same outcome can be achieved by calling\n    :meth:`pyramid.config.Configurator.set_session_factory`.  By\n    default, this argument is ``None``, indicating that no session\n    factory will be configured (and thus accessing ``request.session``\n    will throw an error) unless ``set_session_factory`` is called later\n    during configuration.\n\n    If ``autocommit`` is ``True``, every method called on the configurator\n    will cause an immediate action, and no configuration conflict detection\n    will be used. If ``autocommit`` is ``False``, most methods of the\n    configurator will defer their action until\n    :meth:`pyramid.config.Configurator.commit` is called.  When\n    :meth:`pyramid.config.Configurator.commit` is called, the actions implied\n    by the called methods will be checked for configuration conflicts unless\n    ``autocommit`` is ``True``.  If a conflict is detected, a\n    ``ConfigurationConflictError`` will be raised.  Calling\n    :meth:`pyramid.config.Configurator.make_wsgi_app` always implies a final\n    commit.\n\n    If ``default_view_mapper`` is passed, it will be used as the default\n    :term:`view mapper` factory for view configurations that don't otherwise\n    specify one (see :class:`pyramid.interfaces.IViewMapperFactory`).  If\n    ``default_view_mapper`` is not passed, a superdefault view mapper will be\n    used.\n\n    If ``exceptionresponse_view`` is passed, it must be a :term:`view\n    callable` or ``None``.  If it is a view callable, it will be used as an\n    exception view callable when an :term:`exception response` is raised. If\n    ``exceptionresponse_view`` is ``None``, no exception response view will\n    be registered, and all raised exception responses will be bubbled up to\n    Pyramid's caller.  By\n    default, the ``pyramid.httpexceptions.default_exceptionresponse_view``\n    function is used as the ``exceptionresponse_view``.\n\n    If ``route_prefix`` is passed, all routes added with\n    :meth:`pyramid.config.Configurator.add_route` will have the specified path\n    prepended to their pattern.\n\n    If ``introspection`` is passed, it must be a boolean value.  If it's\n    ``True``, introspection values during actions will be kept for use\n    for tools like the debug toolbar.  If it's ``False``, introspection\n    values provided by registrations will be ignored.  By default, it is\n    ``True``.\n\n    .. versionadded:: 1.1\n       The ``exceptionresponse_view`` argument.\n\n    .. versionadded:: 1.2\n       The ``route_prefix`` argument.\n\n    .. versionadded:: 1.3\n       The ``introspection`` argument.\n\n    .. versionadded:: 1.6\n       The ``root_package`` argument.\n       The ``response_factory`` argument.\n    \"\"\"\n    manager = manager # for testing injection\n    venusian = venusian # for testing injection\n    _ainfo = None\n    basepath = None\n    includepath = ()\n    info = ''\n    object_description = staticmethod(object_description)\n    introspectable = Introspectable\n    inspect = inspect\n\n    def __init__(self,\n                 registry=None,\n                 package=None,\n                 settings=None,\n                 root_factory=None,\n                 authentication_policy=None,\n                 authorization_policy=None,\n                 renderers=None,\n                 debug_logger=None,\n                 locale_negotiator=None,\n                 request_factory=None,\n                 response_factory=None,\n                 default_permission=None,\n                 session_factory=None,\n                 default_view_mapper=None,\n                 autocommit=False,\n                 exceptionresponse_view=default_exceptionresponse_view,\n                 route_prefix=None,\n                 introspection=True,\n                 root_package=None,\n                 ):\n        if package is None:\n            package = caller_package()\n        if root_package is None:\n            root_package = package\n        name_resolver = DottedNameResolver(package)\n        self.name_resolver = name_resolver\n        self.package_name = name_resolver.get_package_name()\n        self.package = name_resolver.get_package()\n        self.root_package = root_package\n        self.registry = registry\n        self.autocommit = autocommit\n        self.route_prefix = route_prefix\n        self.introspection = introspection\n        if registry is None:\n            registry = Registry(self.package_name)\n            self.registry = registry\n            self.setup_registry(\n                settings=settings,\n                root_factory=root_factory,\n                authentication_policy=authentication_policy,\n                authorization_policy=authorization_policy,\n                renderers=renderers,\n                debug_logger=debug_logger,\n                locale_negotiator=locale_negotiator,\n                request_factory=request_factory,\n                response_factory=response_factory,\n                default_permission=default_permission,\n                session_factory=session_factory,\n                default_view_mapper=default_view_mapper,\n                exceptionresponse_view=exceptionresponse_view,\n                )\n\n    def setup_registry(self,\n                       settings=None,\n                       root_factory=None,\n                       authentication_policy=None,\n                       authorization_policy=None,\n                       renderers=None,\n                       debug_logger=None,\n                       locale_negotiator=None,\n                       request_factory=None,\n                       response_factory=None,\n                       default_permission=None,\n                       session_factory=None,\n                       default_view_mapper=None,\n                       exceptionresponse_view=default_exceptionresponse_view,\n                       ):\n        \"\"\" When you pass a non-``None`` ``registry`` argument to the\n        :term:`Configurator` constructor, no initial setup is performed\n        against the registry.  This is because the registry you pass in may\n        have already been initialized for use under :app:`Pyramid` via a\n        different configurator.  However, in some circumstances (such as when\n        you want to use a global registry instead of a registry created as a\n        result of the Configurator constructor), or when you want to reset\n        the initial setup of a registry, you *do* want to explicitly\n        initialize the registry associated with a Configurator for use under\n        :app:`Pyramid`.  Use ``setup_registry`` to do this initialization.\n\n        ``setup_registry`` configures settings, a root factory, security\n        policies, renderers, a debug logger, a locale negotiator, and various\n        other settings using the configurator's current registry, as per the\n        descriptions in the Configurator constructor.\"\"\"\n\n        registry = self.registry\n\n        self._fix_registry()\n\n        self._set_settings(settings)\n\n        if isinstance(debug_logger, string_types):\n            debug_logger = logging.getLogger(debug_logger)\n\n        if debug_logger is None:\n            debug_logger = logging.getLogger(self.package_name)\n\n        registry.registerUtility(debug_logger, IDebugLogger)\n\n        self.add_default_response_adapters()\n        self.add_default_renderers()\n        self.add_default_view_predicates()\n        self.add_default_view_derivers()\n        self.add_default_route_predicates()\n        self.add_default_tweens()\n\n        if exceptionresponse_view is not None:\n            exceptionresponse_view = self.maybe_dotted(exceptionresponse_view)\n            self.add_view(exceptionresponse_view, context=IExceptionResponse)\n            self.add_view(exceptionresponse_view,context=WebobWSGIHTTPException)\n\n        # commit below because:\n        #\n        # - the default exceptionresponse_view requires the superdefault view\n        #   mapper, so we need to configure it before adding default_view_mapper\n        #\n        # - superdefault renderers should be overrideable without requiring\n        #   the user to commit before calling config.add_renderer\n\n        self.commit()\n\n        # self.commit() should not be called within this method after this\n        # point because the following registrations should be treated as\n        # analogues of methods called by the user after configurator\n        # construction.  Rationale: user-supplied implementations should be\n        # preferred rather than add-on author implementations with the help of\n        # automatic conflict resolution.\n\n        if authentication_policy and not authorization_policy:\n            authorization_policy = ACLAuthorizationPolicy() # default\n\n        if authorization_policy:\n            self.set_authorization_policy(authorization_policy)\n\n        if authentication_policy:\n            self.set_authentication_policy(authentication_policy)\n\n        if default_view_mapper is not None:\n            self.set_view_mapper(default_view_mapper)\n\n        if renderers:\n            for name, renderer in renderers:\n                self.add_renderer(name, renderer)\n\n        if root_factory is not None:\n            self.set_root_factory(root_factory)\n\n        if locale_negotiator:\n            self.set_locale_negotiator(locale_negotiator)\n\n        if request_factory:\n            self.set_request_factory(request_factory)\n\n        if response_factory:\n            self.set_response_factory(response_factory)\n\n        if default_permission:\n            self.set_default_permission(default_permission)\n\n        if session_factory is not None:\n            self.set_session_factory(session_factory)\n\n        tweens = aslist(registry.settings.get('pyramid.tweens', []))\n        for factory in tweens:\n            self._add_tween(factory, explicit=True)\n\n        includes = aslist(registry.settings.get('pyramid.includes', []))\n        for inc in includes:\n            self.include(inc)\n\n    def _make_spec(self, path_or_spec):\n        package, filename = resolve_asset_spec(path_or_spec, self.package_name)\n        if package is None:\n            return filename # absolute filename\n        return '%s:%s' % (package, filename)\n\n    def _fix_registry(self):\n        \"\"\" Fix up a ZCA component registry that is not a\n        pyramid.registry.Registry by adding analogues of ``has_listeners``,\n        ``notify``, ``queryAdapterOrSelf``, and ``registerSelfAdapter``\n        through monkey-patching.\"\"\"\n\n        _registry = self.registry\n\n        if not hasattr(_registry, 'notify'):\n            def notify(*events):\n                [ _ for _ in _registry.subscribers(events, None) ]\n            _registry.notify = notify\n\n        if not hasattr(_registry, 'has_listeners'):\n            _registry.has_listeners = True\n\n        if not hasattr(_registry, 'queryAdapterOrSelf'):\n            def queryAdapterOrSelf(object, interface, default=None):\n                if not interface.providedBy(object):\n                    return _registry.queryAdapter(object, interface,\n                                                  default=default)\n                return object\n            _registry.queryAdapterOrSelf = queryAdapterOrSelf\n\n        if not hasattr(_registry, 'registerSelfAdapter'):\n            def registerSelfAdapter(required=None, provided=None,\n                                    name=empty, info=empty, event=True):\n                return _registry.registerAdapter(lambda x: x,\n                                                 required=required,\n                                                 provided=provided, name=name,\n                                                 info=info, event=event)\n            _registry.registerSelfAdapter = registerSelfAdapter\n\n        if not hasattr(_registry, '_lock'):\n            _registry._lock = threading.Lock()\n\n        if not hasattr(_registry, '_clear_view_lookup_cache'):\n            def _clear_view_lookup_cache():\n                _registry._view_lookup_cache = {}\n            _registry._clear_view_lookup_cache = _clear_view_lookup_cache\n\n\n    # API\n\n    def _get_introspector(self):\n        introspector = getattr(self.registry, 'introspector', _marker)\n        if introspector is _marker:\n            introspector = Introspector()\n            self._set_introspector(introspector)\n        return introspector\n\n    def _set_introspector(self, introspector):\n        self.registry.introspector = introspector\n\n    def _del_introspector(self):\n        del self.registry.introspector\n\n    introspector = property(\n        _get_introspector, _set_introspector, _del_introspector\n        )\n\n    def get_predlist(self, name):\n        predlist = self.registry.queryUtility(IPredicateList, name=name)\n        if predlist is None:\n            predlist = PredicateList()\n            self.registry.registerUtility(predlist, IPredicateList, name=name)\n        return predlist\n\n\n    def _add_predicate(self, type, name, factory, weighs_more_than=None,\n                       weighs_less_than=None):\n        factory = self.maybe_dotted(factory)\n        discriminator = ('%s option' % type, name)\n        intr = self.introspectable(\n            '%s predicates' % type,\n            discriminator,\n            '%s predicate named %s' % (type, name),\n            '%s predicate' % type)\n        intr['name'] = name\n        intr['factory'] = factory\n        intr['weighs_more_than'] = weighs_more_than\n        intr['weighs_less_than'] = weighs_less_than\n        def register():\n            predlist = self.get_predlist(type)\n            predlist.add(name, factory, weighs_more_than=weighs_more_than,\n                         weighs_less_than=weighs_less_than)\n        self.action(discriminator, register, introspectables=(intr,),\n                    order=PHASE1_CONFIG) # must be registered early\n\n    @property\n    def action_info(self):\n        info = self.info # usually a ZCML action (ParserInfo) if self.info\n        if not info:\n            # Try to provide more accurate info for conflict reports\n            if self._ainfo:\n                info = self._ainfo[0]\n            else:\n                info = ActionInfo(None, 0, '', '')\n        return info\n\n    def action(self, discriminator, callable=None, args=(), kw=None, order=0,\n               introspectables=(), **extra):\n        \"\"\" Register an action which will be executed when\n        :meth:`pyramid.config.Configurator.commit` is called (or executed\n        immediately if ``autocommit`` is ``True``).\n\n        .. warning:: This method is typically only used by :app:`Pyramid`\n           framework extension authors, not by :app:`Pyramid` application\n           developers.\n\n        The ``discriminator`` uniquely identifies the action.  It must be\n        given, but it can be ``None``, to indicate that the action never\n        conflicts.  It must be a hashable value.\n\n        The ``callable`` is a callable object which performs the task\n        associated with the action when the action is executed.  It is\n        optional.\n\n        ``args`` and ``kw`` are tuple and dict objects respectively, which\n        are passed to ``callable`` when this action is executed.  Both are\n        optional.\n\n        ``order`` is a grouping mechanism; an action with a lower order will\n        be executed before an action with a higher order (has no effect when\n        autocommit is ``True``).\n\n        ``introspectables`` is a sequence of :term:`introspectable` objects\n        (or the empty sequence if no introspectable objects are associated\n        with this action).  If this configurator's ``introspection``\n        attribute is ``False``, these introspectables will be ignored.\n\n        ``extra`` provides a facility for inserting extra keys and values\n        into an action dictionary.\n        \"\"\"\n        # catch nonhashable discriminators here; most unit tests use\n        # autocommit=False, which won't catch unhashable discriminators\n        assert hash(discriminator) \n\n        if kw is None:\n            kw = {}\n\n        autocommit = self.autocommit\n        action_info = self.action_info\n\n        if not self.introspection:\n            # if we're not introspecting, ignore any introspectables passed\n            # to us\n            introspectables = ()\n\n        if autocommit:\n            # callables can depend on the side effects of resolving a\n            # deferred discriminator\n            self.begin()\n            try:\n                undefer(discriminator)\n                if callable is not None:\n                    callable(*args, **kw)\n                for introspectable in introspectables:\n                    introspectable.register(self.introspector, action_info)\n            finally:\n                self.end()\n\n        else:\n            action = extra\n            action.update(\n                dict(\n                    discriminator=discriminator,\n                    callable=callable,\n                    args=args,\n                    kw=kw,\n                    order=order,\n                    info=action_info,\n                    includepath=self.includepath,\n                    introspectables=introspectables,\n                    )\n                )\n            self.action_state.action(**action)\n\n    def _get_action_state(self):\n        registry = self.registry\n        try:\n            state = registry.action_state\n        except AttributeError:\n            state = ActionState()\n            registry.action_state = state\n        return state\n\n    def _set_action_state(self, state):\n        self.registry.action_state = state\n\n    action_state = property(_get_action_state, _set_action_state)\n\n    _ctx = action_state # bw compat\n\n    def commit(self):\n        \"\"\" Commit any pending configuration actions. If a configuration\n        conflict is detected in the pending configuration actions, this method\n        will raise a :exc:`ConfigurationConflictError`; within the traceback\n        of this error will be information about the source of the conflict,\n        usually including file names and line numbers of the cause of the\n        configuration conflicts.\"\"\"\n        self.begin()\n        try:\n            self.action_state.execute_actions(introspector=self.introspector)\n        finally:\n            self.end()\n        self.action_state = ActionState() # old actions have been processed\n\n    def include(self, callable, route_prefix=None):\n        \"\"\"Include a configuration callable, to support imperative\n        application extensibility.\n\n        .. warning:: In versions of :app:`Pyramid` prior to 1.2, this\n            function accepted ``*callables``, but this has been changed\n            to support only a single callable.\n\n        A configuration callable should be a callable that accepts a single\n        argument named ``config``, which will be an instance of a\n        :term:`Configurator`.  However, be warned that it will not be the same\n        configurator instance on which you call this method.  The\n        code which runs as a result of calling the callable should invoke\n        methods on the configurator passed to it which add configuration\n        state.  The return value of a callable will be ignored.\n\n        Values allowed to be presented via the ``callable`` argument to\n        this method: any callable Python object or any :term:`dotted Python\n        name` which resolves to a callable Python object.  It may also be a\n        Python :term:`module`, in which case, the module will be searched for\n        a callable named ``includeme``, which will be treated as the\n        configuration callable.\n\n        For example, if the ``includeme`` function below lives in a module\n        named ``myapp.myconfig``:\n\n        .. code-block:: python\n           :linenos:\n\n           # myapp.myconfig module\n\n           def my_view(request):\n               from pyramid.response import Response\n               return Response('OK')\n\n           def includeme(config):\n               config.add_view(my_view)\n\n        You might cause it to be included within your Pyramid application like\n        so:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include('myapp.myconfig.includeme')\n\n        Because the function is named ``includeme``, the function name can\n        also be omitted from the dotted name reference:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include('myapp.myconfig')\n\n        Included configuration statements will be overridden by local\n        configuration statements if an included callable causes a\n        configuration conflict by registering something with the same\n        configuration parameters.\n\n        If the ``route_prefix`` is supplied, it must be a string.  Any calls\n        to :meth:`pyramid.config.Configurator.add_route` within the included\n        callable will have their pattern prefixed with the value of\n        ``route_prefix``. This can be used to help mount a set of routes at a\n        different location than the included callable's author intended, while\n        still maintaining the same route names.  For example:\n\n        .. code-block:: python\n           :linenos:\n\n           from pyramid.config import Configurator\n\n           def included(config):\n               config.add_route('show_users', '/show')\n\n           def main(global_config, **settings):\n               config = Configurator()\n               config.include(included, route_prefix='/users')\n\n        In the above configuration, the ``show_users`` route will have an\n        effective route pattern of ``/users/show``, instead of ``/show``\n        because the ``route_prefix`` argument will be prepended to the\n        pattern.\n\n        .. versionadded:: 1.2\n           The ``route_prefix`` parameter.\n\n        \"\"\"\n        # \"\"\" <-- emacs\n\n        action_state = self.action_state\n\n        if route_prefix is None:\n            route_prefix = ''\n\n        old_route_prefix = self.route_prefix\n        if old_route_prefix is None:\n            old_route_prefix = ''\n\n        route_prefix = '%s/%s' % (\n            old_route_prefix.rstrip('/'),\n            route_prefix.lstrip('/')\n            )\n        route_prefix = route_prefix.strip('/')\n        if not route_prefix:\n            route_prefix = None\n\n        c = self.maybe_dotted(callable)\n        module = self.inspect.getmodule(c)\n        if module is c:\n            try:\n                c = getattr(module, 'includeme')\n            except AttributeError:\n                raise ConfigurationError(\n                    \"module %r has no attribute 'includeme'\" % (module.__name__)\n                    )\n                                                       \n        spec = module.__name__ + ':' + c.__name__\n        sourcefile = self.inspect.getsourcefile(c)\n\n        if sourcefile is None:\n            raise ConfigurationError(\n                'No source file for module %r (.py file must exist, '\n                'refusing to use orphan .pyc or .pyo file).' % module.__name__)\n            \n\n        if action_state.processSpec(spec):\n            configurator = self.__class__(\n                registry=self.registry,\n                package=package_of(module),\n                root_package=self.root_package,\n                autocommit=self.autocommit,\n                route_prefix=route_prefix,\n                )\n            configurator.basepath = os.path.dirname(sourcefile)\n            configurator.includepath = self.includepath + (spec,)\n            c(configurator)\n\n    def add_directive(self, name, directive, action_wrap=True):\n        \"\"\"\n        Add a directive method to the configurator.\n\n        .. warning:: This method is typically only used by :app:`Pyramid`\n           framework extension authors, not by :app:`Pyramid` application\n           developers.\n\n        Framework extenders can add directive methods to a configurator by\n        instructing their users to call ``config.add_directive('somename',\n        'some.callable')``.  This will make ``some.callable`` accessible as\n        ``config.somename``.  ``some.callable`` should be a function which\n        accepts ``config`` as a first argument, and arbitrary positional and\n        keyword arguments following.  It should use config.action as\n        necessary to perform actions.  Directive methods can then be invoked\n        like 'built-in' directives such as ``add_view``, ``add_route``, etc.\n\n        The ``action_wrap`` argument should be ``True`` for directives which\n        perform ``config.action`` with potentially conflicting\n        discriminators.  ``action_wrap`` will cause the directive to be\n        wrapped in a decorator which provides more accurate conflict\n        cause information.\n\n        ``add_directive`` does not participate in conflict detection, and\n        later calls to ``add_directive`` will override earlier calls.\n        \"\"\"\n        c = self.maybe_dotted(directive)\n        if not hasattr(self.registry, '_directives'):\n            self.registry._directives = {}\n        self.registry._directives[name] = (c, action_wrap)\n\n    def __getattr__(self, name):\n        # allow directive extension names to work\n        directives = getattr(self.registry, '_directives', {})\n        c = directives.get(name)\n        if c is None:\n            raise AttributeError(name)\n        c, action_wrap = c\n        if action_wrap:\n            c = action_method(c)\n        # Create a bound method (works on both Py2 and Py3)\n        # http://stackoverflow.com/a/1015405/209039\n        m = c.__get__(self, self.__class__)\n        return m\n\n    def with_package(self, package):\n        \"\"\" Return a new Configurator instance with the same registry\n        as this configurator. ``package`` may be an actual Python package\n        object or a :term:`dotted Python name` representing a package.\"\"\"\n        configurator = self.__class__(\n            registry=self.registry,\n            package=package,\n            root_package=self.root_package,\n            autocommit=self.autocommit,\n            route_prefix=self.route_prefix,\n            introspection=self.introspection,\n            )\n        configurator.basepath = self.basepath\n        configurator.includepath = self.includepath\n        configurator.info = self.info\n        return configurator\n\n    def maybe_dotted(self, dotted):\n        \"\"\" Resolve the :term:`dotted Python name` ``dotted`` to a\n        global Python object.  If ``dotted`` is not a string, return\n        it without attempting to do any name resolution.  If\n        ``dotted`` is a relative dotted name (e.g. ``.foo.bar``,\n        consider it relative to the ``package`` argument supplied to\n        this Configurator's constructor.\"\"\"\n        return self.name_resolver.maybe_resolve(dotted)\n\n    def absolute_asset_spec(self, relative_spec):\n        \"\"\" Resolve the potentially relative :term:`asset\n        specification` string passed as ``relative_spec`` into an\n        absolute asset specification string and return the string.\n        Use the ``package`` of this configurator as the package to\n        which the asset specification will be considered relative\n        when generating an absolute asset specification.  If the\n        provided ``relative_spec`` argument is already absolute, or if\n        the ``relative_spec`` is not a string, it is simply returned.\"\"\"\n        if not isinstance(relative_spec, string_types):\n            return relative_spec\n        return self._make_spec(relative_spec)\n\n    absolute_resource_spec = absolute_asset_spec # b/w compat forever\n\n    def begin(self, request=_marker):\n        \"\"\" Indicate that application or test configuration has begun.\n        This pushes a dictionary containing the :term:`application\n        registry` implied by ``registry`` attribute of this\n        configurator and the :term:`request` implied by the\n        ``request`` argument onto the :term:`thread local` stack\n        consulted by various :mod:`pyramid.threadlocal` API\n        functions.\n\n        If ``request`` is not specified and the registry owned by the\n        configurator is already pushed as the current threadlocal registry\n        then this method will keep the current threadlocal request unchanged.\n\n        .. versionchanged:: 1.8\n           The current threadlocal request is propagated if the current\n           threadlocal registry remains unchanged.\n\n        \"\"\"\n        if request is _marker:\n            current = self.manager.get()\n            if current['registry'] == self.registry:\n                request = current['request']\n            else:\n                request = None\n        self.manager.push({'registry':self.registry, 'request':request})\n\n    def end(self):\n        \"\"\" Indicate that application or test configuration has ended.\n        This pops the last value pushed onto the :term:`thread local`\n        stack (usually by the ``begin`` method) and returns that\n        value.\n        \"\"\"\n        return self.manager.pop()\n\n    # this is *not* an action method (uses caller_package)\n    def scan(self, package=None, categories=None, onerror=None, ignore=None,\n             **kw):\n        \"\"\"Scan a Python package and any of its subpackages for objects\n        marked with :term:`configuration decoration` such as\n        :class:`pyramid.view.view_config`.  Any decorated object found will\n        influence the current configuration state.\n\n        The ``package`` argument should be a Python :term:`package` or module\n        object (or a :term:`dotted Python name` which refers to such a\n        package or module).  If ``package`` is ``None``, the package of the\n        *caller* is used.\n\n        The ``categories`` argument, if provided, should be the\n        :term:`Venusian` 'scan categories' to use during scanning.  Providing\n        this argument is not often necessary; specifying scan categories is\n        an extremely advanced usage.  By default, ``categories`` is ``None``\n        which will execute *all* Venusian decorator callbacks including\n        :app:`Pyramid`-related decorators such as\n        :class:`pyramid.view.view_config`.  See the :term:`Venusian`\n        documentation for more information about limiting a scan by using an\n        explicit set of categories.\n\n        The ``onerror`` argument, if provided, should be a Venusian\n        ``onerror`` callback function.  The onerror function is passed to\n        :meth:`venusian.Scanner.scan` to influence error behavior when an\n        exception is raised during the scanning process.  See the\n        :term:`Venusian` documentation for more information about ``onerror``\n        callbacks.\n\n        The ``ignore`` argument, if provided, should be a Venusian ``ignore``\n        value.  Providing an ``ignore`` argument allows the scan to ignore\n        particular modules, packages, or global objects during a scan.\n        ``ignore`` can be a string or a callable, or a list containing\n        strings or callables.  The simplest usage of ``ignore`` is to provide\n        a module or package by providing a full path to its dotted name.  For\n        example: ``config.scan(ignore='my.module.subpackage')`` would ignore\n        the ``my.module.subpackage`` package during a scan, which would\n        prevent the subpackage and any of its submodules from being imported\n        and scanned.  See the :term:`Venusian` documentation for more\n        information about the ``ignore`` argument.\n\n        To perform a ``scan``, Pyramid creates a Venusian ``Scanner`` object.\n        The ``kw`` argument represents a set of keyword arguments to pass to\n        the Venusian ``Scanner`` object's constructor.  See the\n        :term:`venusian` documentation (its ``Scanner`` class) for more\n        information about the constructor.  By default, the only keyword\n        arguments passed to the Scanner constructor are ``{'config':self}``\n        where ``self`` is this configurator object.  This services the\n        requirement of all built-in Pyramid decorators, but extension systems\n        may require additional arguments.  Providing this argument is not\n        often necessary; it's an advanced usage.\n\n        .. versionadded:: 1.1\n           The ``**kw`` argument.\n\n        .. versionadded:: 1.3\n           The ``ignore`` argument.\n\n        \"\"\"\n        package = self.maybe_dotted(package)\n        if package is None: # pragma: no cover\n            package = caller_package()\n\n        ctorkw = {'config': self}\n        ctorkw.update(kw)\n\n        scanner = self.venusian.Scanner(**ctorkw)\n\n        scanner.scan(package, categories=categories, onerror=onerror,\n                     ignore=ignore)\n\n    def make_wsgi_app(self):\n        \"\"\" Commits any pending configuration statements, sends a\n        :class:`pyramid.events.ApplicationCreated` event to all listeners,\n        adds this configuration's registry to\n        :attr:`pyramid.config.global_registries`, and returns a\n        :app:`Pyramid` WSGI application representing the committed\n        configuration state.\"\"\"\n        self.commit()\n        app = Router(self.registry)\n\n        # Allow tools like \"pshell development.ini\" to find the 'last'\n        # registry configured.\n        global_registries.add(self.registry)\n\n        # Push the registry onto the stack in case any code that depends on\n        # the registry threadlocal APIs used in listeners subscribed to the\n        # IApplicationCreated event.\n        self.begin()\n        try:\n            self.registry.notify(ApplicationCreated(app))\n        finally:\n            self.end()\n\n        return app\n\n\n# this class is licensed under the ZPL (stolen from Zope)\nclass ActionState(object):\n    def __init__(self):\n        # NB \"actions\" is an API, dep'd upon by pyramid_zcml's load_zcml func\n        self.actions = []\n        self._seen_files = set()\n\n    def processSpec(self, spec):\n        \"\"\"Check whether a callable needs to be processed.  The ``spec``\n        refers to a unique identifier for the callable.\n\n        Return True if processing is needed and False otherwise. If\n        the callable needs to be processed, it will be marked as\n        processed, assuming that the caller will procces the callable if\n        it needs to be processed.\n        \"\"\"\n        if spec in self._seen_files:\n            return False\n        self._seen_files.add(spec)\n        return True\n\n    def action(self, discriminator, callable=None, args=(), kw=None, order=0,\n               includepath=(), info=None, introspectables=(), **extra):\n        \"\"\"Add an action with the given discriminator, callable and arguments\n        \"\"\"\n        if kw is None:\n            kw = {}\n        action = extra\n        action.update(\n            dict(\n                discriminator=discriminator,\n                callable=callable,\n                args=args,\n                kw=kw,\n                includepath=includepath,\n                info=info,\n                order=order,\n                introspectables=introspectables,\n                )\n            )\n        self.actions.append(action)\n\n    def execute_actions(self, clear=True, introspector=None):\n        \"\"\"Execute the configuration actions\n\n        This calls the action callables after resolving conflicts\n\n        For example:\n\n        >>> output = []\n        >>> def f(*a, **k):\n        ...    output.append(('f', a, k))\n        >>> context = ActionState()\n        >>> context.actions = [\n        ...   (1, f, (1,)),\n        ...   (1, f, (11,), {}, ('x', )),\n        ...   (2, f, (2,)),\n        ...   ]\n        >>> context.execute_actions()\n        >>> output\n        [('f', (1,), {}), ('f', (2,), {})]\n\n        If the action raises an error, we convert it to a\n        ConfigurationExecutionError.\n\n        >>> output = []\n        >>> def bad():\n        ...    bad.xxx\n        >>> context.actions = [\n        ...   (1, f, (1,)),\n        ...   (1, f, (11,), {}, ('x', )),\n        ...   (2, f, (2,)),\n        ...   (3, bad, (), {}, (), 'oops')\n        ...   ]\n        >>> try:\n        ...    v = context.execute_actions()\n        ... except ConfigurationExecutionError, v:\n        ...    pass\n        >>> print(v)\n        exceptions.AttributeError: 'function' object has no attribute 'xxx'\n          in:\n          oops\n\n        Note that actions executed before the error still have an effect:\n\n        >>> output\n        [('f', (1,), {}), ('f', (2,), {})]\n\n        The execution is re-entrant such that actions may be added by other\n        actions with the one caveat that the order of any added actions must\n        be equal to or larger than the current action.\n\n        >>> output = []\n        >>> def f(*a, **k):\n        ...   output.append(('f', a, k))\n        ...   context.actions.append((3, g, (8,), {}))\n        >>> def g(*a, **k):\n        ...    output.append(('g', a, k))\n        >>> context.actions = [\n        ...   (1, f, (1,)),\n        ...   ]\n        >>> context.execute_actions()\n        >>> output\n        [('f', (1,), {}), ('g', (8,), {})]\n\n        \"\"\"\n        try:\n            all_actions = []\n            executed_actions = []\n            action_iter = iter([])\n            conflict_state = ConflictResolverState()\n\n            while True:\n                # We clear the actions list prior to execution so if there\n                # are some new actions then we add them to the mix and resolve\n                # conflicts again. This orders the new actions as well as\n                # ensures that the previously executed actions have no new\n                # conflicts.\n                if self.actions:\n                    all_actions.extend(self.actions)\n                    action_iter = resolveConflicts(\n                        self.actions,\n                        state=conflict_state,\n                    )\n                    self.actions = []\n\n                action = next(action_iter, None)\n                if action is None:\n                    # we are done!\n                    break\n\n                callable = action['callable']\n                args = action['args']\n                kw = action['kw']\n                info = action['info']\n                # we use \"get\" below in case an action was added via a ZCML\n                # directive that did not know about introspectables\n                introspectables = action.get('introspectables', ())\n\n                try:\n                    if callable is not None:\n                        callable(*args, **kw)\n                except Exception:\n                    t, v, tb = sys.exc_info()\n                    try:\n                        reraise(ConfigurationExecutionError,\n                                ConfigurationExecutionError(t, v, info),\n                                tb)\n                    finally:\n                        del t, v, tb\n\n                if introspector is not None:\n                    for introspectable in introspectables:\n                        introspectable.register(introspector, info)\n\n                executed_actions.append(action)\n\n            self.actions = all_actions\n            return executed_actions\n\n        finally:\n            if clear:\n                self.actions = []\n\n\nclass ConflictResolverState(object):\n    def __init__(self):\n        # keep a set of resolved discriminators to test against to ensure\n        # that a new action does not conflict with something already executed\n        self.resolved_ainfos = {}\n\n        # actions left over from a previous iteration\n        self.remaining_actions = []\n\n        # after executing an action we memoize its order to avoid any new\n        # actions sending us backward\n        self.min_order = None\n\n        # unique tracks the index of the action so we need it to increase\n        # monotonically across invocations to resolveConflicts\n        self.start = 0\n\n\n# this function is licensed under the ZPL (stolen from Zope)\ndef resolveConflicts(actions, state=None):\n    \"\"\"Resolve conflicting actions\n\n    Given an actions list, identify and try to resolve conflicting actions.\n    Actions conflict if they have the same non-None discriminator.\n\n    Conflicting actions can be resolved if the include path of one of\n    the actions is a prefix of the includepaths of the other\n    conflicting actions and is unequal to the include paths in the\n    other conflicting actions.\n\n    Actions are resolved on a per-order basis because some discriminators\n    cannot be computed until earlier actions have executed. An action in an\n    earlier order may execute successfully only to find out later that it was\n    overridden by another action with a smaller include path. This will result\n    in a conflict as there is no way to revert the original action.\n\n    ``state`` may be an instance of ``ConflictResolverState`` that\n    can be used to resume execution and resolve the new actions against the\n    list of executed actions from a previous call.\n\n    \"\"\"\n    if state is None:\n        state = ConflictResolverState()\n\n    # pick up where we left off last time, but track the new actions as well\n    state.remaining_actions.extend(normalize_actions(actions))\n    actions = state.remaining_actions\n\n    def orderandpos(v):\n        n, v = v\n        return (v['order'] or 0, n)\n\n    def orderonly(v):\n        n, v = v\n        return v['order'] or 0\n\n    sactions = sorted(enumerate(actions, start=state.start), key=orderandpos)\n    for order, actiongroup in itertools.groupby(sactions, orderonly):\n        # \"order\" is an integer grouping. Actions in a lower order will be\n        # executed before actions in a higher order.  All of the actions in\n        # one grouping will be executed (its callable, if any will be called)\n        # before any of the actions in the next.\n        output = []\n        unique = {}\n\n        # error out if we went backward in order\n        if state.min_order is not None and order < state.min_order:\n            r = ['Actions were added to order={0} after execution had moved '\n                 'on to order={1}. Conflicting actions: '\n                 .format(order, state.min_order)]\n            for i, action in actiongroup:\n                for line in str(action['info']).rstrip().split('\\n'):\n                    r.append(\"  \" + line)\n            raise ConfigurationError('\\n'.join(r))\n\n        for i, action in actiongroup:\n            # Within an order, actions are executed sequentially based on\n            # original action ordering (\"i\").\n\n            # \"ainfo\" is a tuple of (i, action) where \"i\" is an integer\n            # expressing the relative position of this action in the action\n            # list being resolved, and \"action\" is an action dictionary.  The\n            # purpose of an ainfo is to associate an \"i\" with a particular\n            # action; \"i\" exists for sorting after conflict resolution.\n            ainfo = (i, action)\n\n            # wait to defer discriminators until we are on their order because\n            # the discriminator may depend on state from a previous order\n            discriminator = undefer(action['discriminator'])\n            action['discriminator'] = discriminator\n\n            if discriminator is None:\n                # The discriminator is None, so this action can never conflict.\n                # We can add it directly to the result.\n                output.append(ainfo)\n                continue\n\n            L = unique.setdefault(discriminator, [])\n            L.append(ainfo)\n\n        # Check for conflicts\n        conflicts = {}\n        for discriminator, ainfos in unique.items():\n            # We use (includepath, i) as a sort key because we need to\n            # sort the actions by the paths so that the shortest path with a\n            # given prefix comes first.  The \"first\" action is the one with the\n            # shortest include path.  We break sorting ties using \"i\".\n            def bypath(ainfo):\n                path, i = ainfo[1]['includepath'], ainfo[0]\n                return path, order, i\n\n            ainfos.sort(key=bypath)\n            ainfo, rest = ainfos[0], ainfos[1:]\n            _, action = ainfo\n\n            # ensure this new action does not conflict with a previously\n            # resolved action from an earlier order / invocation\n            prev_ainfo = state.resolved_ainfos.get(discriminator)\n            if prev_ainfo is not None:\n                _, paction = prev_ainfo\n                basepath, baseinfo = paction['includepath'], paction['info']\n                includepath = action['includepath']\n                # if the new action conflicts with the resolved action then\n                # note the conflict, otherwise drop the action as it's\n                # effectively overriden by the previous action\n                if (includepath[:len(basepath)] != basepath or\n                        includepath == basepath):\n                    L = conflicts.setdefault(discriminator, [baseinfo])\n                    L.append(action['info'])\n\n            else:\n                output.append(ainfo)\n\n            basepath, baseinfo = action['includepath'], action['info']\n            for _, action in rest:\n                includepath = action['includepath']\n                # Test whether path is a prefix of opath\n                if (includepath[:len(basepath)] != basepath or  # not a prefix\n                        includepath == basepath):\n                    L = conflicts.setdefault(discriminator, [baseinfo])\n                    L.append(action['info'])\n\n        if conflicts:\n            raise ConfigurationConflictError(conflicts)\n\n        # sort resolved actions by \"i\" and yield them one by one\n        for i, action in sorted(output, key=operator.itemgetter(0)):\n            # do not memoize the order until we resolve an action inside it\n            state.min_order = action['order']\n            state.start = i + 1\n            state.remaining_actions.remove(action)\n            state.resolved_ainfos[action['discriminator']] = (i, action)\n            yield action\n\n\ndef normalize_actions(actions):\n    \"\"\"Convert old-style tuple actions to new-style dicts.\"\"\"\n    result = []\n    for v in actions:\n        if not isinstance(v, dict):\n            v = expand_action_tuple(*v)\n        result.append(v)\n    return result\n\n\ndef expand_action_tuple(\n    discriminator, callable=None, args=(), kw=None, includepath=(),\n    info=None, order=0, introspectables=(),\n):\n    if kw is None:\n        kw = {}\n    return dict(\n        discriminator=discriminator,\n        callable=callable,\n        args=args,\n        kw=kw,\n        includepath=includepath,\n        info=info,\n        order=order,\n        introspectables=introspectables,\n        )\n\n\nglobal_registries = WeakOrderedSet()\n"}
A user will ask you to solve a task. You should first draft your thinking process (inner monologue). Then, generate the solution.

Your response format must follow the template below:
<think>
Your thoughts or/and draft, like working through an exercise on scratch paper. Be as casual and as long as you want until you are confident to generate a correct solution.
</think>
<solution>
Final solution presented to the user.
</solution>
system
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]
**Title:** Thread locals are inactive during `config.include` executions

**Description**
When using the `config.include` function to include configuration modules, the thread-local registry is not active. This causes functions executed within `config.include` to retrieve an incorrect registry instance, leading to unexpected behavior.

**Example Code**
```python
from pyramid.config import Configurator
from pyramid.threadlocal import get_current_registry

def include_function(config):
    registry = get_current_registry()
    # Expecting registry to be the current Configurator's registry
    print(registry)

config = Configurator()
config.include(include_function)
```

**Expected Behavior**
Within the `include_function`, `get_current_registry()` should return the current `Configurator`'s registry instance, ensuring that all thread-local operations are correctly associated with the active configuration.

**Actual Behavior**
`get_current_registry()` does not return the expected registry instance inside the `include_function`, indicating that thread locals are not active during the execution of `config.include`. This leads to inconsistencies and potential errors in configuration-dependent operations.

[/ISSUE]
--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.

--- BEGIN FILE ---
```
### pyramid/config/__init__.py
import inspect
import itertools
import logging
import operator
import os
import sys
import threading
import venusian

from webob.exc import WSGIHTTPException as WebobWSGIHTTPException

from pyramid.interfaces import (
    IDebugLogger,
    IExceptionResponse,
    IPredicateList,
    PHASE0_CONFIG,
    PHASE1_CONFIG,
    PHASE2_CONFIG,
    PHASE3_CONFIG,
    )

from pyramid.asset import resolve_asset_spec

from pyramid.authorization import ACLAuthorizationPolicy

from pyramid.compat import (
    text_,
    reraise,
    string_types,
    )

from pyramid.events import ApplicationCreated

from pyramid.exceptions import (
    ConfigurationConflictError,
    ConfigurationError,
    ConfigurationExecutionError,
    )

from pyramid.httpexceptions import default_exceptionresponse_view

from pyramid.path import (
    caller_package,
    package_of,
    )

from pyramid.registry import (
    Introspectable,
    Introspector,
    Registry,
    undefer,
    )

from pyramid.router import Router

from pyramid.settings import aslist

from pyramid.threadlocal import manager

from pyramid.util import (
    ActionInfo,
    WeakOrderedSet,
    action_method,
    object_description,
    )

from pyramid.config.adapters import AdaptersConfiguratorMixin
from pyramid.config.assets import AssetsConfiguratorMixin
from pyramid.config.factories import FactoriesConfiguratorMixin
from pyramid.config.i18n import I18NConfiguratorMixin
from pyramid.config.rendering import RenderingConfiguratorMixin
from pyramid.config.routes import RoutesConfiguratorMixin
from pyramid.config.security import SecurityConfiguratorMixin
from pyramid.config.settings import SettingsConfiguratorMixin
from pyramid.config.testing import TestingConfiguratorMixin
from pyramid.config.tweens import TweensConfiguratorMixin
from pyramid.config.util import PredicateList, not_
from pyramid.config.views import ViewsConfiguratorMixin
from pyramid.config.zca import ZCAConfiguratorMixin

from pyramid.path import DottedNameResolver

empty = text_('')
_marker = object()

ConfigurationError = ConfigurationError # pyflakes

not_ = not_ # pyflakes, this is an API

PHASE0_CONFIG = PHASE0_CONFIG  # api
PHASE1_CONFIG = PHASE1_CONFIG  # api
PHASE2_CONFIG = PHASE2_CONFIG  # api
PHASE3_CONFIG = PHASE3_CONFIG  # api

class Configurator(
    TestingConfiguratorMixin,
    TweensConfiguratorMixin,
    SecurityConfiguratorMixin,
    ViewsConfiguratorMixin,
    RoutesConfiguratorMixin,
    ZCAConfiguratorMixin,
    I18NConfiguratorMixin,
    RenderingConfiguratorMixin,
    AssetsConfiguratorMixin,
    SettingsConfiguratorMixin,
    FactoriesConfiguratorMixin,
    AdaptersConfiguratorMixin,
    ):
    """
    A Configurator is used to configure a :app:`Pyramid`
    :term:`application registry`.

    If the ``registry`` argument is not ``None``, it must
    be an instance of the :class:`pyramid.registry.Registry` class
    representing the registry to configure.  If ``registry`` is ``None``, the
    configurator will create a :class:`pyramid.registry.Registry` instance
    itself; it will also perform some default configuration that would not
    otherwise be done.  After its construction, the configurator may be used
    to add further configuration to the registry.

    .. warning:: If ``registry`` is assigned the above-mentioned class
       instance, all other constructor arguments are ignored,
       with the exception of ``package``.

    If the ``package`` argument is passed, it must be a reference to a Python
    :term:`package` (e.g. ``sys.modules['thepackage']``) or a :term:`dotted
    Python name` to the same.  This value is used as a basis to convert
    relative paths passed to various configuration methods, such as methods
    which accept a ``renderer`` argument, into absolute paths.  If ``None``
    is passed (the default), the package is assumed to be the Python package
    in which the *caller* of the ``Configurator`` constructor lives.

    If the ``root_package`` is passed, it will propagate through the
    configuration hierarchy as a way for included packages to locate
    resources relative to the package in which the main ``Configurator`` was
    created. If ``None`` is passed (the default), the ``root_package`` will
    be derived from the ``package`` argument. The ``package`` attribute is
    always pointing at the package being included when using :meth:`.include`,
    whereas the ``root_package`` does not change.

    If the ``settings`` argument is passed, it should be a Python dictionary
    representing the :term:`deployment settings` for this application.  These
    are later retrievable using the
    :attr:`pyramid.registry.Registry.settings` attribute (aka
    ``request.registry.settings``).

    If the ``root_factory`` argument is passed, it should be an object
    representing the default :term:`root factory` for your application or a
    :term:`dotted Python name` to the same.  If it is ``None``, a default
    root factory will be used.

    If ``authentication_policy`` is passed, it should be an instance
    of an :term:`authentication policy` or a :term:`dotted Python
    name` to the same.

    If ``authorization_policy`` is passed, it should be an instance of
    an :term:`authorization policy` or a :term:`dotted Python name` to
    the same.

    .. note:: A ``ConfigurationError`` will be raised when an
       authorization policy is supplied without also supplying an
       authentication policy (authorization requires authentication).

    If ``renderers`` is ``None`` (the default), a default set of
    :term:`renderer` factories is used. Else, it should be a list of
    tuples representing a set of renderer factories which should be
    configured into this application, and each tuple representing a set of
    positional values that should be passed to
    :meth:`pyramid.config.Configurator.add_renderer`.

    If ``debug_logger`` is not passed, a default debug logger that logs to a
    logger will be used (the logger name will be the package name of the
    *caller* of this configurator).  If it is passed, it should be an
    instance of the :class:`logging.Logger` (PEP 282) standard library class
    or a Python logger name.  The debug logger is used by :app:`Pyramid`
    itself to log warnings and authorization debugging information.

    If ``locale_negotiator`` is passed, it should be a :term:`locale
    negotiator` implementation or a :term:`dotted Python name` to
    same.  See :ref:`custom_locale_negotiator`.

    If ``request_factory`` is passed, it should be a :term:`request
    factory` implementation or a :term:`dotted Python name` to the same.
    See :ref:`changing_the_request_factory`.  By default it is ``None``,
    which means use the default request factory.

    If ``response_factory`` is passed, it should be a :term:`response
    factory` implementation or a :term:`dotted Python name` to the same.
    See :ref:`changing_the_response_factory`.  By default it is ``None``,
    which means use the default response factory.

    If ``default_permission`` is passed, it should be a
    :term:`permission` string to be used as the default permission for
    all view configuration registrations performed against this
    Configurator.  An example of a permission string:``'view'``.
    Adding a default permission makes it unnecessary to protect each
    view configuration with an explicit permission, unless your
    application policy requires some exception for a particular view.
    By default, ``default_permission`` is ``None``, meaning that view
    configurations which do not explicitly declare a permission will
    always be executable by entirely anonymous users (any
    authorization policy in effect is ignored).

    .. seealso::

        See also :ref:`setting_a_default_permission`.

    If ``session_factory`` is passed, it should be an object which
    implements the :term:`session factory` interface.  If a nondefault
    value is passed, the ``session_factory`` will be used to create a
    session object when ``request.session`` is accessed.  Note that
    the same outcome can be achieved by calling
    :meth:`pyramid.config.Configurator.set_session_factory`.  By
    default, this argument is ``None``, indicating that no session
    factory will be configured (and thus accessing ``request.session``
    will throw an error) unless ``set_session_factory`` is called later
    during configuration.

    If ``autocommit`` is ``True``, every method called on the configurator
    will cause an immediate action, and no configuration conflict detection
    will be used. If ``autocommit`` is ``False``, most methods of the
    configurator will defer their action until
    :meth:`pyramid.config.Configurator.commit` is called.  When
    :meth:`pyramid.config.Configurator.commit` is called, the actions implied
    by the called methods will be checked for configuration conflicts unless
    ``autocommit`` is ``True``.  If a conflict is detected, a
    ``ConfigurationConflictError`` will be raised.  Calling
    :meth:`pyramid.config.Configurator.make_wsgi_app` always implies a final
    commit.

    If ``default_view_mapper`` is passed, it will be used as the default
    :term:`view mapper` factory for view configurations that don't otherwise
    specify one (see :class:`pyramid.interfaces.IViewMapperFactory`).  If
    ``default_view_mapper`` is not passed, a superdefault view mapper will be
    used.

    If ``exceptionresponse_view`` is passed, it must be a :term:`view
    callable` or ``None``.  If it is a view callable, it will be used as an
    exception view callable when an :term:`exception response` is raised. If
    ``exceptionresponse_view`` is ``None``, no exception response view will
    be registered, and all raised exception responses will be bubbled up to
    Pyramid's caller.  By
    default, the ``pyramid.httpexceptions.default_exceptionresponse_view``
    function is used as the ``exceptionresponse_view``.

    If ``route_prefix`` is passed, all routes added with
    :meth:`pyramid.config.Configurator.add_route` will have the specified path
    prepended to their pattern.

    If ``introspection`` is passed, it must be a boolean value.  If it's
    ``True``, introspection values during actions will be kept for use
    for tools like the debug toolbar.  If it's ``False``, introspection
    values provided by registrations will be ignored.  By default, it is
    ``True``.

    .. versionadded:: 1.1
       The ``exceptionresponse_view`` argument.

    .. versionadded:: 1.2
       The ``route_prefix`` argument.

    .. versionadded:: 1.3
       The ``introspection`` argument.

    .. versionadded:: 1.6
       The ``root_package`` argument.
       The ``response_factory`` argument.
    """
    manager = manager # for testing injection
    venusian = venusian # for testing injection
    _ainfo = None
    basepath = None
    includepath = ()
    info = ''
    object_description = staticmethod(object_description)
    introspectable = Introspectable
    inspect = inspect

    def __init__(self,
                 registry=None,
                 package=None,
                 settings=None,
                 root_factory=None,
                 authentication_policy=None,
                 authorization_policy=None,
                 renderers=None,
                 debug_logger=None,
                 locale_negotiator=None,
                 request_factory=None,
                 response_factory=None,
                 default_permission=None,
                 session_factory=None,
                 default_view_mapper=None,
                 autocommit=False,
                 exceptionresponse_view=default_exceptionresponse_view,
                 route_prefix=None,
                 introspection=True,
                 root_package=None,
                 ):
        if package is None:
            package = caller_package()
        if root_package is None:
            root_package = package
        name_resolver = DottedNameResolver(package)
        self.name_resolver = name_resolver
        self.package_name = name_resolver.get_package_name()
        self.package = name_resolver.get_package()
        self.root_package = root_package
        self.registry = registry
        self.autocommit = autocommit
        self.route_prefix = route_prefix
        self.introspection = introspection
        if registry is None:
            registry = Registry(self.package_name)
            self.registry = registry
            self.setup_registry(
                settings=settings,
                root_factory=root_factory,
                authentication_policy=authentication_policy,
                authorization_policy=authorization_policy,
                renderers=renderers,
                debug_logger=debug_logger,
                locale_negotiator=locale_negotiator,
                request_factory=request_factory,
                response_factory=response_factory,
                default_permission=default_permission,
                session_factory=session_factory,
                default_view_mapper=default_view_mapper,
                exceptionresponse_view=exceptionresponse_view,
                )

    def setup_registry(self,
                       settings=None,
                       root_factory=None,
                       authentication_policy=None,
                       authorization_policy=None,
                       renderers=None,
                       debug_logger=None,
                       locale_negotiator=None,
                       request_factory=None,
                       response_factory=None,
                       default_permission=None,
                       session_factory=None,
                       default_view_mapper=None,
                       exceptionresponse_view=default_exceptionresponse_view,
                       ):
        """ When you pass a non-``None`` ``registry`` argument to the
        :term:`Configurator` constructor, no initial setup is performed
        against the registry.  This is because the registry you pass in may
        have already been initialized for use under :app:`Pyramid` via a
        different configurator.  However, in some circumstances (such as when
        you want to use a global registry instead of a registry created as a
        result of the Configurator constructor), or when you want to reset
        the initial setup of a registry, you *do* want to explicitly
        initialize the registry associated with a Configurator for use under
        :app:`Pyramid`.  Use ``setup_registry`` to do this initialization.

        ``setup_registry`` configures settings, a root factory, security
        policies, renderers, a debug logger, a locale negotiator, and various
        other settings using the configurator's current registry, as per the
        descriptions in the Configurator constructor."""

        registry = self.registry

        self._fix_registry()

        self._set_settings(settings)

        if isinstance(debug_logger, string_types):
            debug_logger = logging.getLogger(debug_logger)

        if debug_logger is None:
            debug_logger = logging.getLogger(self.package_name)

        registry.registerUtility(debug_logger, IDebugLogger)

        self.add_default_response_adapters()
        self.add_default_renderers()
        self.add_default_view_predicates()
        self.add_default_view_derivers()
        self.add_default_route_predicates()
        self.add_default_tweens()

        if exceptionresponse_view is not None:
            exceptionresponse_view = self.maybe_dotted(exceptionresponse_view)
            self.add_view(exceptionresponse_view, context=IExceptionResponse)
            self.add_view(exceptionresponse_view,context=WebobWSGIHTTPException)

        # commit below because:
        #
        # - the default exceptionresponse_view requires the superdefault view
        #   mapper, so we need to configure it before adding default_view_mapper
        #
        # - superdefault renderers should be overrideable without requiring
        #   the user to commit before calling config.add_renderer

        self.commit()

        # self.commit() should not be called within this method after this
        # point because the following registrations should be treated as
        # analogues of methods called by the user after configurator
        # construction.  Rationale: user-supplied implementations should be
        # preferred rather than add-on author implementations with the help of
        # automatic conflict resolution.

        if authentication_policy and not authorization_policy:
            authorization_policy = ACLAuthorizationPolicy() # default

        if authorization_policy:
            self.set_authorization_policy(authorization_policy)

        if authentication_policy:
            self.set_authentication_policy(authentication_policy)

        if default_view_mapper is not None:
            self.set_view_mapper(default_view_mapper)

        if renderers:
            for name, renderer in renderers:
                self.add_renderer(name, renderer)

        if root_factory is not None:
            self.set_root_factory(root_factory)

        if locale_negotiator:
            self.set_locale_negotiator(locale_negotiator)

        if request_factory:
            self.set_request_factory(request_factory)

        if response_factory:
            self.set_response_factory(response_factory)

        if default_permission:
            self.set_default_permission(default_permission)

        if session_factory is not None:
            self.set_session_factory(session_factory)

        tweens = aslist(registry.settings.get('pyramid.tweens', []))
        for factory in tweens:
            self._add_tween(factory, explicit=True)

        includes = aslist(registry.settings.get('pyramid.includes', []))
        for inc in includes:
            self.include(inc)

    def _make_spec(self, path_or_spec):
        package, filename = resolve_asset_spec(path_or_spec, self.package_name)
        if package is None:
            return filename # absolute filename
        return '%s:%s' % (package, filename)

    def _fix_registry(self):
        """ Fix up a ZCA component registry that is not a
        pyramid.registry.Registry by adding analogues of ``has_listeners``,
        ``notify``, ``queryAdapterOrSelf``, and ``registerSelfAdapter``
        through monkey-patching."""

        _registry = self.registry

        if not hasattr(_registry, 'notify'):
            def notify(*events):
                [ _ for _ in _registry.subscribers(events, None) ]
            _registry.notify = notify

        if not hasattr(_registry, 'has_listeners'):
            _registry.has_listeners = True

        if not hasattr(_registry, 'queryAdapterOrSelf'):
            def queryAdapterOrSelf(object, interface, default=None):
                if not interface.providedBy(object):
                    return _registry.queryAdapter(object, interface,
                                                  default=default)
                return object
            _registry.queryAdapterOrSelf = queryAdapterOrSelf

        if not hasattr(_registry, 'registerSelfAdapter'):
            def registerSelfAdapter(required=None, provided=None,
                                    name=empty, info=empty, event=True):
                return _registry.registerAdapter(lambda x: x,
                                                 required=required,
                                                 provided=provided, name=name,
                                                 info=info, event=event)
            _registry.registerSelfAdapter = registerSelfAdapter

        if not hasattr(_registry, '_lock'):
            _registry._lock = threading.Lock()

        if not hasattr(_registry, '_clear_view_lookup_cache'):
            def _clear_view_lookup_cache():
                _registry._view_lookup_cache = {}
            _registry._clear_view_lookup_cache = _clear_view_lookup_cache


    # API

    def _get_introspector(self):
        introspector = getattr(self.registry, 'introspector', _marker)
        if introspector is _marker:
            introspector = Introspector()
            self._set_introspector(introspector)
        return introspector

    def _set_introspector(self, introspector):
        self.registry.introspector = introspector

    def _del_introspector(self):
        del self.registry.introspector

    introspector = property(
        _get_introspector, _set_introspector, _del_introspector
        )

    def get_predlist(self, name):
        predlist = self.registry.queryUtility(IPredicateList, name=name)
        if predlist is None:
            predlist = PredicateList()
            self.registry.registerUtility(predlist, IPredicateList, name=name)
        return predlist


    def _add_predicate(self, type, name, factory, weighs_more_than=None,
                       weighs_less_than=None):
        factory = self.maybe_dotted(factory)
        discriminator = ('%s option' % type, name)
        intr = self.introspectable(
            '%s predicates' % type,
            discriminator,
            '%s predicate named %s' % (type, name),
            '%s predicate' % type)
        intr['name'] = name
        intr['factory'] = factory
        intr['weighs_more_than'] = weighs_more_than
        intr['weighs_less_than'] = weighs_less_than
        def register():
            predlist = self.get_predlist(type)
            predlist.add(name, factory, weighs_more_than=weighs_more_than,
                         weighs_less_than=weighs_less_than)
        self.action(discriminator, register, introspectables=(intr,),
                    order=PHASE1_CONFIG) # must be registered early

    @property
    def action_info(self):
        info = self.info # usually a ZCML action (ParserInfo) if self.info
        if not info:
            # Try to provide more accurate info for conflict reports
            if self._ainfo:
                info = self._ainfo[0]
            else:
                info = ActionInfo(None, 0, '', '')
        return info

    def action(self, discriminator, callable=None, args=(), kw=None, order=0,
               introspectables=(), **extra):
        """ Register an action which will be executed when
        :meth:`pyramid.config.Configurator.commit` is called (or executed
        immediately if ``autocommit`` is ``True``).

        .. warning:: This method is typically only used by :app:`Pyramid`
           framework extension authors, not by :app:`Pyramid` application
           developers.

        The ``discriminator`` uniquely identifies the action.  It must be
        given, but it can be ``None``, to indicate that the action never
        conflicts.  It must be a hashable value.

        The ``callable`` is a callable object which performs the task
        associated with the action when the action is executed.  It is
        optional.

        ``args`` and ``kw`` are tuple and dict objects respectively, which
        are passed to ``callable`` when this action is executed.  Both are
        optional.

        ``order`` is a grouping mechanism; an action with a lower order will
        be executed before an action with a higher order (has no effect when
        autocommit is ``True``).

        ``introspectables`` is a sequence of :term:`introspectable` objects
        (or the empty sequence if no introspectable objects are associated
        with this action).  If this configurator's ``introspection``
        attribute is ``False``, these introspectables will be ignored.

        ``extra`` provides a facility for inserting extra keys and values
        into an action dictionary.
        """
        # catch nonhashable discriminators here; most unit tests use
        # autocommit=False, which won't catch unhashable discriminators
        assert hash(discriminator) 

        if kw is None:
            kw = {}

        autocommit = self.autocommit
        action_info = self.action_info

        if not self.introspection:
            # if we're not introspecting, ignore any introspectables passed
            # to us
            introspectables = ()

        if autocommit:
            # callables can depend on the side effects of resolving a
            # deferred discriminator
            self.begin()
            try:
                undefer(discriminator)
                if callable is not None:
                    callable(*args, **kw)
                for introspectable in introspectables:
                    introspectable.register(self.introspector, action_info)
            finally:
                self.end()

        else:
            action = extra
            action.update(
                dict(
                    discriminator=discriminator,
                    callable=callable,
                    args=args,
                    kw=kw,
                    order=order,
                    info=action_info,
                    includepath=self.includepath,
                    introspectables=introspectables,
                    )
                )
            self.action_state.action(**action)

    def _get_action_state(self):
        registry = self.registry
        try:
            state = registry.action_state
        except AttributeError:
            state = ActionState()
            registry.action_state = state
        return state

    def _set_action_state(self, state):
        self.registry.action_state = state

    action_state = property(_get_action_state, _set_action_state)

    _ctx = action_state # bw compat

    def commit(self):
        """ Commit any pending configuration actions. If a configuration
        conflict is detected in the pending configuration actions, this method
        will raise a :exc:`ConfigurationConflictError`; within the traceback
        of this error will be information about the source of the conflict,
        usually including file names and line numbers of the cause of the
        configuration conflicts."""
        self.begin()
        try:
            self.action_state.execute_actions(introspector=self.introspector)
        finally:
            self.end()
        self.action_state = ActionState() # old actions have been processed

    def include(self, callable, route_prefix=None):
        """Include a configuration callable, to support imperative
        application extensibility.

        .. warning:: In versions of :app:`Pyramid` prior to 1.2, this
            function accepted ``*callables``, but this has been changed
            to support only a single callable.

        A configuration callable should be a callable that accepts a single
        argument named ``config``, which will be an instance of a
        :term:`Configurator`.  However, be warned that it will not be the same
        configurator instance on which you call this method.  The
        code which runs as a result of calling the callable should invoke
        methods on the configurator passed to it which add configuration
        state.  The return value of a callable will be ignored.

        Values allowed to be presented via the ``callable`` argument to
        this method: any callable Python object or any :term:`dotted Python
        name` which resolves to a callable Python object.  It may also be a
        Python :term:`module`, in which case, the module will be searched for
        a callable named ``includeme``, which will be treated as the
        configuration callable.

        For example, if the ``includeme`` function below lives in a module
        named ``myapp.myconfig``:

        .. code-block:: python
           :linenos:

           # myapp.myconfig module

           def my_view(request):
               from pyramid.response import Response
               return Response('OK')

           def includeme(config):
               config.add_view(my_view)

        You might cause it to be included within your Pyramid application like
        so:

        .. code-block:: python
           :linenos:

           from pyramid.config import Configurator

           def main(global_config, **settings):
               config = Configurator()
               config.include('myapp.myconfig.includeme')

        Because the function is named ``includeme``, the function name can
        also be omitted from the dotted name reference:

        .. code-block:: python
           :linenos:

           from pyramid.config import Configurator

           def main(global_config, **settings):
               config = Configurator()
               config.include('myapp.myconfig')

        Included configuration statements will be overridden by local
        configuration statements if an included callable causes a
        configuration conflict by registering something with the same
        configuration parameters.

        If the ``route_prefix`` is supplied, it must be a string.  Any calls
        to :meth:`pyramid.config.Configurator.add_route` within the included
        callable will have their pattern prefixed with the value of
        ``route_prefix``. This can be used to help mount a set of routes at a
        different location than the included callable's author intended, while
        still maintaining the same route names.  For example:

        .. code-block:: python
           :linenos:

           from pyramid.config import Configurator

           def included(config):
               config.add_route('show_users', '/show')

           def main(global_config, **settings):
               config = Configurator()
               config.include(included, route_prefix='/users')

        In the above configuration, the ``show_users`` route will have an
        effective route pattern of ``/users/show``, instead of ``/show``
        because the ``route_prefix`` argument will be prepended to the
        pattern.

        .. versionadded:: 1.2
           The ``route_prefix`` parameter.

        """
        # """ <-- emacs

        action_state = self.action_state

        if route_prefix is None:
            route_prefix = ''

        old_route_prefix = self.route_prefix
        if old_route_prefix is None:
            old_route_prefix = ''

        route_prefix = '%s/%s' % (
            old_route_prefix.rstrip('/'),
            route_prefix.lstrip('/')
            )
        route_prefix = route_prefix.strip('/')
        if not route_prefix:
            route_prefix = None

        c = self.maybe_dotted(callable)
        module = self.inspect.getmodule(c)
        if module is c:
            try:
                c = getattr(module, 'includeme')
            except AttributeError:
                raise ConfigurationError(
                    "module %r has no attribute 'includeme'" % (module.__name__)
                    )
                                                       
        spec = module.__name__ + ':' + c.__name__
        sourcefile = self.inspect.getsourcefile(c)

        if sourcefile is None:
            raise ConfigurationError(
                'No source file for module %r (.py file must exist, '
                'refusing to use orphan .pyc or .pyo file).' % module.__name__)
            

        if action_state.processSpec(spec):
            configurator = self.__class__(
                registry=self.registry,
                package=package_of(module),
                root_package=self.root_package,
                autocommit=self.autocommit,
                route_prefix=route_prefix,
                )
            configurator.basepath = os.path.dirname(sourcefile)
            configurator.includepath = self.includepath + (spec,)
            c(configurator)

    def add_directive(self, name, directive, action_wrap=True):
        """
        Add a directive method to the configurator.

        .. warning:: This method is typically only used by :app:`Pyramid`
           framework extension authors, not by :app:`Pyramid` application
           developers.

        Framework extenders can add directive methods to a configurator by
        instructing their users to call ``config.add_directive('somename',
        'some.callable')``.  This will make ``some.callable`` accessible as
        ``config.somename``.  ``some.callable`` should be a function which
        accepts ``config`` as a first argument, and arbitrary positional and
        keyword arguments following.  It should use config.action as
        necessary to perform actions.  Directive methods can then be invoked
        like 'built-in' directives such as ``add_view``, ``add_route``, etc.

        The ``action_wrap`` argument should be ``True`` for directives which
        perform ``config.action`` with potentially conflicting
        discriminators.  ``action_wrap`` will cause the directive to be
        wrapped in a decorator which provides more accurate conflict
        cause information.

        ``add_directive`` does not participate in conflict detection, and
        later calls to ``add_directive`` will override earlier calls.
        """
        c = self.maybe_dotted(directive)
        if not hasattr(self.registry, '_directives'):
            self.registry._directives = {}
        self.registry._directives[name] = (c, action_wrap)

    def __getattr__(self, name):
        # allow directive extension names to work
        directives = getattr(self.registry, '_directives', {})
        c = directives.get(name)
        if c is None:
            raise AttributeError(name)
        c, action_wrap = c
        if action_wrap:
            c = action_method(c)
        # Create a bound method (works on both Py2 and Py3)
        # http://stackoverflow.com/a/1015405/209039
        m = c.__get__(self, self.__class__)
        return m

    def with_package(self, package):
        """ Return a new Configurator instance with the same registry
        as this configurator. ``package`` may be an actual Python package
        object or a :term:`dotted Python name` representing a package."""
        configurator = self.__class__(
            registry=self.registry,
            package=package,
            root_package=self.root_package,
            autocommit=self.autocommit,
            route_prefix=self.route_prefix,
            introspection=self.introspection,
            )
        configurator.basepath = self.basepath
        configurator.includepath = self.includepath
        configurator.info = self.info
        return configurator

    def maybe_dotted(self, dotted):
        """ Resolve the :term:`dotted Python name` ``dotted`` to a
        global Python object.  If ``dotted`` is not a string, return
        it without attempting to do any name resolution.  If
        ``dotted`` is a relative dotted name (e.g. ``.foo.bar``,
        consider it relative to the ``package`` argument supplied to
        this Configurator's constructor."""
        return self.name_resolver.maybe_resolve(dotted)

    def absolute_asset_spec(self, relative_spec):
        """ Resolve the potentially relative :term:`asset
        specification` string passed as ``relative_spec`` into an
        absolute asset specification string and return the string.
        Use the ``package`` of this configurator as the package to
        which the asset specification will be considered relative
        when generating an absolute asset specification.  If the
        provided ``relative_spec`` argument is already absolute, or if
        the ``relative_spec`` is not a string, it is simply returned."""
        if not isinstance(relative_spec, string_types):
            return relative_spec
        return self._make_spec(relative_spec)

    absolute_resource_spec = absolute_asset_spec # b/w compat forever

    def begin(self, request=_marker):
        """ Indicate that application or test configuration has begun.
        This pushes a dictionary containing the :term:`application
        registry` implied by ``registry`` attribute of this
        configurator and the :term:`request` implied by the
        ``request`` argument onto the :term:`thread local` stack
        consulted by various :mod:`pyramid.threadlocal` API
        functions.

        If ``request`` is not specified and the registry owned by the
        configurator is already pushed as the current threadlocal registry
        then this method will keep the current threadlocal request unchanged.

        .. versionchanged:: 1.8
           The current threadlocal request is propagated if the current
           threadlocal registry remains unchanged.

        """
        if request is _marker:
            current = self.manager.get()
            if current['registry'] == self.registry:
                request = current['request']
            else:
                request = None
        self.manager.push({'registry':self.registry, 'request':request})

    def end(self):
        """ Indicate that application or test configuration has ended.
        This pops the last value pushed onto the :term:`thread local`
        stack (usually by the ``begin`` method) and returns that
        value.
        """
        return self.manager.pop()

    # this is *not* an action method (uses caller_package)
    def scan(self, package=None, categories=None, onerror=None, ignore=None,
             **kw):
        """Scan a Python package and any of its subpackages for objects
        marked with :term:`configuration decoration` such as
        :class:`pyramid.view.view_config`.  Any decorated object found will
        influence the current configuration state.

        The ``package`` argument should be a Python :term:`package` or module
        object (or a :term:`dotted Python name` which refers to such a
        package or module).  If ``package`` is ``None``, the package of the
        *caller* is used.

        The ``categories`` argument, if provided, should be the
        :term:`Venusian` 'scan categories' to use during scanning.  Providing
        this argument is not often necessary; specifying scan categories is
        an extremely advanced usage.  By default, ``categories`` is ``None``
        which will execute *all* Venusian decorator callbacks including
        :app:`Pyramid`-related decorators such as
        :class:`pyramid.view.view_config`.  See the :term:`Venusian`
        documentation for more information about limiting a scan by using an
        explicit set of categories.

        The ``onerror`` argument, if provided, should be a Venusian
        ``onerror`` callback function.  The onerror function is passed to
        :meth:`venusian.Scanner.scan` to influence error behavior when an
        exception is raised during the scanning process.  See the
        :term:`Venusian` documentation for more information about ``onerror``
        callbacks.

        The ``ignore`` argument, if provided, should be a Venusian ``ignore``
        value.  Providing an ``ignore`` argument allows the scan to ignore
        particular modules, packages, or global objects during a scan.
        ``ignore`` can be a string or a callable, or a list containing
        strings or callables.  The simplest usage of ``ignore`` is to provide
        a module or package by providing a full path to its dotted name.  For
        example: ``config.scan(ignore='my.module.subpackage')`` would ignore
        the ``my.module.subpackage`` package during a scan, which would
        prevent the subpackage and any of its submodules from being imported
        and scanned.  See the :term:`Venusian` documentation for more
        information about the ``ignore`` argument.

        To perform a ``scan``, Pyramid creates a Venusian ``Scanner`` object.
        The ``kw`` argument represents a set of keyword arguments to pass to
        the Venusian ``Scanner`` object's constructor.  See the
        :term:`venusian` documentation (its ``Scanner`` class) for more
        information about the constructor.  By default, the only keyword
        arguments passed to the Scanner constructor are ``{'config':self}``
        where ``self`` is this configurator object.  This services the
        requirement of all built-in Pyramid decorators, but extension systems
        may require additional arguments.  Providing this argument is not
        often necessary; it's an advanced usage.

        .. versionadded:: 1.1
           The ``**kw`` argument.

        .. versionadded:: 1.3
           The ``ignore`` argument.

        """
        package = self.maybe_dotted(package)
        if package is None: # pragma: no cover
            package = caller_package()

        ctorkw = {'config': self}
        ctorkw.update(kw)

        scanner = self.venusian.Scanner(**ctorkw)

        scanner.scan(package, categories=categories, onerror=onerror,
                     ignore=ignore)

    def make_wsgi_app(self):
        """ Commits any pending configuration statements, sends a
        :class:`pyramid.events.ApplicationCreated` event to all listeners,
        adds this configuration's registry to
        :attr:`pyramid.config.global_registries`, and returns a
        :app:`Pyramid` WSGI application representing the committed
        configuration state."""
        self.commit()
        app = Router(self.registry)

        # Allow tools like "pshell development.ini" to find the 'last'
        # registry configured.
        global_registries.add(self.registry)

        # Push the registry onto the stack in case any code that depends on
        # the registry threadlocal APIs used in listeners subscribed to the
        # IApplicationCreated event.
        self.begin()
        try:
            self.registry.notify(ApplicationCreated(app))
        finally:
            self.end()

        return app


# this class is licensed under the ZPL (stolen from Zope)
class ActionState(object):
    def __init__(self):
        # NB "actions" is an API, dep'd upon by pyramid_zcml's load_zcml func
        self.actions = []
        self._seen_files = set()

    def processSpec(self, spec):
        """Check whether a callable needs to be processed.  The ``spec``
        refers to a unique identifier for the callable.

        Return True if processing is needed and False otherwise. If
        the callable needs to be processed, it will be marked as
        processed, assuming that the caller will procces the callable if
        it needs to be processed.
        """
        if spec in self._seen_files:
            return False
        self._seen_files.add(spec)
        return True

    def action(self, discriminator, callable=None, args=(), kw=None, order=0,
               includepath=(), info=None, introspectables=(), **extra):
        """Add an action with the given discriminator, callable and arguments
        """
        if kw is None:
            kw = {}
        action = extra
        action.update(
            dict(
                discriminator=discriminator,
                callable=callable,
                args=args,
                kw=kw,
                includepath=includepath,
                info=info,
                order=order,
                introspectables=introspectables,
                )
            )
        self.actions.append(action)

    def execute_actions(self, clear=True, introspector=None):
        """Execute the configuration actions

        This calls the action callables after resolving conflicts

        For example:

        >>> output = []
        >>> def f(*a, **k):
        ...    output.append(('f', a, k))
        >>> context = ActionState()
        >>> context.actions = [
        ...   (1, f, (1,)),
        ...   (1, f, (11,), {}, ('x', )),
        ...   (2, f, (2,)),
        ...   ]
        >>> context.execute_actions()
        >>> output
        [('f', (1,), {}), ('f', (2,), {})]

        If the action raises an error, we convert it to a
        ConfigurationExecutionError.

        >>> output = []
        >>> def bad():
        ...    bad.xxx
        >>> context.actions = [
        ...   (1, f, (1,)),
        ...   (1, f, (11,), {}, ('x', )),
        ...   (2, f, (2,)),
        ...   (3, bad, (), {}, (), 'oops')
        ...   ]
        >>> try:
        ...    v = context.execute_actions()
        ... except ConfigurationExecutionError, v:
        ...    pass
        >>> print(v)
        exceptions.AttributeError: 'function' object has no attribute 'xxx'
          in:
          oops

        Note that actions executed before the error still have an effect:

        >>> output
        [('f', (1,), {}), ('f', (2,), {})]

        The execution is re-entrant such that actions may be added by other
        actions with the one caveat that the order of any added actions must
        be equal to or larger than the current action.

        >>> output = []
        >>> def f(*a, **k):
        ...   output.append(('f', a, k))
        ...   context.actions.append((3, g, (8,), {}))
        >>> def g(*a, **k):
        ...    output.append(('g', a, k))
        >>> context.actions = [
        ...   (1, f, (1,)),
        ...   ]
        >>> context.execute_actions()
        >>> output
        [('f', (1,), {}), ('g', (8,), {})]

        """
        try:
            all_actions = []
            executed_actions = []
            action_iter = iter([])
            conflict_state = ConflictResolverState()

            while True:
                # We clear the actions list prior to execution so if there
                # are some new actions then we add them to the mix and resolve
                # conflicts again. This orders the new actions as well as
                # ensures that the previously executed actions have no new
                # conflicts.
                if self.actions:
                    all_actions.extend(self.actions)
                    action_iter = resolveConflicts(
                        self.actions,
                        state=conflict_state,
                    )
                    self.actions = []

                action = next(action_iter, None)
                if action is None:
                    # we are done!
                    break

                callable = action['callable']
                args = action['args']
                kw = action['kw']
                info = action['info']
                # we use "get" below in case an action was added via a ZCML
                # directive that did not know about introspectables
                introspectables = action.get('introspectables', ())

                try:
                    if callable is not None:
                        callable(*args, **kw)
                except Exception:
                    t, v, tb = sys.exc_info()
                    try:
                        reraise(ConfigurationExecutionError,
                                ConfigurationExecutionError(t, v, info),
                                tb)
                    finally:
                        del t, v, tb

                if introspector is not None:
                    for introspectable in introspectables:
                        introspectable.register(introspector, info)

                executed_actions.append(action)

            self.actions = all_actions
            return executed_actions

        finally:
            if clear:
                self.actions = []


class ConflictResolverState(object):
    def __init__(self):
        # keep a set of resolved discriminators to test against to ensure
        # that a new action does not conflict with something already executed
        self.resolved_ainfos = {}

        # actions left over from a previous iteration
        self.remaining_actions = []

        # after executing an action we memoize its order to avoid any new
        # actions sending us backward
        self.min_order = None

        # unique tracks the index of the action so we need it to increase
        # monotonically across invocations to resolveConflicts
        self.start = 0


# this function is licensed under the ZPL (stolen from Zope)
def resolveConflicts(actions, state=None):
    """Resolve conflicting actions

    Given an actions list, identify and try to resolve conflicting actions.
    Actions conflict if they have the same non-None discriminator.

    Conflicting actions can be resolved if the include path of one of
    the actions is a prefix of the includepaths of the other
    conflicting actions and is unequal to the include paths in the
    other conflicting actions.

    Actions are resolved on a per-order basis because some discriminators
    cannot be computed until earlier actions have executed. An action in an
    earlier order may execute successfully only to find out later that it was
    overridden by another action with a smaller include path. This will result
    in a conflict as there is no way to revert the original action.

    ``state`` may be an instance of ``ConflictResolverState`` that
    can be used to resume execution and resolve the new actions against the
    list of executed actions from a previous call.

    """
    if state is None:
        state = ConflictResolverState()

    # pick up where we left off last time, but track the new actions as well
    state.remaining_actions.extend(normalize_actions(actions))
    actions = state.remaining_actions

    def orderandpos(v):
        n, v = v
        return (v['order'] or 0, n)

    def orderonly(v):
        n, v = v
        return v['order'] or 0

    sactions = sorted(enumerate(actions, start=state.start), key=orderandpos)
    for order, actiongroup in itertools.groupby(sactions, orderonly):
        # "order" is an integer grouping. Actions in a lower order will be
        # executed before actions in a higher order.  All of the actions in
        # one grouping will be executed (its callable, if any will be called)
        # before any of the actions in the next.
        output = []
        unique = {}

        # error out if we went backward in order
        if state.min_order is not None and order < state.min_order:
            r = ['Actions were added to order={0} after execution had moved '
                 'on to order={1}. Conflicting actions: '
                 .format(order, state.min_order)]
            for i, action in actiongroup:
                for line in str(action['info']).rstrip().split('\n'):
                    r.append("  " + line)
            raise ConfigurationError('\n'.join(r))

        for i, action in actiongroup:
            # Within an order, actions are executed sequentially based on
            # original action ordering ("i").

            # "ainfo" is a tuple of (i, action) where "i" is an integer
            # expressing the relative position of this action in the action
            # list being resolved, and "action" is an action dictionary.  The
            # purpose of an ainfo is to associate an "i" with a particular
            # action; "i" exists for sorting after conflict resolution.
            ainfo = (i, action)

            # wait to defer discriminators until we are on their order because
            # the discriminator may depend on state from a previous order
            discriminator = undefer(action['discriminator'])
            action['discriminator'] = discriminator

            if discriminator is None:
                # The discriminator is None, so this action can never conflict.
                # We can add it directly to the result.
                output.append(ainfo)
                continue

            L = unique.setdefault(discriminator, [])
            L.append(ainfo)

        # Check for conflicts
        conflicts = {}
        for discriminator, ainfos in unique.items():
            # We use (includepath, i) as a sort key because we need to
            # sort the actions by the paths so that the shortest path with a
            # given prefix comes first.  The "first" action is the one with the
            # shortest include path.  We break sorting ties using "i".
            def bypath(ainfo):
                path, i = ainfo[1]['includepath'], ainfo[0]
                return path, order, i

            ainfos.sort(key=bypath)
            ainfo, rest = ainfos[0], ainfos[1:]
            _, action = ainfo

            # ensure this new action does not conflict with a previously
            # resolved action from an earlier order / invocation
            prev_ainfo = state.resolved_ainfos.get(discriminator)
            if prev_ainfo is not None:
                _, paction = prev_ainfo
                basepath, baseinfo = paction['includepath'], paction['info']
                includepath = action['includepath']
                # if the new action conflicts with the resolved action then
                # note the conflict, otherwise drop the action as it's
                # effectively overriden by the previous action
                if (includepath[:len(basepath)] != basepath or
                        includepath == basepath):
                    L = conflicts.setdefault(discriminator, [baseinfo])
                    L.append(action['info'])

            else:
                output.append(ainfo)

            basepath, baseinfo = action['includepath'], action['info']
            for _, action in rest:
                includepath = action['includepath']
                # Test whether path is a prefix of opath
                if (includepath[:len(basepath)] != basepath or  # not a prefix
                        includepath == basepath):
                    L = conflicts.setdefault(discriminator, [baseinfo])
                    L.append(action['info'])

        if conflicts:
            raise ConfigurationConflictError(conflicts)

        # sort resolved actions by "i" and yield them one by one
        for i, action in sorted(output, key=operator.itemgetter(0)):
            # do not memoize the order until we resolve an action inside it
            state.min_order = action['order']
            state.start = i + 1
            state.remaining_actions.remove(action)
            state.resolved_ainfos[action['discriminator']] = (i, action)
            yield action


def normalize_actions(actions):
    """Convert old-style tuple actions to new-style dicts."""
    result = []
    for v in actions:
        if not isinstance(v, dict):
            v = expand_action_tuple(*v)
        result.append(v)
    return result


def expand_action_tuple(
    discriminator, callable=None, args=(), kw=None, includepath=(),
    info=None, order=0, introspectables=(),
):
    if kw is None:
        kw = {}
    return dict(
        discriminator=discriminator,
        callable=callable,
        args=args,
        kw=kw,
        includepath=includepath,
        info=info,
        order=order,
        introspectables=introspectables,
        )


global_registries = WeakOrderedSet()

```
--- END FILE ---

Please first localize the bug based on the issue statement, and then generate *SEARCH/REPLACE* edits to fix the issue.

Every *SEARCH/REPLACE* edit must use this format:
1. The file path
2. The start of search block: <<<<<<< SEARCH
3. A contiguous chunk of lines to search for in the existing source code
4. The dividing line: =======
5. The lines to replace into the source code
6. The end of the replace block: >>>>>>> REPLACE

Here is an example:

```python
### mathweb/flask/app.py
<<<<<<< SEARCH
from flask import Flask
=======
import math
from flask import Flask
>>>>>>> REPLACE
```
</solution>

Please note that the *SEARCH/REPLACE* edit REQUIRES PROPER INDENTATION. If you would like to add the line '        print(x)', you must fully write that out, with all those spaces before the code!
Wrap each *SEARCH/REPLACE* edit in a code block as shown in the example above. If you have multiple *SEARCH/REPLACE* edits, use a separate code block for each one.
user