{
    "file_diffs": [
        {
            "old_file_content": "# (c) 2005 Ian Bicking and contributors; written for Paste\n# (http://pythonpaste.org) Licensed under the MIT license:\n# http://www.opensource.org/licenses/mit-license.php\n#\n# For discussion of daemonizing:\n# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/278731\n#\n# Code taken also from QP: http://www.mems-exchange.org/software/qp/ From\n# lib/site.py\n\nimport atexit\nimport ctypes\nimport errno\nimport logging\nimport optparse\nimport os\nimport re\nimport subprocess\nimport sys\nimport textwrap\nimport threading\nimport time\nimport traceback\n\nfrom paste.deploy import loadserver\nfrom paste.deploy import loadapp\n\nfrom pyramid.compat import WIN\n\nfrom pyramid.paster import setup_logging\n\nfrom pyramid.scripts.common import parse_vars\n\nMAXFD = 1024\n\nif WIN and not hasattr(os, 'kill'): # pragma: no cover\n    # py 2.6 on windows\n    def kill(pid, sig=None):\n        \"\"\"kill function for Win32\"\"\"\n        # signal is ignored, semibogus raise message\n        kernel32 = ctypes.windll.kernel32\n        handle = kernel32.OpenProcess(1, 0, pid)\n        if (0 == kernel32.TerminateProcess(handle, 0)):\n            raise OSError('No such process %s' % pid)\nelse:\n    kill = os.kill\n\ndef main(argv=sys.argv):\n    command = PServeCommand(argv)\n    return command.run()\n\nclass DaemonizeException(Exception):\n    pass\n\nclass PServeCommand(object):\n\n    usage = '%prog config_uri [start|stop|restart|status] [var=value]'\n    description = \"\"\"\\\n    This command serves a web application that uses a PasteDeploy\n    configuration file for the server and application.\n\n    If start/stop/restart is given, then --daemon is implied, and it will\n    start (normal operation), stop (--stop-daemon), or do both.\n\n    You can also include variable assignments like 'http_port=8080'\n    and then use %(http_port)s in your config files.\n    \"\"\"\n    default_verbosity = 1\n\n    parser = optparse.OptionParser(\n        usage,\n        description=textwrap.dedent(description)\n        )\n    parser.add_option(\n        '-n', '--app-name',\n        dest='app_name',\n        metavar='NAME',\n        help=\"Load the named application (default main)\")\n    parser.add_option(\n        '-s', '--server',\n        dest='server',\n        metavar='SERVER_TYPE',\n        help=\"Use the named server.\")\n    parser.add_option(\n        '--server-name',\n        dest='server_name',\n        metavar='SECTION_NAME',\n        help=(\"Use the named server as defined in the configuration file \"\n              \"(default: main)\"))\n    if hasattr(os, 'fork'):\n        parser.add_option(\n            '--daemon',\n            dest=\"daemon\",\n            action=\"store_true\",\n            help=\"Run in daemon (background) mode\")\n    parser.add_option(\n        '--pid-file',\n        dest='pid_file',\n        metavar='FILENAME',\n        help=(\"Save PID to file (default to pyramid.pid if running in \"\n              \"daemon mode)\"))\n    parser.add_option(\n        '--log-file',\n        dest='log_file',\n        metavar='LOG_FILE',\n        help=\"Save output to the given log file (redirects stdout)\")\n    parser.add_option(\n        '--reload',\n        dest='reload',\n        action='store_true',\n        help=\"Use auto-restart file monitor\")\n    parser.add_option(\n        '--reload-interval',\n        dest='reload_interval',\n        default=1,\n        help=(\"Seconds between checking files (low number can cause \"\n              \"significant CPU usage)\"))\n    parser.add_option(\n        '--monitor-restart',\n        dest='monitor_restart',\n        action='store_true',\n        help=\"Auto-restart server if it dies\")\n    parser.add_option(\n        '--status',\n        action='store_true',\n        dest='show_status',\n        help=\"Show the status of the (presumably daemonized) server\")\n    parser.add_option(\n        '-v', '--verbose',\n        default=default_verbosity,\n        dest='verbose',\n        action='count',\n        help=\"Set verbose level (default \"+str(default_verbosity)+\")\")\n    parser.add_option(\n        '-q', '--quiet',\n        action='store_const',\n        const=0,\n        dest='verbose',\n        help=\"Suppress verbose output\")\n\n    if hasattr(os, 'setuid'):\n        # I don't think these are available on Windows\n        parser.add_option(\n            '--user',\n            dest='set_user',\n            metavar=\"USERNAME\",\n            help=\"Set the user (usually only possible when run as root)\")\n        parser.add_option(\n            '--group',\n            dest='set_group',\n            metavar=\"GROUP\",\n            help=\"Set the group (usually only possible when run as root)\")\n\n    parser.add_option(\n        '--stop-daemon',\n        dest='stop_daemon',\n        action='store_true',\n        help=('Stop a daemonized server (given a PID file, or default '\n              'pyramid.pid file)'))\n\n    _scheme_re = re.compile(r'^[a-z][a-z]+:', re.I)\n\n    _reloader_environ_key = 'PYTHON_RELOADER_SHOULD_RUN'\n    _monitor_environ_key = 'PASTE_MONITOR_SHOULD_RUN'\n\n    possible_subcommands = ('start', 'stop', 'restart', 'status')\n\n    def __init__(self, argv):\n        self.options, self.args = self.parser.parse_args(argv[1:])\n\n    def out(self, msg): # pragma: no cover\n        print(msg)\n\n    def get_options(self):\n        if (len(self.args) > 1\n            and self.args[1] in self.possible_subcommands):\n            restvars = self.args[2:]\n        else:\n            restvars = self.args[1:]\n\n        return parse_vars(restvars)\n\n    def run(self): # pragma: no cover\n        if self.options.stop_daemon:\n            return self.stop_daemon()\n\n        if not hasattr(self.options, 'set_user'):\n            # Windows case:\n            self.options.set_user = self.options.set_group = None\n\n        # @@: Is this the right stage to set the user at?\n        self.change_user_group(\n            self.options.set_user, self.options.set_group)\n\n        if not self.args:\n            self.out('You must give a config file')\n            return 2\n        app_spec = self.args[0]\n\n        if (len(self.args) > 1\n            and self.args[1] in self.possible_subcommands):\n            cmd = self.args[1]\n        else:\n            cmd = None\n\n        if self.options.reload:\n            if os.environ.get(self._reloader_environ_key):\n                if self.options.verbose > 1:\n                    self.out('Running reloading file monitor')\n                install_reloader(int(self.options.reload_interval), [app_spec])\n                # if self.requires_config_file:\n                #     watch_file(self.args[0])\n            else:\n                return self.restart_with_reloader()\n\n        if cmd not in (None, 'start', 'stop', 'restart', 'status'):\n            self.out(\n                'Error: must give start|stop|restart (not %s)' % cmd)\n            return 2\n\n        if cmd == 'status' or self.options.show_status:\n            return self.show_status()\n\n        if cmd == 'restart' or cmd == 'stop':\n            result = self.stop_daemon()\n            if result:\n                if cmd == 'restart':\n                    self.out(\"Could not stop daemon; aborting\")\n                else:\n                    self.out(\"Could not stop daemon\")\n                return result\n            if cmd == 'stop':\n                return result\n            self.options.daemon = True\n\n        if cmd == 'start':\n            self.options.daemon = True\n\n        app_name = self.options.app_name\n\n        vars = self.get_options()\n\n        if not self._scheme_re.search(app_spec):\n            app_spec = 'config:' + app_spec\n        server_name = self.options.server_name\n        if self.options.server:\n            server_spec = 'egg:pyramid'\n            assert server_name is None\n            server_name = self.options.server\n        else:\n            server_spec = app_spec\n        base = os.getcwd()\n\n        if getattr(self.options, 'daemon', False):\n            if not self.options.pid_file:\n                self.options.pid_file = 'pyramid.pid'\n            if not self.options.log_file:\n                self.options.log_file = 'pyramid.log'\n\n        # Ensure the log file is writeable\n        if self.options.log_file:\n            try:\n                writeable_log_file = open(self.options.log_file, 'a')\n            except IOError as ioe:\n                msg = 'Error: Unable to write to log file: %s' % ioe\n                raise ValueError(msg)\n            writeable_log_file.close()\n\n        # Ensure the pid file is writeable\n        if self.options.pid_file:\n            try:\n                writeable_pid_file = open(self.options.pid_file, 'a')\n            except IOError as ioe:\n                msg = 'Error: Unable to write to pid file: %s' % ioe\n                raise ValueError(msg)\n            writeable_pid_file.close()\n\n        if getattr(self.options, 'daemon', False):\n            try:\n                self.daemonize()\n            except DaemonizeException as ex:\n                if self.options.verbose > 0:\n                    self.out(str(ex))\n                return 2\n\n        if (self.options.monitor_restart\n            and not os.environ.get(self._monitor_environ_key)):\n            return self.restart_with_monitor()\n\n        if self.options.pid_file:\n            self.record_pid(self.options.pid_file)\n\n        if self.options.log_file:\n            stdout_log = LazyWriter(self.options.log_file, 'a')\n            sys.stdout = stdout_log\n            sys.stderr = stdout_log\n            logging.basicConfig(stream=stdout_log)\n\n        log_fn = app_spec\n        if log_fn.startswith('config:'):\n            log_fn = app_spec[len('config:'):]\n        elif log_fn.startswith('egg:'):\n            log_fn = None\n        if log_fn:\n            log_fn = os.path.join(base, log_fn)\n            setup_logging(log_fn)\n\n        server = self.loadserver(server_spec, name=server_name,\n                                 relative_to=base, global_conf=vars)\n\n        app = self.loadapp(app_spec, name=app_name, relative_to=base,\n                global_conf=vars)\n\n        if self.options.verbose > 0:\n            if hasattr(os, 'getpid'):\n                msg = 'Starting server in PID %i.' % os.getpid()\n            else:\n                msg = 'Starting server.'\n            self.out(msg)\n\n        def serve():\n            try:\n                server(app)\n            except (SystemExit, KeyboardInterrupt) as e:\n                if self.options.verbose > 1:\n                    raise\n                if str(e):\n                    msg = ' ' + str(e)\n                else:\n                    msg = ''\n                self.out('Exiting%s (-v to see traceback)' % msg)\n\n        serve()\n\n    def loadapp(self, app_spec, name, relative_to, **kw): # pragma: no cover\n        return loadapp(app_spec, name=name, relative_to=relative_to, **kw)\n\n    def loadserver(self, server_spec, name, relative_to, **kw):# pragma:no cover\n        return loadserver(\n            server_spec, name=name, relative_to=relative_to, **kw)\n\n    def quote_first_command_arg(self, arg): # pragma: no cover\n        \"\"\"\n        There's a bug in Windows when running an executable that's\n        located inside a path with a space in it.  This method handles\n        that case, or on non-Windows systems or an executable with no\n        spaces, it just leaves well enough alone.\n        \"\"\"\n        if (sys.platform != 'win32' or ' ' not in arg):\n            # Problem does not apply:\n            return arg\n        try:\n            import win32api\n        except ImportError:\n            raise ValueError(\n                \"The executable %r contains a space, and in order to \"\n                \"handle this issue you must have the win32api module \"\n                \"installed\" % arg)\n        arg = win32api.GetShortPathName(arg)\n        return arg\n\n    def daemonize(self): # pragma: no cover\n        pid = live_pidfile(self.options.pid_file)\n        if pid:\n            raise DaemonizeException(\n                \"Daemon is already running (PID: %s from PID file %s)\"\n                % (pid, self.options.pid_file))\n\n        if self.options.verbose > 0:\n            self.out('Entering daemon mode')\n        pid = os.fork()\n        if pid:\n            # The forked process also has a handle on resources, so we\n            # *don't* want proper termination of the process, we just\n            # want to exit quick (which os._exit() does)\n            os._exit(0)\n        # Make this the session leader\n        os.setsid()\n        # Fork again for good measure!\n        pid = os.fork()\n        if pid:\n            os._exit(0)\n\n        # @@: Should we set the umask and cwd now?\n\n        import resource  # Resource usage information.\n        maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]\n        if (maxfd == resource.RLIM_INFINITY):\n            maxfd = MAXFD\n        # Iterate through and close all file descriptors.\n        for fd in range(0, maxfd):\n            try:\n                os.close(fd)\n            except OSError:  # ERROR, fd wasn't open to begin with (ignored)\n                pass\n\n        if (hasattr(os, \"devnull\")):\n            REDIRECT_TO = os.devnull\n        else:\n            REDIRECT_TO = \"/dev/null\"\n        os.open(REDIRECT_TO, os.O_RDWR)  # standard input (0)\n        # Duplicate standard input to standard output and standard error.\n        os.dup2(0, 1)  # standard output (1)\n        os.dup2(0, 2)  # standard error (2)\n\n    def _remove_pid_file(self, written_pid, filename, verbosity):\n        current_pid = os.getpid()\n        if written_pid != current_pid:\n            # A forked process must be exiting, not the process that\n            # wrote the PID file\n            return\n        if not os.path.exists(filename):\n            return\n        with open(filename) as f:\n            content = f.read().strip()\n        try:\n            pid_in_file = int(content)\n        except ValueError:\n            pass\n        else:\n            if pid_in_file != current_pid:\n                msg = \"PID file %s contains %s, not expected PID %s\"\n                self.out(msg % (filename, pid_in_file, current_pid))\n                return\n        if verbosity > 0:\n            self.out(\"Removing PID file %s\" % filename)\n        try:\n            os.unlink(filename)\n            return\n        except OSError as e:\n            # Record, but don't give traceback\n            self.out(\"Cannot remove PID file: (%s)\" % e)\n        # well, at least lets not leave the invalid PID around...\n        try:\n            with open(filename, 'w') as f:\n                f.write('')\n        except OSError as e:\n            self.out('Stale PID left in file: %s (%s)' % (filename, e))\n        else:\n            self.out('Stale PID removed')\n\n    def record_pid(self, pid_file):\n        pid = os.getpid()\n        if self.options.verbose > 1:\n            self.out('Writing PID %s to %s' % (pid, pid_file))\n        with open(pid_file, 'w') as f:\n            f.write(str(pid))\n        atexit.register(self._remove_pid_file, pid, pid_file, self.options.verbose)\n\n    def stop_daemon(self): # pragma: no cover\n        pid_file = self.options.pid_file or 'pyramid.pid'\n        if not os.path.exists(pid_file):\n            self.out('No PID file exists in %s' % pid_file)\n            return 1\n        pid = read_pidfile(pid_file)\n        if not pid:\n            self.out(\"Not a valid PID file in %s\" % pid_file)\n            return 1\n        pid = live_pidfile(pid_file)\n        if not pid:\n            self.out(\"PID in %s is not valid (deleting)\" % pid_file)\n            try:\n                os.unlink(pid_file)\n            except (OSError, IOError) as e:\n                self.out(\"Could not delete: %s\" % e)\n                return 2\n            return 1\n        for j in range(10):\n            if not live_pidfile(pid_file):\n                break\n            import signal\n            kill(pid, signal.SIGTERM)\n            time.sleep(1)\n        else:\n            self.out(\"failed to kill web process %s\" % pid)\n            return 3\n        if os.path.exists(pid_file):\n            os.unlink(pid_file)\n        return 0\n\n    def show_status(self): # pragma: no cover\n        pid_file = self.options.pid_file or 'pyramid.pid'\n        if not os.path.exists(pid_file):\n            self.out('No PID file %s' % pid_file)\n            return 1\n        pid = read_pidfile(pid_file)\n        if not pid:\n            self.out('No PID in file %s' % pid_file)\n            return 1\n        pid = live_pidfile(pid_file)\n        if not pid:\n            self.out('PID %s in %s is not running' % (pid, pid_file))\n            return 1\n        self.out('Server running in PID %s' % pid)\n        return 0\n\n    def restart_with_reloader(self): # pragma: no cover\n        self.restart_with_monitor(reloader=True)\n\n    def restart_with_monitor(self, reloader=False): # pragma: no cover\n        if self.options.verbose > 0:\n            if reloader:\n                self.out('Starting subprocess with file monitor')\n            else:\n                self.out('Starting subprocess with monitor parent')\n        while 1:\n            args = [self.quote_first_command_arg(sys.executable)] + sys.argv\n            new_environ = os.environ.copy()\n            if reloader:\n                new_environ[self._reloader_environ_key] = 'true'\n            else:\n                new_environ[self._monitor_environ_key] = 'true'\n            proc = None\n            try:\n                try:\n                    _turn_sigterm_into_systemexit()\n                    proc = subprocess.Popen(args, env=new_environ)\n                    exit_code = proc.wait()\n                    proc = None\n                except KeyboardInterrupt:\n                    self.out('^C caught in monitor process')\n                    if self.options.verbose > 1:\n                        raise\n                    return 1\n            finally:\n                if proc is not None:\n                    import signal\n                    try:\n                        kill(proc.pid, signal.SIGTERM)\n                    except (OSError, IOError):\n                        pass\n\n            if reloader:\n                # Reloader always exits with code 3; but if we are\n                # a monitor, any exit code will restart\n                if exit_code != 3:\n                    return exit_code\n            if self.options.verbose > 0:\n                self.out('%s %s %s' % ('-' * 20, 'Restarting', '-' * 20))\n\n    def change_user_group(self, user, group): # pragma: no cover\n        if not user and not group:\n            return\n        import pwd, grp\n        uid = gid = None\n        if group:\n            try:\n                gid = int(group)\n                group = grp.getgrgid(gid).gr_name\n            except ValueError:\n                import grp\n                try:\n                    entry = grp.getgrnam(group)\n                except KeyError:\n                    raise ValueError(\n                        \"Bad group: %r; no such group exists\" % group)\n                gid = entry.gr_gid\n        try:\n            uid = int(user)\n            user = pwd.getpwuid(uid).pw_name\n        except ValueError:\n            try:\n                entry = pwd.getpwnam(user)\n            except KeyError:\n                raise ValueError(\n                    \"Bad username: %r; no such user exists\" % user)\n            if not gid:\n                gid = entry.pw_gid\n            uid = entry.pw_uid\n        if self.options.verbose > 0:\n            self.out('Changing user to %s:%s (%s:%s)' % (\n                user, group or '(unknown)', uid, gid))\n        if gid:\n            os.setgid(gid)\n        if uid:\n            os.setuid(uid)\n\nclass LazyWriter(object):\n\n    \"\"\"\n    File-like object that opens a file lazily when it is first written\n    to.\n    \"\"\"\n\n    def __init__(self, filename, mode='w'):\n        self.filename = filename\n        self.fileobj = None\n        self.lock = threading.Lock()\n        self.mode = mode\n\n    def open(self):\n        if self.fileobj is None:\n            with self.lock:\n                self.fileobj = open(self.filename, self.mode)\n        return self.fileobj\n\n    def close(self):\n        fileobj = self.fileobj\n        if fileobj is not None:\n            fileobj.close()\n\n    def __del__(self):\n        self.close()\n\n    def write(self, text):\n        fileobj = self.open()\n        fileobj.write(text)\n        fileobj.flush()\n\n    def writelines(self, text):\n        fileobj = self.open()\n        fileobj.writelines(text)\n        fileobj.flush()\n\n    def flush(self):\n        self.open().flush()\n\ndef live_pidfile(pidfile): # pragma: no cover\n    \"\"\"(pidfile:str) -> int | None\n    Returns an int found in the named file, if there is one,\n    and if there is a running process with that process id.\n    Return None if no such process exists.\n    \"\"\"\n    pid = read_pidfile(pidfile)\n    if pid:\n        try:\n            kill(int(pid), 0)\n            return pid\n        except OSError as e:\n            if e.errno == errno.EPERM:\n                return pid\n    return None\n\ndef read_pidfile(filename):\n    if os.path.exists(filename):\n        try:\n            with open(filename) as f:\n                content = f.read()\n            return int(content.strip())\n        except (ValueError, IOError):\n            return None\n    else:\n        return None\n\ndef ensure_port_cleanup(\n    bound_addresses, maxtries=30, sleeptime=2): # pragma: no cover\n    \"\"\"\n    This makes sure any open ports are closed.\n\n    Does this by connecting to them until they give connection\n    refused.  Servers should call like::\n\n        ensure_port_cleanup([80, 443])\n    \"\"\"\n    atexit.register(_cleanup_ports, bound_addresses, maxtries=maxtries,\n                    sleeptime=sleeptime)\n\ndef _cleanup_ports(\n    bound_addresses, maxtries=30, sleeptime=2): # pragma: no cover\n    # Wait for the server to bind to the port.\n    import socket\n    import errno\n    for bound_address in bound_addresses:\n        for attempt in range(maxtries):\n            sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n            try:\n                sock.connect(bound_address)\n            except socket.error as e:\n                if e.args[0] != errno.ECONNREFUSED:\n                    raise\n                break\n            else:\n                time.sleep(sleeptime)\n        else:\n            raise SystemExit('Timeout waiting for port.')\n        sock.close()\n\ndef _turn_sigterm_into_systemexit(): # pragma: no cover\n    \"\"\"\n    Attempts to turn a SIGTERM exception into a SystemExit exception.\n    \"\"\"\n    try:\n        import signal\n    except ImportError:\n        return\n    def handle_term(signo, frame):\n        raise SystemExit\n    signal.signal(signal.SIGTERM, handle_term)\n\ndef install_reloader(poll_interval=1, extra_files=None): # pragma: no cover\n    \"\"\"\n    Install the reloading monitor.\n\n    On some platforms server threads may not terminate when the main\n    thread does, causing ports to remain open/locked.  The\n    ``raise_keyboard_interrupt`` option creates a unignorable signal\n    which causes the whole application to shut-down (rudely).\n    \"\"\"\n    mon = Monitor(poll_interval=poll_interval)\n    if extra_files is None:\n        extra_files = []\n    mon.extra_files.extend(extra_files)\n    t = threading.Thread(target=mon.periodic_reload)\n    t.setDaemon(True)\n    t.start()\n\nclass classinstancemethod(object):\n    \"\"\"\n    Acts like a class method when called from a class, like an\n    instance method when called by an instance.  The method should\n    take two arguments, 'self' and 'cls'; one of these will be None\n    depending on how the method was called.\n    \"\"\"\n\n    def __init__(self, func):\n        self.func = func\n        self.__doc__ = func.__doc__\n\n    def __get__(self, obj, type=None):\n        return _methodwrapper(self.func, obj=obj, type=type)\n\nclass _methodwrapper(object):\n\n    def __init__(self, func, obj, type):\n        self.func = func\n        self.obj = obj\n        self.type = type\n\n    def __call__(self, *args, **kw):\n        assert not 'self' in kw and not 'cls' in kw, (\n            \"You cannot use 'self' or 'cls' arguments to a \"\n            \"classinstancemethod\")\n        return self.func(*((self.obj, self.type) + args), **kw)\n\nclass Monitor(object): # pragma: no cover\n    \"\"\"\n    A file monitor and server restarter.\n\n    Use this like:\n\n    ..code-block:: Python\n\n        install_reloader()\n\n    Then make sure your server is installed with a shell script like::\n\n        err=3\n        while test \"$err\" -eq 3 ; do\n            python server.py\n            err=\"$?\"\n        done\n\n    or is run from this .bat file (if you use Windows)::\n\n        @echo off\n        :repeat\n            python server.py\n        if %errorlevel% == 3 goto repeat\n\n    or run a monitoring process in Python (``pserve --reload`` does\n    this).  \n\n    Use the ``watch_file(filename)`` function to cause a reload/restart for\n    other non-Python files (e.g., configuration files).  If you have\n    a dynamic set of files that grows over time you can use something like::\n\n        def watch_config_files():\n            return CONFIG_FILE_CACHE.keys()\n        add_file_callback(watch_config_files)\n\n    Then every time the reloader polls files it will call\n    ``watch_config_files`` and check all the filenames it returns.\n    \"\"\"\n    instances = []\n    global_extra_files = []\n    global_file_callbacks = []\n\n    def __init__(self, poll_interval):\n        self.module_mtimes = {}\n        self.keep_running = True\n        self.poll_interval = poll_interval\n        self.extra_files = list(self.global_extra_files)\n        self.instances.append(self)\n        self.file_callbacks = list(self.global_file_callbacks)\n\n    def _exit(self):\n        # use os._exit() here and not sys.exit() since within a\n        # thread sys.exit() just closes the given thread and\n        # won't kill the process; note os._exit does not call\n        # any atexit callbacks, nor does it do finally blocks,\n        # flush open files, etc.  In otherwords, it is rude.\n        os._exit(3)\n\n    def periodic_reload(self):\n        while True:\n            if not self.check_reload():\n                self._exit()\n                break\n            time.sleep(self.poll_interval)\n\n    def check_reload(self):\n        filenames = list(self.extra_files)\n        for file_callback in self.file_callbacks:\n            try:\n                filenames.extend(file_callback())\n            except:\n                print(\n                    \"Error calling reloader callback %r:\" % file_callback)\n                traceback.print_exc()\n        for module in sys.modules.values():\n            try:\n                filename = module.__file__\n            except (AttributeError, ImportError):\n                continue\n            if filename is not None:\n                filenames.append(filename)\n        for filename in filenames:\n            try:\n                stat = os.stat(filename)\n                if stat:\n                    mtime = stat.st_mtime\n                else:\n                    mtime = 0\n            except (OSError, IOError):\n                continue\n            if filename.endswith('.pyc') and os.path.exists(filename[:-1]):\n                mtime = max(os.stat(filename[:-1]).st_mtime, mtime)\n            if not filename in self.module_mtimes:\n                self.module_mtimes[filename] = mtime\n            elif self.module_mtimes[filename] < mtime:\n                print(\"%s changed; reloading...\" % filename)\n                return False\n        return True\n\n    def watch_file(self, cls, filename):\n        \"\"\"Watch the named file for changes\"\"\"\n        filename = os.path.abspath(filename)\n        if self is None:\n            for instance in cls.instances:\n                instance.watch_file(filename)\n            cls.global_extra_files.append(filename)\n        else:\n            self.extra_files.append(filename)\n\n    watch_file = classinstancemethod(watch_file)\n\n    def add_file_callback(self, cls, callback):\n        \"\"\"Add a callback -- a function that takes no parameters -- that will\n        return a list of filenames to watch for changes.\"\"\"\n        if self is None:\n            for instance in cls.instances:\n                instance.add_file_callback(callback)\n            cls.global_file_callbacks.append(callback)\n        else:\n            self.file_callbacks.append(callback)\n\n    add_file_callback = classinstancemethod(add_file_callback)\n\nwatch_file = Monitor.watch_file\nadd_file_callback = Monitor.add_file_callback\n\n# For paste.deploy server instantiation (egg:pyramid#wsgiref)\ndef wsgiref_server_runner(wsgi_app, global_conf, **kw): # pragma: no cover\n    from wsgiref.simple_server import make_server\n    host = kw.get('host', '0.0.0.0')\n    port = int(kw.get('port', 8080))\n    server = make_server(host, port, wsgi_app)\n    print('Starting HTTP server on http://%s:%s' % (host, port))\n    server.serve_forever()\n\n# For paste.deploy server instantiation (egg:pyramid#cherrypy)\ndef cherrypy_server_runner(\n        app, global_conf=None, host='127.0.0.1', port=None,\n        ssl_pem=None, protocol_version=None, numthreads=None,\n        server_name=None, max=None, request_queue_size=None,\n        timeout=None\n        ): # pragma: no cover\n    \"\"\"\n    Entry point for CherryPy's WSGI server\n\n    Serves the specified WSGI app via CherryPyWSGIServer.\n\n    ``app``\n\n        The WSGI 'application callable'; multiple WSGI applications\n        may be passed as (script_name, callable) pairs.\n\n    ``host``\n\n        This is the ipaddress to bind to (or a hostname if your\n        nameserver is properly configured).  This defaults to\n        127.0.0.1, which is not a public interface.\n\n    ``port``\n\n        The port to run on, defaults to 8080 for HTTP, or 4443 for\n        HTTPS. This can be a string or an integer value.\n\n    ``ssl_pem``\n\n        This an optional SSL certificate file (via OpenSSL) You can\n        generate a self-signed test PEM certificate file as follows:\n\n            $ openssl genrsa 1024 > host.key\n            $ chmod 400 host.key\n            $ openssl req -new -x509 -nodes -sha1 -days 365  \\\\\n                          -key host.key > host.cert\n            $ cat host.cert host.key > host.pem\n            $ chmod 400 host.pem\n\n    ``protocol_version``\n\n        The protocol used by the server, by default ``HTTP/1.1``.\n\n    ``numthreads``\n\n        The number of worker threads to create.\n\n    ``server_name``\n\n        The string to set for WSGI's SERVER_NAME environ entry.\n\n    ``max``\n\n        The maximum number of queued requests. (defaults to -1 = no\n        limit).\n\n    ``request_queue_size``\n\n        The 'backlog' argument to socket.listen(); specifies the\n        maximum number of queued connections.\n\n    ``timeout``\n\n        The timeout in seconds for accepted connections.\n    \"\"\"\n    is_ssl = False\n    if ssl_pem:\n        port = port or 4443\n        is_ssl = True\n\n    if not port:\n        if ':' in host:\n            host, port = host.split(':', 1)\n        else:\n            port = 8080\n    bind_addr = (host, int(port))\n\n    kwargs = {}\n    for var_name in ('numthreads', 'max', 'request_queue_size', 'timeout'):\n        var = locals()[var_name]\n        if var is not None:\n            kwargs[var_name] = int(var)\n\n    from cherrypy import wsgiserver\n\n    server = wsgiserver.CherryPyWSGIServer(bind_addr, app,\n                                           server_name=server_name, **kwargs)\n    server.ssl_certificate = server.ssl_private_key = ssl_pem\n    if protocol_version:\n        server.protocol = protocol_version\n\n    try:\n        protocol = is_ssl and 'https' or 'http'\n        if host == '0.0.0.0':\n            print('serving on 0.0.0.0:%s view at %s://127.0.0.1:%s' %\n                  (port, protocol, port))\n        else:\n            print('serving on %s://%s:%s' % (protocol, host, port))\n        server.start()\n    except (KeyboardInterrupt, SystemExit):\n        server.stop()\n\n    return server\n",
            "new_file_content": "# (c) 2005 Ian Bicking and contributors; written for Paste\n# (http://pythonpaste.org) Licensed under the MIT license:\n# http://www.opensource.org/licenses/mit-license.php\n#\n# For discussion of daemonizing:\n# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/278731\n#\n# Code taken also from QP: http://www.mems-exchange.org/software/qp/ From\n# lib/site.py\n\nimport atexit\nimport ctypes\nimport errno\nimport logging\nimport optparse\nimport os\nimport re\nimport subprocess\nimport sys\nimport textwrap\nimport threading\nimport time\nimport traceback\n\nfrom paste.deploy import loadserver\nfrom paste.deploy import loadapp\n\nfrom pyramid.compat import WIN\n\nfrom pyramid.paster import setup_logging\n\nfrom pyramid.scripts.common import parse_vars\n\nMAXFD = 1024\n\nif WIN and not hasattr(os, 'kill'): # pragma: no cover\n    # py 2.6 on windows\n    def kill(pid, sig=None):\n        \"\"\"kill function for Win32\"\"\"\n        # signal is ignored, semibogus raise message\n        kernel32 = ctypes.windll.kernel32\n        handle = kernel32.OpenProcess(1, 0, pid)\n        if (0 == kernel32.TerminateProcess(handle, 0)):\n            raise OSError('No such process %s' % pid)\nelse:\n    kill = os.kill\n\ndef main(argv=sys.argv, quiet=False):\n    command = PServeCommand(argv, quiet=quiet)\n    return command.run()\n\nclass DaemonizeException(Exception):\n    pass\n\nclass PServeCommand(object):\n\n    usage = '%prog config_uri [start|stop|restart|status] [var=value]'\n    description = \"\"\"\\\n    This command serves a web application that uses a PasteDeploy\n    configuration file for the server and application.\n\n    If start/stop/restart is given, then --daemon is implied, and it will\n    start (normal operation), stop (--stop-daemon), or do both.\n\n    You can also include variable assignments like 'http_port=8080'\n    and then use %(http_port)s in your config files.\n    \"\"\"\n    default_verbosity = 1\n\n    parser = optparse.OptionParser(\n        usage,\n        description=textwrap.dedent(description)\n        )\n    parser.add_option(\n        '-n', '--app-name',\n        dest='app_name',\n        metavar='NAME',\n        help=\"Load the named application (default main)\")\n    parser.add_option(\n        '-s', '--server',\n        dest='server',\n        metavar='SERVER_TYPE',\n        help=\"Use the named server.\")\n    parser.add_option(\n        '--server-name',\n        dest='server_name',\n        metavar='SECTION_NAME',\n        help=(\"Use the named server as defined in the configuration file \"\n              \"(default: main)\"))\n    if hasattr(os, 'fork'):\n        parser.add_option(\n            '--daemon',\n            dest=\"daemon\",\n            action=\"store_true\",\n            help=\"Run in daemon (background) mode\")\n    parser.add_option(\n        '--pid-file',\n        dest='pid_file',\n        metavar='FILENAME',\n        help=(\"Save PID to file (default to pyramid.pid if running in \"\n              \"daemon mode)\"))\n    parser.add_option(\n        '--log-file',\n        dest='log_file',\n        metavar='LOG_FILE',\n        help=\"Save output to the given log file (redirects stdout)\")\n    parser.add_option(\n        '--reload',\n        dest='reload',\n        action='store_true',\n        help=\"Use auto-restart file monitor\")\n    parser.add_option(\n        '--reload-interval',\n        dest='reload_interval',\n        default=1,\n        help=(\"Seconds between checking files (low number can cause \"\n              \"significant CPU usage)\"))\n    parser.add_option(\n        '--monitor-restart',\n        dest='monitor_restart',\n        action='store_true',\n        help=\"Auto-restart server if it dies\")\n    parser.add_option(\n        '--status',\n        action='store_true',\n        dest='show_status',\n        help=\"Show the status of the (presumably daemonized) server\")\n    parser.add_option(\n        '-v', '--verbose',\n        default=default_verbosity,\n        dest='verbose',\n        action='count',\n        help=\"Set verbose level (default \"+str(default_verbosity)+\")\")\n    parser.add_option(\n        '-q', '--quiet',\n        action='store_const',\n        const=0,\n        dest='verbose',\n        help=\"Suppress verbose output\")\n\n    if hasattr(os, 'setuid'):\n        # I don't think these are available on Windows\n        parser.add_option(\n            '--user',\n            dest='set_user',\n            metavar=\"USERNAME\",\n            help=\"Set the user (usually only possible when run as root)\")\n        parser.add_option(\n            '--group',\n            dest='set_group',\n            metavar=\"GROUP\",\n            help=\"Set the group (usually only possible when run as root)\")\n\n    parser.add_option(\n        '--stop-daemon',\n        dest='stop_daemon',\n        action='store_true',\n        help=('Stop a daemonized server (given a PID file, or default '\n              'pyramid.pid file)'))\n\n    _scheme_re = re.compile(r'^[a-z][a-z]+:', re.I)\n\n    _reloader_environ_key = 'PYTHON_RELOADER_SHOULD_RUN'\n    _monitor_environ_key = 'PASTE_MONITOR_SHOULD_RUN'\n\n    possible_subcommands = ('start', 'stop', 'restart', 'status')\n\n    def __init__(self, argv, quiet=False):\n        self.options, self.args = self.parser.parse_args(argv[1:])\n        if quiet:\n            self.options.verbose = 0\n\n    def out(self, msg): # pragma: no cover\n        if self.options.verbose > 0:\n            print(msg)\n\n    def get_options(self):\n        if (len(self.args) > 1\n            and self.args[1] in self.possible_subcommands):\n            restvars = self.args[2:]\n        else:\n            restvars = self.args[1:]\n\n        return parse_vars(restvars)\n\n    def run(self): # pragma: no cover\n        if self.options.stop_daemon:\n            return self.stop_daemon()\n\n        if not hasattr(self.options, 'set_user'):\n            # Windows case:\n            self.options.set_user = self.options.set_group = None\n\n        # @@: Is this the right stage to set the user at?\n        self.change_user_group(\n            self.options.set_user, self.options.set_group)\n\n        if not self.args:\n            self.out('You must give a config file')\n            return 2\n        app_spec = self.args[0]\n\n        if (len(self.args) > 1\n            and self.args[1] in self.possible_subcommands):\n            cmd = self.args[1]\n        else:\n            cmd = None\n\n        if self.options.reload:\n            if os.environ.get(self._reloader_environ_key):\n                if self.options.verbose > 1:\n                    self.out('Running reloading file monitor')\n                install_reloader(int(self.options.reload_interval), [app_spec])\n                # if self.requires_config_file:\n                #     watch_file(self.args[0])\n            else:\n                return self.restart_with_reloader()\n\n        if cmd not in (None, 'start', 'stop', 'restart', 'status'):\n            self.out(\n                'Error: must give start|stop|restart (not %s)' % cmd)\n            return 2\n\n        if cmd == 'status' or self.options.show_status:\n            return self.show_status()\n\n        if cmd == 'restart' or cmd == 'stop':\n            result = self.stop_daemon()\n            if result:\n                if cmd == 'restart':\n                    self.out(\"Could not stop daemon; aborting\")\n                else:\n                    self.out(\"Could not stop daemon\")\n                return result\n            if cmd == 'stop':\n                return result\n            self.options.daemon = True\n\n        if cmd == 'start':\n            self.options.daemon = True\n\n        app_name = self.options.app_name\n\n        vars = self.get_options()\n\n        if not self._scheme_re.search(app_spec):\n            app_spec = 'config:' + app_spec\n        server_name = self.options.server_name\n        if self.options.server:\n            server_spec = 'egg:pyramid'\n            assert server_name is None\n            server_name = self.options.server\n        else:\n            server_spec = app_spec\n        base = os.getcwd()\n\n        if getattr(self.options, 'daemon', False):\n            if not self.options.pid_file:\n                self.options.pid_file = 'pyramid.pid'\n            if not self.options.log_file:\n                self.options.log_file = 'pyramid.log'\n\n        # Ensure the log file is writeable\n        if self.options.log_file:\n            try:\n                writeable_log_file = open(self.options.log_file, 'a')\n            except IOError as ioe:\n                msg = 'Error: Unable to write to log file: %s' % ioe\n                raise ValueError(msg)\n            writeable_log_file.close()\n\n        # Ensure the pid file is writeable\n        if self.options.pid_file:\n            try:\n                writeable_pid_file = open(self.options.pid_file, 'a')\n            except IOError as ioe:\n                msg = 'Error: Unable to write to pid file: %s' % ioe\n                raise ValueError(msg)\n            writeable_pid_file.close()\n\n        if getattr(self.options, 'daemon', False):\n            try:\n                self.daemonize()\n            except DaemonizeException as ex:\n                if self.options.verbose > 0:\n                    self.out(str(ex))\n                return 2\n\n        if (self.options.monitor_restart\n            and not os.environ.get(self._monitor_environ_key)):\n            return self.restart_with_monitor()\n\n        if self.options.pid_file:\n            self.record_pid(self.options.pid_file)\n\n        if self.options.log_file:\n            stdout_log = LazyWriter(self.options.log_file, 'a')\n            sys.stdout = stdout_log\n            sys.stderr = stdout_log\n            logging.basicConfig(stream=stdout_log)\n\n        log_fn = app_spec\n        if log_fn.startswith('config:'):\n            log_fn = app_spec[len('config:'):]\n        elif log_fn.startswith('egg:'):\n            log_fn = None\n        if log_fn:\n            log_fn = os.path.join(base, log_fn)\n            setup_logging(log_fn)\n\n        server = self.loadserver(server_spec, name=server_name,\n                                 relative_to=base, global_conf=vars)\n\n        app = self.loadapp(app_spec, name=app_name, relative_to=base,\n                global_conf=vars)\n\n        if self.options.verbose > 0:\n            if hasattr(os, 'getpid'):\n                msg = 'Starting server in PID %i.' % os.getpid()\n            else:\n                msg = 'Starting server.'\n            self.out(msg)\n\n        def serve():\n            try:\n                server(app)\n            except (SystemExit, KeyboardInterrupt) as e:\n                if self.options.verbose > 1:\n                    raise\n                if str(e):\n                    msg = ' ' + str(e)\n                else:\n                    msg = ''\n                self.out('Exiting%s (-v to see traceback)' % msg)\n\n        serve()\n\n    def loadapp(self, app_spec, name, relative_to, **kw): # pragma: no cover\n        return loadapp(app_spec, name=name, relative_to=relative_to, **kw)\n\n    def loadserver(self, server_spec, name, relative_to, **kw):# pragma:no cover\n        return loadserver(\n            server_spec, name=name, relative_to=relative_to, **kw)\n\n    def quote_first_command_arg(self, arg): # pragma: no cover\n        \"\"\"\n        There's a bug in Windows when running an executable that's\n        located inside a path with a space in it.  This method handles\n        that case, or on non-Windows systems or an executable with no\n        spaces, it just leaves well enough alone.\n        \"\"\"\n        if (sys.platform != 'win32' or ' ' not in arg):\n            # Problem does not apply:\n            return arg\n        try:\n            import win32api\n        except ImportError:\n            raise ValueError(\n                \"The executable %r contains a space, and in order to \"\n                \"handle this issue you must have the win32api module \"\n                \"installed\" % arg)\n        arg = win32api.GetShortPathName(arg)\n        return arg\n\n    def daemonize(self): # pragma: no cover\n        pid = live_pidfile(self.options.pid_file)\n        if pid:\n            raise DaemonizeException(\n                \"Daemon is already running (PID: %s from PID file %s)\"\n                % (pid, self.options.pid_file))\n\n        if self.options.verbose > 0:\n            self.out('Entering daemon mode')\n        pid = os.fork()\n        if pid:\n            # The forked process also has a handle on resources, so we\n            # *don't* want proper termination of the process, we just\n            # want to exit quick (which os._exit() does)\n            os._exit(0)\n        # Make this the session leader\n        os.setsid()\n        # Fork again for good measure!\n        pid = os.fork()\n        if pid:\n            os._exit(0)\n\n        # @@: Should we set the umask and cwd now?\n\n        import resource  # Resource usage information.\n        maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]\n        if (maxfd == resource.RLIM_INFINITY):\n            maxfd = MAXFD\n        # Iterate through and close all file descriptors.\n        for fd in range(0, maxfd):\n            try:\n                os.close(fd)\n            except OSError:  # ERROR, fd wasn't open to begin with (ignored)\n                pass\n\n        if (hasattr(os, \"devnull\")):\n            REDIRECT_TO = os.devnull\n        else:\n            REDIRECT_TO = \"/dev/null\"\n        os.open(REDIRECT_TO, os.O_RDWR)  # standard input (0)\n        # Duplicate standard input to standard output and standard error.\n        os.dup2(0, 1)  # standard output (1)\n        os.dup2(0, 2)  # standard error (2)\n\n    def _remove_pid_file(self, written_pid, filename, verbosity):\n        current_pid = os.getpid()\n        if written_pid != current_pid:\n            # A forked process must be exiting, not the process that\n            # wrote the PID file\n            return\n        if not os.path.exists(filename):\n            return\n        with open(filename) as f:\n            content = f.read().strip()\n        try:\n            pid_in_file = int(content)\n        except ValueError:\n            pass\n        else:\n            if pid_in_file != current_pid:\n                msg = \"PID file %s contains %s, not expected PID %s\"\n                self.out(msg % (filename, pid_in_file, current_pid))\n                return\n        if verbosity > 0:\n            self.out(\"Removing PID file %s\" % filename)\n        try:\n            os.unlink(filename)\n            return\n        except OSError as e:\n            # Record, but don't give traceback\n            self.out(\"Cannot remove PID file: (%s)\" % e)\n        # well, at least lets not leave the invalid PID around...\n        try:\n            with open(filename, 'w') as f:\n                f.write('')\n        except OSError as e:\n            self.out('Stale PID left in file: %s (%s)' % (filename, e))\n        else:\n            self.out('Stale PID removed')\n\n    def record_pid(self, pid_file):\n        pid = os.getpid()\n        if self.options.verbose > 1:\n            self.out('Writing PID %s to %s' % (pid, pid_file))\n        with open(pid_file, 'w') as f:\n            f.write(str(pid))\n        atexit.register(self._remove_pid_file, pid, pid_file, self.options.verbose)\n\n    def stop_daemon(self): # pragma: no cover\n        pid_file = self.options.pid_file or 'pyramid.pid'\n        if not os.path.exists(pid_file):\n            self.out('No PID file exists in %s' % pid_file)\n            return 1\n        pid = read_pidfile(pid_file)\n        if not pid:\n            self.out(\"Not a valid PID file in %s\" % pid_file)\n            return 1\n        pid = live_pidfile(pid_file)\n        if not pid:\n            self.out(\"PID in %s is not valid (deleting)\" % pid_file)\n            try:\n                os.unlink(pid_file)\n            except (OSError, IOError) as e:\n                self.out(\"Could not delete: %s\" % e)\n                return 2\n            return 1\n        for j in range(10):\n            if not live_pidfile(pid_file):\n                break\n            import signal\n            kill(pid, signal.SIGTERM)\n            time.sleep(1)\n        else:\n            self.out(\"failed to kill web process %s\" % pid)\n            return 3\n        if os.path.exists(pid_file):\n            os.unlink(pid_file)\n        return 0\n\n    def show_status(self): # pragma: no cover\n        pid_file = self.options.pid_file or 'pyramid.pid'\n        if not os.path.exists(pid_file):\n            self.out('No PID file %s' % pid_file)\n            return 1\n        pid = read_pidfile(pid_file)\n        if not pid:\n            self.out('No PID in file %s' % pid_file)\n            return 1\n        pid = live_pidfile(pid_file)\n        if not pid:\n            self.out('PID %s in %s is not running' % (pid, pid_file))\n            return 1\n        self.out('Server running in PID %s' % pid)\n        return 0\n\n    def restart_with_reloader(self): # pragma: no cover\n        self.restart_with_monitor(reloader=True)\n\n    def restart_with_monitor(self, reloader=False): # pragma: no cover\n        if self.options.verbose > 0:\n            if reloader:\n                self.out('Starting subprocess with file monitor')\n            else:\n                self.out('Starting subprocess with monitor parent')\n        while 1:\n            args = [self.quote_first_command_arg(sys.executable)] + sys.argv\n            new_environ = os.environ.copy()\n            if reloader:\n                new_environ[self._reloader_environ_key] = 'true'\n            else:\n                new_environ[self._monitor_environ_key] = 'true'\n            proc = None\n            try:\n                try:\n                    _turn_sigterm_into_systemexit()\n                    proc = subprocess.Popen(args, env=new_environ)\n                    exit_code = proc.wait()\n                    proc = None\n                except KeyboardInterrupt:\n                    self.out('^C caught in monitor process')\n                    if self.options.verbose > 1:\n                        raise\n                    return 1\n            finally:\n                if proc is not None:\n                    import signal\n                    try:\n                        kill(proc.pid, signal.SIGTERM)\n                    except (OSError, IOError):\n                        pass\n\n            if reloader:\n                # Reloader always exits with code 3; but if we are\n                # a monitor, any exit code will restart\n                if exit_code != 3:\n                    return exit_code\n            if self.options.verbose > 0:\n                self.out('%s %s %s' % ('-' * 20, 'Restarting', '-' * 20))\n\n    def change_user_group(self, user, group): # pragma: no cover\n        if not user and not group:\n            return\n        import pwd, grp\n        uid = gid = None\n        if group:\n            try:\n                gid = int(group)\n                group = grp.getgrgid(gid).gr_name\n            except ValueError:\n                import grp\n                try:\n                    entry = grp.getgrnam(group)\n                except KeyError:\n                    raise ValueError(\n                        \"Bad group: %r; no such group exists\" % group)\n                gid = entry.gr_gid\n        try:\n            uid = int(user)\n            user = pwd.getpwuid(uid).pw_name\n        except ValueError:\n            try:\n                entry = pwd.getpwnam(user)\n            except KeyError:\n                raise ValueError(\n                    \"Bad username: %r; no such user exists\" % user)\n            if not gid:\n                gid = entry.pw_gid\n            uid = entry.pw_uid\n        if self.options.verbose > 0:\n            self.out('Changing user to %s:%s (%s:%s)' % (\n                user, group or '(unknown)', uid, gid))\n        if gid:\n            os.setgid(gid)\n        if uid:\n            os.setuid(uid)\n\nclass LazyWriter(object):\n\n    \"\"\"\n    File-like object that opens a file lazily when it is first written\n    to.\n    \"\"\"\n\n    def __init__(self, filename, mode='w'):\n        self.filename = filename\n        self.fileobj = None\n        self.lock = threading.Lock()\n        self.mode = mode\n\n    def open(self):\n        if self.fileobj is None:\n            with self.lock:\n                self.fileobj = open(self.filename, self.mode)\n        return self.fileobj\n\n    def close(self):\n        fileobj = self.fileobj\n        if fileobj is not None:\n            fileobj.close()\n\n    def __del__(self):\n        self.close()\n\n    def write(self, text):\n        fileobj = self.open()\n        fileobj.write(text)\n        fileobj.flush()\n\n    def writelines(self, text):\n        fileobj = self.open()\n        fileobj.writelines(text)\n        fileobj.flush()\n\n    def flush(self):\n        self.open().flush()\n\ndef live_pidfile(pidfile): # pragma: no cover\n    \"\"\"(pidfile:str) -> int | None\n    Returns an int found in the named file, if there is one,\n    and if there is a running process with that process id.\n    Return None if no such process exists.\n    \"\"\"\n    pid = read_pidfile(pidfile)\n    if pid:\n        try:\n            kill(int(pid), 0)\n            return pid\n        except OSError as e:\n            if e.errno == errno.EPERM:\n                return pid\n    return None\n\ndef read_pidfile(filename):\n    if os.path.exists(filename):\n        try:\n            with open(filename) as f:\n                content = f.read()\n            return int(content.strip())\n        except (ValueError, IOError):\n            return None\n    else:\n        return None\n\ndef ensure_port_cleanup(\n    bound_addresses, maxtries=30, sleeptime=2): # pragma: no cover\n    \"\"\"\n    This makes sure any open ports are closed.\n\n    Does this by connecting to them until they give connection\n    refused.  Servers should call like::\n\n        ensure_port_cleanup([80, 443])\n    \"\"\"\n    atexit.register(_cleanup_ports, bound_addresses, maxtries=maxtries,\n                    sleeptime=sleeptime)\n\ndef _cleanup_ports(\n    bound_addresses, maxtries=30, sleeptime=2): # pragma: no cover\n    # Wait for the server to bind to the port.\n    import socket\n    import errno\n    for bound_address in bound_addresses:\n        for attempt in range(maxtries):\n            sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n            try:\n                sock.connect(bound_address)\n            except socket.error as e:\n                if e.args[0] != errno.ECONNREFUSED:\n                    raise\n                break\n            else:\n                time.sleep(sleeptime)\n        else:\n            raise SystemExit('Timeout waiting for port.')\n        sock.close()\n\ndef _turn_sigterm_into_systemexit(): # pragma: no cover\n    \"\"\"\n    Attempts to turn a SIGTERM exception into a SystemExit exception.\n    \"\"\"\n    try:\n        import signal\n    except ImportError:\n        return\n    def handle_term(signo, frame):\n        raise SystemExit\n    signal.signal(signal.SIGTERM, handle_term)\n\ndef install_reloader(poll_interval=1, extra_files=None): # pragma: no cover\n    \"\"\"\n    Install the reloading monitor.\n\n    On some platforms server threads may not terminate when the main\n    thread does, causing ports to remain open/locked.  The\n    ``raise_keyboard_interrupt`` option creates a unignorable signal\n    which causes the whole application to shut-down (rudely).\n    \"\"\"\n    mon = Monitor(poll_interval=poll_interval)\n    if extra_files is None:\n        extra_files = []\n    mon.extra_files.extend(extra_files)\n    t = threading.Thread(target=mon.periodic_reload)\n    t.setDaemon(True)\n    t.start()\n\nclass classinstancemethod(object):\n    \"\"\"\n    Acts like a class method when called from a class, like an\n    instance method when called by an instance.  The method should\n    take two arguments, 'self' and 'cls'; one of these will be None\n    depending on how the method was called.\n    \"\"\"\n\n    def __init__(self, func):\n        self.func = func\n        self.__doc__ = func.__doc__\n\n    def __get__(self, obj, type=None):\n        return _methodwrapper(self.func, obj=obj, type=type)\n\nclass _methodwrapper(object):\n\n    def __init__(self, func, obj, type):\n        self.func = func\n        self.obj = obj\n        self.type = type\n\n    def __call__(self, *args, **kw):\n        assert not 'self' in kw and not 'cls' in kw, (\n            \"You cannot use 'self' or 'cls' arguments to a \"\n            \"classinstancemethod\")\n        return self.func(*((self.obj, self.type) + args), **kw)\n\nclass Monitor(object): # pragma: no cover\n    \"\"\"\n    A file monitor and server restarter.\n\n    Use this like:\n\n    ..code-block:: Python\n\n        install_reloader()\n\n    Then make sure your server is installed with a shell script like::\n\n        err=3\n        while test \"$err\" -eq 3 ; do\n            python server.py\n            err=\"$?\"\n        done\n\n    or is run from this .bat file (if you use Windows)::\n\n        @echo off\n        :repeat\n            python server.py\n        if %errorlevel% == 3 goto repeat\n\n    or run a monitoring process in Python (``pserve --reload`` does\n    this).  \n\n    Use the ``watch_file(filename)`` function to cause a reload/restart for\n    other non-Python files (e.g., configuration files).  If you have\n    a dynamic set of files that grows over time you can use something like::\n\n        def watch_config_files():\n            return CONFIG_FILE_CACHE.keys()\n        add_file_callback(watch_config_files)\n\n    Then every time the reloader polls files it will call\n    ``watch_config_files`` and check all the filenames it returns.\n    \"\"\"\n    instances = []\n    global_extra_files = []\n    global_file_callbacks = []\n\n    def __init__(self, poll_interval):\n        self.module_mtimes = {}\n        self.keep_running = True\n        self.poll_interval = poll_interval\n        self.extra_files = list(self.global_extra_files)\n        self.instances.append(self)\n        self.file_callbacks = list(self.global_file_callbacks)\n\n    def _exit(self):\n        # use os._exit() here and not sys.exit() since within a\n        # thread sys.exit() just closes the given thread and\n        # won't kill the process; note os._exit does not call\n        # any atexit callbacks, nor does it do finally blocks,\n        # flush open files, etc.  In otherwords, it is rude.\n        os._exit(3)\n\n    def periodic_reload(self):\n        while True:\n            if not self.check_reload():\n                self._exit()\n                break\n            time.sleep(self.poll_interval)\n\n    def check_reload(self):\n        filenames = list(self.extra_files)\n        for file_callback in self.file_callbacks:\n            try:\n                filenames.extend(file_callback())\n            except:\n                print(\n                    \"Error calling reloader callback %r:\" % file_callback)\n                traceback.print_exc()\n        for module in sys.modules.values():\n            try:\n                filename = module.__file__\n            except (AttributeError, ImportError):\n                continue\n            if filename is not None:\n                filenames.append(filename)\n        for filename in filenames:\n            try:\n                stat = os.stat(filename)\n                if stat:\n                    mtime = stat.st_mtime\n                else:\n                    mtime = 0\n            except (OSError, IOError):\n                continue\n            if filename.endswith('.pyc') and os.path.exists(filename[:-1]):\n                mtime = max(os.stat(filename[:-1]).st_mtime, mtime)\n            if not filename in self.module_mtimes:\n                self.module_mtimes[filename] = mtime\n            elif self.module_mtimes[filename] < mtime:\n                print(\"%s changed; reloading...\" % filename)\n                return False\n        return True\n\n    def watch_file(self, cls, filename):\n        \"\"\"Watch the named file for changes\"\"\"\n        filename = os.path.abspath(filename)\n        if self is None:\n            for instance in cls.instances:\n                instance.watch_file(filename)\n            cls.global_extra_files.append(filename)\n        else:\n            self.extra_files.append(filename)\n\n    watch_file = classinstancemethod(watch_file)\n\n    def add_file_callback(self, cls, callback):\n        \"\"\"Add a callback -- a function that takes no parameters -- that will\n        return a list of filenames to watch for changes.\"\"\"\n        if self is None:\n            for instance in cls.instances:\n                instance.add_file_callback(callback)\n            cls.global_file_callbacks.append(callback)\n        else:\n            self.file_callbacks.append(callback)\n\n    add_file_callback = classinstancemethod(add_file_callback)\n\nwatch_file = Monitor.watch_file\nadd_file_callback = Monitor.add_file_callback\n\n# For paste.deploy server instantiation (egg:pyramid#wsgiref)\ndef wsgiref_server_runner(wsgi_app, global_conf, **kw): # pragma: no cover\n    from wsgiref.simple_server import make_server\n    host = kw.get('host', '0.0.0.0')\n    port = int(kw.get('port', 8080))\n    server = make_server(host, port, wsgi_app)\n    print('Starting HTTP server on http://%s:%s' % (host, port))\n    server.serve_forever()\n\n# For paste.deploy server instantiation (egg:pyramid#cherrypy)\ndef cherrypy_server_runner(\n        app, global_conf=None, host='127.0.0.1', port=None,\n        ssl_pem=None, protocol_version=None, numthreads=None,\n        server_name=None, max=None, request_queue_size=None,\n        timeout=None\n        ): # pragma: no cover\n    \"\"\"\n    Entry point for CherryPy's WSGI server\n\n    Serves the specified WSGI app via CherryPyWSGIServer.\n\n    ``app``\n\n        The WSGI 'application callable'; multiple WSGI applications\n        may be passed as (script_name, callable) pairs.\n\n    ``host``\n\n        This is the ipaddress to bind to (or a hostname if your\n        nameserver is properly configured).  This defaults to\n        127.0.0.1, which is not a public interface.\n\n    ``port``\n\n        The port to run on, defaults to 8080 for HTTP, or 4443 for\n        HTTPS. This can be a string or an integer value.\n\n    ``ssl_pem``\n\n        This an optional SSL certificate file (via OpenSSL) You can\n        generate a self-signed test PEM certificate file as follows:\n\n            $ openssl genrsa 1024 > host.key\n            $ chmod 400 host.key\n            $ openssl req -new -x509 -nodes -sha1 -days 365  \\\\\n                          -key host.key > host.cert\n            $ cat host.cert host.key > host.pem\n            $ chmod 400 host.pem\n\n    ``protocol_version``\n\n        The protocol used by the server, by default ``HTTP/1.1``.\n\n    ``numthreads``\n\n        The number of worker threads to create.\n\n    ``server_name``\n\n        The string to set for WSGI's SERVER_NAME environ entry.\n\n    ``max``\n\n        The maximum number of queued requests. (defaults to -1 = no\n        limit).\n\n    ``request_queue_size``\n\n        The 'backlog' argument to socket.listen(); specifies the\n        maximum number of queued connections.\n\n    ``timeout``\n\n        The timeout in seconds for accepted connections.\n    \"\"\"\n    is_ssl = False\n    if ssl_pem:\n        port = port or 4443\n        is_ssl = True\n\n    if not port:\n        if ':' in host:\n            host, port = host.split(':', 1)\n        else:\n            port = 8080\n    bind_addr = (host, int(port))\n\n    kwargs = {}\n    for var_name in ('numthreads', 'max', 'request_queue_size', 'timeout'):\n        var = locals()[var_name]\n        if var is not None:\n            kwargs[var_name] = int(var)\n\n    from cherrypy import wsgiserver\n\n    server = wsgiserver.CherryPyWSGIServer(bind_addr, app,\n                                           server_name=server_name, **kwargs)\n    server.ssl_certificate = server.ssl_private_key = ssl_pem\n    if protocol_version:\n        server.protocol = protocol_version\n\n    try:\n        protocol = is_ssl and 'https' or 'http'\n        if host == '0.0.0.0':\n            print('serving on 0.0.0.0:%s view at %s://127.0.0.1:%s' %\n                  (port, protocol, port))\n        else:\n            print('serving on %s://%s:%s' % (protocol, host, port))\n        server.start()\n    except (KeyboardInterrupt, SystemExit):\n        server.stop()\n\n    return server\n",
            "header": {
                "file": {
                    "path": "pyramid/scripts/pserve.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "89bfc765f",
                "new_commit_hash": "cc368d721",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/pyramid/scripts/pserve.py"
            },
            "plus_file": {
                "path": "b/pyramid/scripts/pserve.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 45,
                            "length": 8
                        },
                        "new_range": {
                            "start": 45,
                            "length": 8
                        },
                        "section": "if WIN and not hasattr(os, 'kill'): # pragma: no cover"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "else:",
                                "type": "context"
                            },
                            {
                                "content": "    kill = os.kill",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "def main(argv=sys.argv):",
                                "type": "deleted"
                            },
                            {
                                "content": "    command = PServeCommand(argv)",
                                "type": "deleted"
                            },
                            {
                                "content": "def main(argv=sys.argv, quiet=False):",
                                "type": "added"
                            },
                            {
                                "content": "    command = PServeCommand(argv, quiet=quiet)",
                                "type": "added"
                            },
                            {
                                "content": "    return command.run()",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "class DaemonizeException(Exception):",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "pyramid/scripts/pserve.py",
                            "type": "function",
                            "name": "main",
                            "content": "def main(argv=sys.argv):\n    command = PServeCommand(argv)\n    return command.run()",
                            "ast_type_str": "FunctionDef",
                            "start_lineno": 48,
                            "end_lineno": 50,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 165,
                            "length": 11
                        },
                        "new_range": {
                            "start": 165,
                            "length": 14
                        },
                        "section": "class PServeCommand(object):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    possible_subcommands = ('start', 'stop', 'restart', 'status')",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def __init__(self, argv):",
                                "type": "deleted"
                            },
                            {
                                "content": "    def __init__(self, argv, quiet=False):",
                                "type": "added"
                            },
                            {
                                "content": "        self.options, self.args = self.parser.parse_args(argv[1:])",
                                "type": "context"
                            },
                            {
                                "content": "        if quiet:",
                                "type": "added"
                            },
                            {
                                "content": "            self.options.verbose = 0",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def out(self, msg): # pragma: no cover",
                                "type": "context"
                            },
                            {
                                "content": "        print(msg)",
                                "type": "deleted"
                            },
                            {
                                "content": "        if self.options.verbose > 0:",
                                "type": "added"
                            },
                            {
                                "content": "            print(msg)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def get_options(self):",
                                "type": "context"
                            },
                            {
                                "content": "        if (len(self.args) > 1",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "pyramid/scripts/pserve.py",
                            "type": "method",
                            "name": "PServeCommand.__init__",
                            "content": "class PServeCommand(object):\n\n    usage = '%prog config_uri [start|stop|restart|status] [var=value]'\n    description = \"\"\"\\\n    This command serves a web application that uses a PasteDeploy\n    configuration file for the server and application.\n\n    If start/stop/restart is given, then --daemon is implied, and it will\n    start (normal operation), stop (--stop-daemon), or do both.\n\n    You can also include variable assignments like 'http_port=8080'\n    and then use %(http_port)s in your config files.\n    \"\"\"\n    default_verbosity = 1\n\n    parser = optparse.OptionParser(\n        usage,\n        description=textwrap.dedent(description)\n        )\n    parser.add_option(\n        '-n', '--app-name',\n        dest='app_name',\n        metavar='NAME',\n        help=\"Load the named application (default main)\")\n    parser.add_option(\n        '-s', '--server',\n        dest='server',\n        metavar='SERVER_TYPE',\n        help=\"Use the named server.\")\n    parser.add_option(\n        '--server-name',\n        dest='server_name',\n        metavar='SECTION_NAME',\n        help=(\"Use the named server as defined in the configuration file \"\n              \"(default: main)\"))\n    if hasattr(os, 'fork'):\n        parser.add_option(\n            '--daemon',\n            dest=\"daemon\",\n            action=\"store_true\",\n            help=\"Run in daemon (background) mode\")\n    parser.add_option(\n        '--pid-file',\n        dest='pid_file',\n        metavar='FILENAME',\n        help=(\"Save PID to file (default to pyramid.pid if running in \"\n              \"daemon mode)\"))\n    parser.add_option(\n        '--log-file',\n        dest='log_file',\n        metavar='LOG_FILE',\n        help=\"Save output to the given log file (redirects stdout)\")\n    parser.add_option(\n        '--reload',\n        dest='reload',\n        action='store_true',\n        help=\"Use auto-restart file monitor\")\n    parser.add_option(\n        '--reload-interval',\n        dest='reload_interval',\n        default=1,\n        help=(\"Seconds between checking files (low number can cause \"\n              \"significant CPU usage)\"))\n    parser.add_option(\n        '--monitor-restart',\n        dest='monitor_restart',\n        action='store_true',\n        help=\"Auto-restart server if it dies\")\n    parser.add_option(\n        '--status',\n        action='store_true',\n        dest='show_status',\n        help=\"Show the status of the (presumably daemonized) server\")\n    parser.add_option(\n        '-v', '--verbose',\n        default=default_verbosity,\n        dest='verbose',\n        action='count',\n        help=\"Set verbose level (default \"+str(default_verbosity)+\")\")\n    parser.add_option(\n        '-q', '--quiet',\n        action='store_const',\n        const=0,\n        dest='verbose',\n        help=\"Suppress verbose output\")\n\n    if hasattr(os, 'setuid'):\n        # I don't think these are available on Windows\n        parser.add_option(\n            '--user',\n            dest='set_user',\n            metavar=\"USERNAME\",\n            help=\"Set the user (usually only possible when run as root)\")\n        parser.add_option(\n            '--group',\n            dest='set_group',\n            metavar=\"GROUP\",\n            help=\"Set the group (usually only possible when run as root)\")\n\n    parser.add_option(\n        '--stop-daemon',\n        dest='stop_daemon',\n        action='store_true',\n        help=('Stop a daemonized server (given a PID file, or default '\n              'pyramid.pid file)'))\n\n    _scheme_re = re.compile(r'^[a-z][a-z]+:', re.I)\n\n    _reloader_environ_key = 'PYTHON_RELOADER_SHOULD_RUN'\n    _monitor_environ_key = 'PASTE_MONITOR_SHOULD_RUN'\n\n    possible_subcommands = ('start', 'stop', 'restart', 'status')\n\n    def __init__(self, argv):\n        self.options, self.args = self.parser.parse_args(argv[1:])\n\n    def out(self, msg): # pragma: no cover\n        print(msg)\n\n    def get_options(self):\n        if (len(self.args) > 1\n            and self.args[1] in self.possible_subcommands):\n            restvars = self.args[2:]\n        else:\n            restvars = self.args[1:]\n\n        return parse_vars(restvars)\n\n    def run(self): # pragma: no cover\n        if self.options.stop_daemon:\n            return self.stop_daemon()\n\n        if not hasattr(self.options, 'set_user'):\n            # Windows case:\n            self.options.set_user = self.options.set_group = None\n\n        # @@: Is this the right stage to set the user at?\n        self.change_user_group(\n            self.options.set_user, self.options.set_group)\n\n        if not self.args:\n            self.out('You must give a config file')\n            return 2\n        app_spec = self.args[0]\n\n        if (len(self.args) > 1\n            and self.args[1] in self.possible_subcommands):\n            cmd = self.args[1]\n        else:\n            cmd = None\n\n        if self.options.reload:\n            if os.environ.get(self._reloader_environ_key):\n                if self.options.verbose > 1:\n                    self.out('Running reloading file monitor')\n                install_reloader(int(self.options.reload_interval), [app_spec])\n                # if self.requires_config_file:\n                #     watch_file(self.args[0])\n            else:\n                return self.restart_with_reloader()\n\n        if cmd not in (None, 'start', 'stop', 'restart', 'status'):\n            self.out(\n                'Error: must give start|stop|restart (not %s)' % cmd)\n            return 2\n\n        if cmd == 'status' or self.options.show_status:\n            return self.show_status()\n\n        if cmd == 'restart' or cmd == 'stop':\n            result = self.stop_daemon()\n            if result:\n                if cmd == 'restart':\n                    self.out(\"Could not stop daemon; aborting\")\n                else:\n                    self.out(\"Could not stop daemon\")\n                return result\n            if cmd == 'stop':\n                return result\n            self.options.daemon = True\n\n        if cmd == 'start':\n            self.options.daemon = True\n\n        app_name = self.options.app_name\n\n        vars = self.get_options()\n\n        if not self._scheme_re.search(app_spec):\n            app_spec = 'config:' + app_spec\n        server_name = self.options.server_name\n        if self.options.server:\n            server_spec = 'egg:pyramid'\n            assert server_name is None\n            server_name = self.options.server\n        else:\n            server_spec = app_spec\n        base = os.getcwd()\n\n        if getattr(self.options, 'daemon', False):\n            if not self.options.pid_file:\n                self.options.pid_file = 'pyramid.pid'\n            if not self.options.log_file:\n                self.options.log_file = 'pyramid.log'\n\n        # Ensure the log file is writeable\n        if self.options.log_file:\n            try:\n                writeable_log_file = open(self.options.log_file, 'a')\n            except IOError as ioe:\n                msg = 'Error: Unable to write to log file: %s' % ioe\n                raise ValueError(msg)\n            writeable_log_file.close()\n\n        # Ensure the pid file is writeable\n        if self.options.pid_file:\n            try:\n                writeable_pid_file = open(self.options.pid_file, 'a')\n            except IOError as ioe:\n                msg = 'Error: Unable to write to pid file: %s' % ioe\n                raise ValueError(msg)\n            writeable_pid_file.close()\n\n        if getattr(self.options, 'daemon', False):\n            try:\n                self.daemonize()\n            except DaemonizeException as ex:\n                if self.options.verbose > 0:\n                    self.out(str(ex))\n                return 2\n\n        if (self.options.monitor_restart\n            and not os.environ.get(self._monitor_environ_key)):\n            return self.restart_with_monitor()\n\n        if self.options.pid_file:\n            self.record_pid(self.options.pid_file)\n\n        if self.options.log_file:\n            stdout_log = LazyWriter(self.options.log_file, 'a')\n            sys.stdout = stdout_log\n            sys.stderr = stdout_log\n            logging.basicConfig(stream=stdout_log)\n\n        log_fn = app_spec\n        if log_fn.startswith('config:'):\n            log_fn = app_spec[len('config:'):]\n        elif log_fn.startswith('egg:'):\n            log_fn = None\n        if log_fn:\n            log_fn = os.path.join(base, log_fn)\n            setup_logging(log_fn)\n\n        server = self.loadserver(server_spec, name=server_name,\n                                 relative_to=base, global_conf=vars)\n\n        app = self.loadapp(app_spec, name=app_name, relative_to=base,\n                global_conf=vars)\n\n        if self.options.verbose > 0:\n            if hasattr(os, 'getpid'):\n                msg = 'Starting server in PID %i.' % os.getpid()\n            else:\n                msg = 'Starting server.'\n            self.out(msg)\n\n        def serve():\n            try:\n                server(app)\n            except (SystemExit, KeyboardInterrupt) as e:\n                if self.options.verbose > 1:\n                    raise\n                if str(e):\n                    msg = ' ' + str(e)\n                else:\n                    msg = ''\n                self.out('Exiting%s (-v to see traceback)' % msg)\n\n        serve()\n\n    def loadapp(self, app_spec, name, relative_to, **kw): # pragma: no cover\n        return loadapp(app_spec, name=name, relative_to=relative_to, **kw)\n\n    def loadserver(self, server_spec, name, relative_to, **kw):# pragma:no cover\n        return loadserver(\n            server_spec, name=name, relative_to=relative_to, **kw)\n\n    def quote_first_command_arg(self, arg): # pragma: no cover\n        \"\"\"\n        There's a bug in Windows when running an executable that's\n        located inside a path with a space in it.  This method handles\n        that case, or on non-Windows systems or an executable with no\n        spaces, it just leaves well enough alone.\n        \"\"\"\n        if (sys.platform != 'win32' or ' ' not in arg):\n            # Problem does not apply:\n            return arg\n        try:\n            import win32api\n        except ImportError:\n            raise ValueError(\n                \"The executable %r contains a space, and in order to \"\n                \"handle this issue you must have the win32api module \"\n                \"installed\" % arg)\n        arg = win32api.GetShortPathName(arg)\n        return arg\n\n    def daemonize(self): # pragma: no cover\n        pid = live_pidfile(self.options.pid_file)\n        if pid:\n            raise DaemonizeException(\n                \"Daemon is already running (PID: %s from PID file %s)\"\n                % (pid, self.options.pid_file))\n\n        if self.options.verbose > 0:\n            self.out('Entering daemon mode')\n        pid = os.fork()\n        if pid:\n            # The forked process also has a handle on resources, so we\n            # *don't* want proper termination of the process, we just\n            # want to exit quick (which os._exit() does)\n            os._exit(0)\n        # Make this the session leader\n        os.setsid()\n        # Fork again for good measure!\n        pid = os.fork()\n        if pid:\n            os._exit(0)\n\n        # @@: Should we set the umask and cwd now?\n\n        import resource  # Resource usage information.\n        maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]\n        if (maxfd == resource.RLIM_INFINITY):\n            maxfd = MAXFD\n        # Iterate through and close all file descriptors.\n        for fd in range(0, maxfd):\n            try:\n                os.close(fd)\n            except OSError:  # ERROR, fd wasn't open to begin with (ignored)\n                pass\n\n        if (hasattr(os, \"devnull\")):\n            REDIRECT_TO = os.devnull\n        else:\n            REDIRECT_TO = \"/dev/null\"\n        os.open(REDIRECT_TO, os.O_RDWR)  # standard input (0)\n        # Duplicate standard input to standard output and standard error.\n        os.dup2(0, 1)  # standard output (1)\n        os.dup2(0, 2)  # standard error (2)\n\n    def _remove_pid_file(self, written_pid, filename, verbosity):\n        current_pid = os.getpid()\n        if written_pid != current_pid:\n            # A forked process must be exiting, not the process that\n            # wrote the PID file\n            return\n        if not os.path.exists(filename):\n            return\n        with open(filename) as f:\n            content = f.read().strip()\n        try:\n            pid_in_file = int(content)\n        except ValueError:\n            pass\n        else:\n            if pid_in_file != current_pid:\n                msg = \"PID file %s contains %s, not expected PID %s\"\n                self.out(msg % (filename, pid_in_file, current_pid))\n                return\n        if verbosity > 0:\n            self.out(\"Removing PID file %s\" % filename)\n        try:\n            os.unlink(filename)\n            return\n        except OSError as e:\n            # Record, but don't give traceback\n            self.out(\"Cannot remove PID file: (%s)\" % e)\n        # well, at least lets not leave the invalid PID around...\n        try:\n            with open(filename, 'w') as f:\n                f.write('')\n        except OSError as e:\n            self.out('Stale PID left in file: %s (%s)' % (filename, e))\n        else:\n            self.out('Stale PID removed')\n\n    def record_pid(self, pid_file):\n        pid = os.getpid()\n        if self.options.verbose > 1:\n            self.out('Writing PID %s to %s' % (pid, pid_file))\n        with open(pid_file, 'w') as f:\n            f.write(str(pid))\n        atexit.register(self._remove_pid_file, pid, pid_file, self.options.verbose)\n\n    def stop_daemon(self): # pragma: no cover\n        pid_file = self.options.pid_file or 'pyramid.pid'\n        if not os.path.exists(pid_file):\n            self.out('No PID file exists in %s' % pid_file)\n            return 1\n        pid = read_pidfile(pid_file)\n        if not pid:\n            self.out(\"Not a valid PID file in %s\" % pid_file)\n            return 1\n        pid = live_pidfile(pid_file)\n        if not pid:\n            self.out(\"PID in %s is not valid (deleting)\" % pid_file)\n            try:\n                os.unlink(pid_file)\n            except (OSError, IOError) as e:\n                self.out(\"Could not delete: %s\" % e)\n                return 2\n            return 1\n        for j in range(10):\n            if not live_pidfile(pid_file):\n                break\n            import signal\n            kill(pid, signal.SIGTERM)\n            time.sleep(1)\n        else:\n            self.out(\"failed to kill web process %s\" % pid)\n            return 3\n        if os.path.exists(pid_file):\n            os.unlink(pid_file)\n        return 0\n\n    def show_status(self): # pragma: no cover\n        pid_file = self.options.pid_file or 'pyramid.pid'\n        if not os.path.exists(pid_file):\n            self.out('No PID file %s' % pid_file)\n            return 1\n        pid = read_pidfile(pid_file)\n        if not pid:\n            self.out('No PID in file %s' % pid_file)\n            return 1\n        pid = live_pidfile(pid_file)\n        if not pid:\n            self.out('PID %s in %s is not running' % (pid, pid_file))\n            return 1\n        self.out('Server running in PID %s' % pid)\n        return 0\n\n    def restart_with_reloader(self): # pragma: no cover\n        self.restart_with_monitor(reloader=True)\n\n    def restart_with_monitor(self, reloader=False): # pragma: no cover\n        if self.options.verbose > 0:\n            if reloader:\n                self.out('Starting subprocess with file monitor')\n            else:\n                self.out('Starting subprocess with monitor parent')\n        while 1:\n            args = [self.quote_first_command_arg(sys.executable)] + sys.argv\n            new_environ = os.environ.copy()\n            if reloader:\n                new_environ[self._reloader_environ_key] = 'true'\n            else:\n                new_environ[self._monitor_environ_key] = 'true'\n            proc = None\n            try:\n                try:\n                    _turn_sigterm_into_systemexit()\n                    proc = subprocess.Popen(args, env=new_environ)\n                    exit_code = proc.wait()\n                    proc = None\n                except KeyboardInterrupt:\n                    self.out('^C caught in monitor process')\n                    if self.options.verbose > 1:\n                        raise\n                    return 1\n            finally:\n                if proc is not None:\n                    import signal\n                    try:\n                        kill(proc.pid, signal.SIGTERM)\n                    except (OSError, IOError):\n                        pass\n\n            if reloader:\n                # Reloader always exits with code 3; but if we are\n                # a monitor, any exit code will restart\n                if exit_code != 3:\n                    return exit_code\n            if self.options.verbose > 0:\n                self.out('%s %s %s' % ('-' * 20, 'Restarting', '-' * 20))\n\n    def change_user_group(self, user, group): # pragma: no cover\n        if not user and not group:\n            return\n        import pwd, grp\n        uid = gid = None\n        if group:\n            try:\n                gid = int(group)\n                group = grp.getgrgid(gid).gr_name\n            except ValueError:\n                import grp\n                try:\n                    entry = grp.getgrnam(group)\n                except KeyError:\n                    raise ValueError(\n                        \"Bad group: %r; no such group exists\" % group)\n                gid = entry.gr_gid\n        try:\n            uid = int(user)\n            user = pwd.getpwuid(uid).pw_name\n        except ValueError:\n            try:\n                entry = pwd.getpwnam(user)\n            except KeyError:\n                raise ValueError(\n                    \"Bad username: %r; no such user exists\" % user)\n            if not gid:\n                gid = entry.pw_gid\n            uid = entry.pw_uid\n        if self.options.verbose > 0:\n            self.out('Changing user to %s:%s (%s:%s)' % (\n                user, group or '(unknown)', uid, gid))\n        if gid:\n            os.setgid(gid)\n        if uid:\n            os.setuid(uid)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 168,
                            "end_lineno": 169,
                            "parent": {
                                "file_name": "pyramid/scripts/pserve.py",
                                "type": "class",
                                "name": "PServeCommand",
                                "content": "class PServeCommand(object):\n\n    usage = '%prog config_uri [start|stop|restart|status] [var=value]'\n    description = \"\"\"\\\n    This command serves a web application that uses a PasteDeploy\n    configuration file for the server and application.\n\n    If start/stop/restart is given, then --daemon is implied, and it will\n    start (normal operation), stop (--stop-daemon), or do both.\n\n    You can also include variable assignments like 'http_port=8080'\n    and then use %(http_port)s in your config files.\n    \"\"\"\n    default_verbosity = 1\n\n    parser = optparse.OptionParser(\n        usage,\n        description=textwrap.dedent(description)\n        )\n    parser.add_option(\n        '-n', '--app-name',\n        dest='app_name',\n        metavar='NAME',\n        help=\"Load the named application (default main)\")\n    parser.add_option(\n        '-s', '--server',\n        dest='server',\n        metavar='SERVER_TYPE',\n        help=\"Use the named server.\")\n    parser.add_option(\n        '--server-name',\n        dest='server_name',\n        metavar='SECTION_NAME',\n        help=(\"Use the named server as defined in the configuration file \"\n              \"(default: main)\"))\n    if hasattr(os, 'fork'):\n        parser.add_option(\n            '--daemon',\n            dest=\"daemon\",\n            action=\"store_true\",\n            help=\"Run in daemon (background) mode\")\n    parser.add_option(\n        '--pid-file',\n        dest='pid_file',\n        metavar='FILENAME',\n        help=(\"Save PID to file (default to pyramid.pid if running in \"\n              \"daemon mode)\"))\n    parser.add_option(\n        '--log-file',\n        dest='log_file',\n        metavar='LOG_FILE',\n        help=\"Save output to the given log file (redirects stdout)\")\n    parser.add_option(\n        '--reload',\n        dest='reload',\n        action='store_true',\n        help=\"Use auto-restart file monitor\")\n    parser.add_option(\n        '--reload-interval',\n        dest='reload_interval',\n        default=1,\n        help=(\"Seconds between checking files (low number can cause \"\n              \"significant CPU usage)\"))\n    parser.add_option(\n        '--monitor-restart',\n        dest='monitor_restart',\n        action='store_true',\n        help=\"Auto-restart server if it dies\")\n    parser.add_option(\n        '--status',\n        action='store_true',\n        dest='show_status',\n        help=\"Show the status of the (presumably daemonized) server\")\n    parser.add_option(\n        '-v', '--verbose',\n        default=default_verbosity,\n        dest='verbose',\n        action='count',\n        help=\"Set verbose level (default \"+str(default_verbosity)+\")\")\n    parser.add_option(\n        '-q', '--quiet',\n        action='store_const',\n        const=0,\n        dest='verbose',\n        help=\"Suppress verbose output\")\n\n    if hasattr(os, 'setuid'):\n        # I don't think these are available on Windows\n        parser.add_option(\n            '--user',\n            dest='set_user',\n            metavar=\"USERNAME\",\n            help=\"Set the user (usually only possible when run as root)\")\n        parser.add_option(\n            '--group',\n            dest='set_group',\n            metavar=\"GROUP\",\n            help=\"Set the group (usually only possible when run as root)\")\n\n    parser.add_option(\n        '--stop-daemon',\n        dest='stop_daemon',\n        action='store_true',\n        help=('Stop a daemonized server (given a PID file, or default '\n              'pyramid.pid file)'))\n\n    _scheme_re = re.compile(r'^[a-z][a-z]+:', re.I)\n\n    _reloader_environ_key = 'PYTHON_RELOADER_SHOULD_RUN'\n    _monitor_environ_key = 'PASTE_MONITOR_SHOULD_RUN'\n\n    possible_subcommands = ('start', 'stop', 'restart', 'status')\n\n    def __init__(self, argv):\n        self.options, self.args = self.parser.parse_args(argv[1:])\n\n    def out(self, msg): # pragma: no cover\n        print(msg)\n\n    def get_options(self):\n        if (len(self.args) > 1\n            and self.args[1] in self.possible_subcommands):\n            restvars = self.args[2:]\n        else:\n            restvars = self.args[1:]\n\n        return parse_vars(restvars)\n\n    def run(self): # pragma: no cover\n        if self.options.stop_daemon:\n            return self.stop_daemon()\n\n        if not hasattr(self.options, 'set_user'):\n            # Windows case:\n            self.options.set_user = self.options.set_group = None\n\n        # @@: Is this the right stage to set the user at?\n        self.change_user_group(\n            self.options.set_user, self.options.set_group)\n\n        if not self.args:\n            self.out('You must give a config file')\n            return 2\n        app_spec = self.args[0]\n\n        if (len(self.args) > 1\n            and self.args[1] in self.possible_subcommands):\n            cmd = self.args[1]\n        else:\n            cmd = None\n\n        if self.options.reload:\n            if os.environ.get(self._reloader_environ_key):\n                if self.options.verbose > 1:\n                    self.out('Running reloading file monitor')\n                install_reloader(int(self.options.reload_interval), [app_spec])\n                # if self.requires_config_file:\n                #     watch_file(self.args[0])\n            else:\n                return self.restart_with_reloader()\n\n        if cmd not in (None, 'start', 'stop', 'restart', 'status'):\n            self.out(\n                'Error: must give start|stop|restart (not %s)' % cmd)\n            return 2\n\n        if cmd == 'status' or self.options.show_status:\n            return self.show_status()\n\n        if cmd == 'restart' or cmd == 'stop':\n            result = self.stop_daemon()\n            if result:\n                if cmd == 'restart':\n                    self.out(\"Could not stop daemon; aborting\")\n                else:\n                    self.out(\"Could not stop daemon\")\n                return result\n            if cmd == 'stop':\n                return result\n            self.options.daemon = True\n\n        if cmd == 'start':\n            self.options.daemon = True\n\n        app_name = self.options.app_name\n\n        vars = self.get_options()\n\n        if not self._scheme_re.search(app_spec):\n            app_spec = 'config:' + app_spec\n        server_name = self.options.server_name\n        if self.options.server:\n            server_spec = 'egg:pyramid'\n            assert server_name is None\n            server_name = self.options.server\n        else:\n            server_spec = app_spec\n        base = os.getcwd()\n\n        if getattr(self.options, 'daemon', False):\n            if not self.options.pid_file:\n                self.options.pid_file = 'pyramid.pid'\n            if not self.options.log_file:\n                self.options.log_file = 'pyramid.log'\n\n        # Ensure the log file is writeable\n        if self.options.log_file:\n            try:\n                writeable_log_file = open(self.options.log_file, 'a')\n            except IOError as ioe:\n                msg = 'Error: Unable to write to log file: %s' % ioe\n                raise ValueError(msg)\n            writeable_log_file.close()\n\n        # Ensure the pid file is writeable\n        if self.options.pid_file:\n            try:\n                writeable_pid_file = open(self.options.pid_file, 'a')\n            except IOError as ioe:\n                msg = 'Error: Unable to write to pid file: %s' % ioe\n                raise ValueError(msg)\n            writeable_pid_file.close()\n\n        if getattr(self.options, 'daemon', False):\n            try:\n                self.daemonize()\n            except DaemonizeException as ex:\n                if self.options.verbose > 0:\n                    self.out(str(ex))\n                return 2\n\n        if (self.options.monitor_restart\n            and not os.environ.get(self._monitor_environ_key)):\n            return self.restart_with_monitor()\n\n        if self.options.pid_file:\n            self.record_pid(self.options.pid_file)\n\n        if self.options.log_file:\n            stdout_log = LazyWriter(self.options.log_file, 'a')\n            sys.stdout = stdout_log\n            sys.stderr = stdout_log\n            logging.basicConfig(stream=stdout_log)\n\n        log_fn = app_spec\n        if log_fn.startswith('config:'):\n            log_fn = app_spec[len('config:'):]\n        elif log_fn.startswith('egg:'):\n            log_fn = None\n        if log_fn:\n            log_fn = os.path.join(base, log_fn)\n            setup_logging(log_fn)\n\n        server = self.loadserver(server_spec, name=server_name,\n                                 relative_to=base, global_conf=vars)\n\n        app = self.loadapp(app_spec, name=app_name, relative_to=base,\n                global_conf=vars)\n\n        if self.options.verbose > 0:\n            if hasattr(os, 'getpid'):\n                msg = 'Starting server in PID %i.' % os.getpid()\n            else:\n                msg = 'Starting server.'\n            self.out(msg)\n\n        def serve():\n            try:\n                server(app)\n            except (SystemExit, KeyboardInterrupt) as e:\n                if self.options.verbose > 1:\n                    raise\n                if str(e):\n                    msg = ' ' + str(e)\n                else:\n                    msg = ''\n                self.out('Exiting%s (-v to see traceback)' % msg)\n\n        serve()\n\n    def loadapp(self, app_spec, name, relative_to, **kw): # pragma: no cover\n        return loadapp(app_spec, name=name, relative_to=relative_to, **kw)\n\n    def loadserver(self, server_spec, name, relative_to, **kw):# pragma:no cover\n        return loadserver(\n            server_spec, name=name, relative_to=relative_to, **kw)\n\n    def quote_first_command_arg(self, arg): # pragma: no cover\n        \"\"\"\n        There's a bug in Windows when running an executable that's\n        located inside a path with a space in it.  This method handles\n        that case, or on non-Windows systems or an executable with no\n        spaces, it just leaves well enough alone.\n        \"\"\"\n        if (sys.platform != 'win32' or ' ' not in arg):\n            # Problem does not apply:\n            return arg\n        try:\n            import win32api\n        except ImportError:\n            raise ValueError(\n                \"The executable %r contains a space, and in order to \"\n                \"handle this issue you must have the win32api module \"\n                \"installed\" % arg)\n        arg = win32api.GetShortPathName(arg)\n        return arg\n\n    def daemonize(self): # pragma: no cover\n        pid = live_pidfile(self.options.pid_file)\n        if pid:\n            raise DaemonizeException(\n                \"Daemon is already running (PID: %s from PID file %s)\"\n                % (pid, self.options.pid_file))\n\n        if self.options.verbose > 0:\n            self.out('Entering daemon mode')\n        pid = os.fork()\n        if pid:\n            # The forked process also has a handle on resources, so we\n            # *don't* want proper termination of the process, we just\n            # want to exit quick (which os._exit() does)\n            os._exit(0)\n        # Make this the session leader\n        os.setsid()\n        # Fork again for good measure!\n        pid = os.fork()\n        if pid:\n            os._exit(0)\n\n        # @@: Should we set the umask and cwd now?\n\n        import resource  # Resource usage information.\n        maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]\n        if (maxfd == resource.RLIM_INFINITY):\n            maxfd = MAXFD\n        # Iterate through and close all file descriptors.\n        for fd in range(0, maxfd):\n            try:\n                os.close(fd)\n            except OSError:  # ERROR, fd wasn't open to begin with (ignored)\n                pass\n\n        if (hasattr(os, \"devnull\")):\n            REDIRECT_TO = os.devnull\n        else:\n            REDIRECT_TO = \"/dev/null\"\n        os.open(REDIRECT_TO, os.O_RDWR)  # standard input (0)\n        # Duplicate standard input to standard output and standard error.\n        os.dup2(0, 1)  # standard output (1)\n        os.dup2(0, 2)  # standard error (2)\n\n    def _remove_pid_file(self, written_pid, filename, verbosity):\n        current_pid = os.getpid()\n        if written_pid != current_pid:\n            # A forked process must be exiting, not the process that\n            # wrote the PID file\n            return\n        if not os.path.exists(filename):\n            return\n        with open(filename) as f:\n            content = f.read().strip()\n        try:\n            pid_in_file = int(content)\n        except ValueError:\n            pass\n        else:\n            if pid_in_file != current_pid:\n                msg = \"PID file %s contains %s, not expected PID %s\"\n                self.out(msg % (filename, pid_in_file, current_pid))\n                return\n        if verbosity > 0:\n            self.out(\"Removing PID file %s\" % filename)\n        try:\n            os.unlink(filename)\n            return\n        except OSError as e:\n            # Record, but don't give traceback\n            self.out(\"Cannot remove PID file: (%s)\" % e)\n        # well, at least lets not leave the invalid PID around...\n        try:\n            with open(filename, 'w') as f:\n                f.write('')\n        except OSError as e:\n            self.out('Stale PID left in file: %s (%s)' % (filename, e))\n        else:\n            self.out('Stale PID removed')\n\n    def record_pid(self, pid_file):\n        pid = os.getpid()\n        if self.options.verbose > 1:\n            self.out('Writing PID %s to %s' % (pid, pid_file))\n        with open(pid_file, 'w') as f:\n            f.write(str(pid))\n        atexit.register(self._remove_pid_file, pid, pid_file, self.options.verbose)\n\n    def stop_daemon(self): # pragma: no cover\n        pid_file = self.options.pid_file or 'pyramid.pid'\n        if not os.path.exists(pid_file):\n            self.out('No PID file exists in %s' % pid_file)\n            return 1\n        pid = read_pidfile(pid_file)\n        if not pid:\n            self.out(\"Not a valid PID file in %s\" % pid_file)\n            return 1\n        pid = live_pidfile(pid_file)\n        if not pid:\n            self.out(\"PID in %s is not valid (deleting)\" % pid_file)\n            try:\n                os.unlink(pid_file)\n            except (OSError, IOError) as e:\n                self.out(\"Could not delete: %s\" % e)\n                return 2\n            return 1\n        for j in range(10):\n            if not live_pidfile(pid_file):\n                break\n            import signal\n            kill(pid, signal.SIGTERM)\n            time.sleep(1)\n        else:\n            self.out(\"failed to kill web process %s\" % pid)\n            return 3\n        if os.path.exists(pid_file):\n            os.unlink(pid_file)\n        return 0\n\n    def show_status(self): # pragma: no cover\n        pid_file = self.options.pid_file or 'pyramid.pid'\n        if not os.path.exists(pid_file):\n            self.out('No PID file %s' % pid_file)\n            return 1\n        pid = read_pidfile(pid_file)\n        if not pid:\n            self.out('No PID in file %s' % pid_file)\n            return 1\n        pid = live_pidfile(pid_file)\n        if not pid:\n            self.out('PID %s in %s is not running' % (pid, pid_file))\n            return 1\n        self.out('Server running in PID %s' % pid)\n        return 0\n\n    def restart_with_reloader(self): # pragma: no cover\n        self.restart_with_monitor(reloader=True)\n\n    def restart_with_monitor(self, reloader=False): # pragma: no cover\n        if self.options.verbose > 0:\n            if reloader:\n                self.out('Starting subprocess with file monitor')\n            else:\n                self.out('Starting subprocess with monitor parent')\n        while 1:\n            args = [self.quote_first_command_arg(sys.executable)] + sys.argv\n            new_environ = os.environ.copy()\n            if reloader:\n                new_environ[self._reloader_environ_key] = 'true'\n            else:\n                new_environ[self._monitor_environ_key] = 'true'\n            proc = None\n            try:\n                try:\n                    _turn_sigterm_into_systemexit()\n                    proc = subprocess.Popen(args, env=new_environ)\n                    exit_code = proc.wait()\n                    proc = None\n                except KeyboardInterrupt:\n                    self.out('^C caught in monitor process')\n                    if self.options.verbose > 1:\n                        raise\n                    return 1\n            finally:\n                if proc is not None:\n                    import signal\n                    try:\n                        kill(proc.pid, signal.SIGTERM)\n                    except (OSError, IOError):\n                        pass\n\n            if reloader:\n                # Reloader always exits with code 3; but if we are\n                # a monitor, any exit code will restart\n                if exit_code != 3:\n                    return exit_code\n            if self.options.verbose > 0:\n                self.out('%s %s %s' % ('-' * 20, 'Restarting', '-' * 20))\n\n    def change_user_group(self, user, group): # pragma: no cover\n        if not user and not group:\n            return\n        import pwd, grp\n        uid = gid = None\n        if group:\n            try:\n                gid = int(group)\n                group = grp.getgrgid(gid).gr_name\n            except ValueError:\n                import grp\n                try:\n                    entry = grp.getgrnam(group)\n                except KeyError:\n                    raise ValueError(\n                        \"Bad group: %r; no such group exists\" % group)\n                gid = entry.gr_gid\n        try:\n            uid = int(user)\n            user = pwd.getpwuid(uid).pw_name\n        except ValueError:\n            try:\n                entry = pwd.getpwnam(user)\n            except KeyError:\n                raise ValueError(\n                    \"Bad username: %r; no such user exists\" % user)\n            if not gid:\n                gid = entry.pw_gid\n            uid = entry.pw_uid\n        if self.options.verbose > 0:\n            self.out('Changing user to %s:%s (%s:%s)' % (\n                user, group or '(unknown)', uid, gid))\n        if gid:\n            os.setgid(gid)\n        if uid:\n            os.setuid(uid)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 55,
                                "end_lineno": 576,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "pyramid/scripts/pserve.py",
                            "type": "class",
                            "name": "PServeCommand",
                            "content": "class PServeCommand(object):\n\n    usage = '%prog config_uri [start|stop|restart|status] [var=value]'\n    description = \"\"\"\\\n    This command serves a web application that uses a PasteDeploy\n    configuration file for the server and application.\n\n    If start/stop/restart is given, then --daemon is implied, and it will\n    start (normal operation), stop (--stop-daemon), or do both.\n\n    You can also include variable assignments like 'http_port=8080'\n    and then use %(http_port)s in your config files.\n    \"\"\"\n    default_verbosity = 1\n\n    parser = optparse.OptionParser(\n        usage,\n        description=textwrap.dedent(description)\n        )\n    parser.add_option(\n        '-n', '--app-name',\n        dest='app_name',\n        metavar='NAME',\n        help=\"Load the named application (default main)\")\n    parser.add_option(\n        '-s', '--server',\n        dest='server',\n        metavar='SERVER_TYPE',\n        help=\"Use the named server.\")\n    parser.add_option(\n        '--server-name',\n        dest='server_name',\n        metavar='SECTION_NAME',\n        help=(\"Use the named server as defined in the configuration file \"\n              \"(default: main)\"))\n    if hasattr(os, 'fork'):\n        parser.add_option(\n            '--daemon',\n            dest=\"daemon\",\n            action=\"store_true\",\n            help=\"Run in daemon (background) mode\")\n    parser.add_option(\n        '--pid-file',\n        dest='pid_file',\n        metavar='FILENAME',\n        help=(\"Save PID to file (default to pyramid.pid if running in \"\n              \"daemon mode)\"))\n    parser.add_option(\n        '--log-file',\n        dest='log_file',\n        metavar='LOG_FILE',\n        help=\"Save output to the given log file (redirects stdout)\")\n    parser.add_option(\n        '--reload',\n        dest='reload',\n        action='store_true',\n        help=\"Use auto-restart file monitor\")\n    parser.add_option(\n        '--reload-interval',\n        dest='reload_interval',\n        default=1,\n        help=(\"Seconds between checking files (low number can cause \"\n              \"significant CPU usage)\"))\n    parser.add_option(\n        '--monitor-restart',\n        dest='monitor_restart',\n        action='store_true',\n        help=\"Auto-restart server if it dies\")\n    parser.add_option(\n        '--status',\n        action='store_true',\n        dest='show_status',\n        help=\"Show the status of the (presumably daemonized) server\")\n    parser.add_option(\n        '-v', '--verbose',\n        default=default_verbosity,\n        dest='verbose',\n        action='count',\n        help=\"Set verbose level (default \"+str(default_verbosity)+\")\")\n    parser.add_option(\n        '-q', '--quiet',\n        action='store_const',\n        const=0,\n        dest='verbose',\n        help=\"Suppress verbose output\")\n\n    if hasattr(os, 'setuid'):\n        # I don't think these are available on Windows\n        parser.add_option(\n            '--user',\n            dest='set_user',\n            metavar=\"USERNAME\",\n            help=\"Set the user (usually only possible when run as root)\")\n        parser.add_option(\n            '--group',\n            dest='set_group',\n            metavar=\"GROUP\",\n            help=\"Set the group (usually only possible when run as root)\")\n\n    parser.add_option(\n        '--stop-daemon',\n        dest='stop_daemon',\n        action='store_true',\n        help=('Stop a daemonized server (given a PID file, or default '\n              'pyramid.pid file)'))\n\n    _scheme_re = re.compile(r'^[a-z][a-z]+:', re.I)\n\n    _reloader_environ_key = 'PYTHON_RELOADER_SHOULD_RUN'\n    _monitor_environ_key = 'PASTE_MONITOR_SHOULD_RUN'\n\n    possible_subcommands = ('start', 'stop', 'restart', 'status')\n\n    def __init__(self, argv):\n        self.options, self.args = self.parser.parse_args(argv[1:])\n\n    def out(self, msg): # pragma: no cover\n        print(msg)\n\n    def get_options(self):\n        if (len(self.args) > 1\n            and self.args[1] in self.possible_subcommands):\n            restvars = self.args[2:]\n        else:\n            restvars = self.args[1:]\n\n        return parse_vars(restvars)\n\n    def run(self): # pragma: no cover\n        if self.options.stop_daemon:\n            return self.stop_daemon()\n\n        if not hasattr(self.options, 'set_user'):\n            # Windows case:\n            self.options.set_user = self.options.set_group = None\n\n        # @@: Is this the right stage to set the user at?\n        self.change_user_group(\n            self.options.set_user, self.options.set_group)\n\n        if not self.args:\n            self.out('You must give a config file')\n            return 2\n        app_spec = self.args[0]\n\n        if (len(self.args) > 1\n            and self.args[1] in self.possible_subcommands):\n            cmd = self.args[1]\n        else:\n            cmd = None\n\n        if self.options.reload:\n            if os.environ.get(self._reloader_environ_key):\n                if self.options.verbose > 1:\n                    self.out('Running reloading file monitor')\n                install_reloader(int(self.options.reload_interval), [app_spec])\n                # if self.requires_config_file:\n                #     watch_file(self.args[0])\n            else:\n                return self.restart_with_reloader()\n\n        if cmd not in (None, 'start', 'stop', 'restart', 'status'):\n            self.out(\n                'Error: must give start|stop|restart (not %s)' % cmd)\n            return 2\n\n        if cmd == 'status' or self.options.show_status:\n            return self.show_status()\n\n        if cmd == 'restart' or cmd == 'stop':\n            result = self.stop_daemon()\n            if result:\n                if cmd == 'restart':\n                    self.out(\"Could not stop daemon; aborting\")\n                else:\n                    self.out(\"Could not stop daemon\")\n                return result\n            if cmd == 'stop':\n                return result\n            self.options.daemon = True\n\n        if cmd == 'start':\n            self.options.daemon = True\n\n        app_name = self.options.app_name\n\n        vars = self.get_options()\n\n        if not self._scheme_re.search(app_spec):\n            app_spec = 'config:' + app_spec\n        server_name = self.options.server_name\n        if self.options.server:\n            server_spec = 'egg:pyramid'\n            assert server_name is None\n            server_name = self.options.server\n        else:\n            server_spec = app_spec\n        base = os.getcwd()\n\n        if getattr(self.options, 'daemon', False):\n            if not self.options.pid_file:\n                self.options.pid_file = 'pyramid.pid'\n            if not self.options.log_file:\n                self.options.log_file = 'pyramid.log'\n\n        # Ensure the log file is writeable\n        if self.options.log_file:\n            try:\n                writeable_log_file = open(self.options.log_file, 'a')\n            except IOError as ioe:\n                msg = 'Error: Unable to write to log file: %s' % ioe\n                raise ValueError(msg)\n            writeable_log_file.close()\n\n        # Ensure the pid file is writeable\n        if self.options.pid_file:\n            try:\n                writeable_pid_file = open(self.options.pid_file, 'a')\n            except IOError as ioe:\n                msg = 'Error: Unable to write to pid file: %s' % ioe\n                raise ValueError(msg)\n            writeable_pid_file.close()\n\n        if getattr(self.options, 'daemon', False):\n            try:\n                self.daemonize()\n            except DaemonizeException as ex:\n                if self.options.verbose > 0:\n                    self.out(str(ex))\n                return 2\n\n        if (self.options.monitor_restart\n            and not os.environ.get(self._monitor_environ_key)):\n            return self.restart_with_monitor()\n\n        if self.options.pid_file:\n            self.record_pid(self.options.pid_file)\n\n        if self.options.log_file:\n            stdout_log = LazyWriter(self.options.log_file, 'a')\n            sys.stdout = stdout_log\n            sys.stderr = stdout_log\n            logging.basicConfig(stream=stdout_log)\n\n        log_fn = app_spec\n        if log_fn.startswith('config:'):\n            log_fn = app_spec[len('config:'):]\n        elif log_fn.startswith('egg:'):\n            log_fn = None\n        if log_fn:\n            log_fn = os.path.join(base, log_fn)\n            setup_logging(log_fn)\n\n        server = self.loadserver(server_spec, name=server_name,\n                                 relative_to=base, global_conf=vars)\n\n        app = self.loadapp(app_spec, name=app_name, relative_to=base,\n                global_conf=vars)\n\n        if self.options.verbose > 0:\n            if hasattr(os, 'getpid'):\n                msg = 'Starting server in PID %i.' % os.getpid()\n            else:\n                msg = 'Starting server.'\n            self.out(msg)\n\n        def serve():\n            try:\n                server(app)\n            except (SystemExit, KeyboardInterrupt) as e:\n                if self.options.verbose > 1:\n                    raise\n                if str(e):\n                    msg = ' ' + str(e)\n                else:\n                    msg = ''\n                self.out('Exiting%s (-v to see traceback)' % msg)\n\n        serve()\n\n    def loadapp(self, app_spec, name, relative_to, **kw): # pragma: no cover\n        return loadapp(app_spec, name=name, relative_to=relative_to, **kw)\n\n    def loadserver(self, server_spec, name, relative_to, **kw):# pragma:no cover\n        return loadserver(\n            server_spec, name=name, relative_to=relative_to, **kw)\n\n    def quote_first_command_arg(self, arg): # pragma: no cover\n        \"\"\"\n        There's a bug in Windows when running an executable that's\n        located inside a path with a space in it.  This method handles\n        that case, or on non-Windows systems or an executable with no\n        spaces, it just leaves well enough alone.\n        \"\"\"\n        if (sys.platform != 'win32' or ' ' not in arg):\n            # Problem does not apply:\n            return arg\n        try:\n            import win32api\n        except ImportError:\n            raise ValueError(\n                \"The executable %r contains a space, and in order to \"\n                \"handle this issue you must have the win32api module \"\n                \"installed\" % arg)\n        arg = win32api.GetShortPathName(arg)\n        return arg\n\n    def daemonize(self): # pragma: no cover\n        pid = live_pidfile(self.options.pid_file)\n        if pid:\n            raise DaemonizeException(\n                \"Daemon is already running (PID: %s from PID file %s)\"\n                % (pid, self.options.pid_file))\n\n        if self.options.verbose > 0:\n            self.out('Entering daemon mode')\n        pid = os.fork()\n        if pid:\n            # The forked process also has a handle on resources, so we\n            # *don't* want proper termination of the process, we just\n            # want to exit quick (which os._exit() does)\n            os._exit(0)\n        # Make this the session leader\n        os.setsid()\n        # Fork again for good measure!\n        pid = os.fork()\n        if pid:\n            os._exit(0)\n\n        # @@: Should we set the umask and cwd now?\n\n        import resource  # Resource usage information.\n        maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]\n        if (maxfd == resource.RLIM_INFINITY):\n            maxfd = MAXFD\n        # Iterate through and close all file descriptors.\n        for fd in range(0, maxfd):\n            try:\n                os.close(fd)\n            except OSError:  # ERROR, fd wasn't open to begin with (ignored)\n                pass\n\n        if (hasattr(os, \"devnull\")):\n            REDIRECT_TO = os.devnull\n        else:\n            REDIRECT_TO = \"/dev/null\"\n        os.open(REDIRECT_TO, os.O_RDWR)  # standard input (0)\n        # Duplicate standard input to standard output and standard error.\n        os.dup2(0, 1)  # standard output (1)\n        os.dup2(0, 2)  # standard error (2)\n\n    def _remove_pid_file(self, written_pid, filename, verbosity):\n        current_pid = os.getpid()\n        if written_pid != current_pid:\n            # A forked process must be exiting, not the process that\n            # wrote the PID file\n            return\n        if not os.path.exists(filename):\n            return\n        with open(filename) as f:\n            content = f.read().strip()\n        try:\n            pid_in_file = int(content)\n        except ValueError:\n            pass\n        else:\n            if pid_in_file != current_pid:\n                msg = \"PID file %s contains %s, not expected PID %s\"\n                self.out(msg % (filename, pid_in_file, current_pid))\n                return\n        if verbosity > 0:\n            self.out(\"Removing PID file %s\" % filename)\n        try:\n            os.unlink(filename)\n            return\n        except OSError as e:\n            # Record, but don't give traceback\n            self.out(\"Cannot remove PID file: (%s)\" % e)\n        # well, at least lets not leave the invalid PID around...\n        try:\n            with open(filename, 'w') as f:\n                f.write('')\n        except OSError as e:\n            self.out('Stale PID left in file: %s (%s)' % (filename, e))\n        else:\n            self.out('Stale PID removed')\n\n    def record_pid(self, pid_file):\n        pid = os.getpid()\n        if self.options.verbose > 1:\n            self.out('Writing PID %s to %s' % (pid, pid_file))\n        with open(pid_file, 'w') as f:\n            f.write(str(pid))\n        atexit.register(self._remove_pid_file, pid, pid_file, self.options.verbose)\n\n    def stop_daemon(self): # pragma: no cover\n        pid_file = self.options.pid_file or 'pyramid.pid'\n        if not os.path.exists(pid_file):\n            self.out('No PID file exists in %s' % pid_file)\n            return 1\n        pid = read_pidfile(pid_file)\n        if not pid:\n            self.out(\"Not a valid PID file in %s\" % pid_file)\n            return 1\n        pid = live_pidfile(pid_file)\n        if not pid:\n            self.out(\"PID in %s is not valid (deleting)\" % pid_file)\n            try:\n                os.unlink(pid_file)\n            except (OSError, IOError) as e:\n                self.out(\"Could not delete: %s\" % e)\n                return 2\n            return 1\n        for j in range(10):\n            if not live_pidfile(pid_file):\n                break\n            import signal\n            kill(pid, signal.SIGTERM)\n            time.sleep(1)\n        else:\n            self.out(\"failed to kill web process %s\" % pid)\n            return 3\n        if os.path.exists(pid_file):\n            os.unlink(pid_file)\n        return 0\n\n    def show_status(self): # pragma: no cover\n        pid_file = self.options.pid_file or 'pyramid.pid'\n        if not os.path.exists(pid_file):\n            self.out('No PID file %s' % pid_file)\n            return 1\n        pid = read_pidfile(pid_file)\n        if not pid:\n            self.out('No PID in file %s' % pid_file)\n            return 1\n        pid = live_pidfile(pid_file)\n        if not pid:\n            self.out('PID %s in %s is not running' % (pid, pid_file))\n            return 1\n        self.out('Server running in PID %s' % pid)\n        return 0\n\n    def restart_with_reloader(self): # pragma: no cover\n        self.restart_with_monitor(reloader=True)\n\n    def restart_with_monitor(self, reloader=False): # pragma: no cover\n        if self.options.verbose > 0:\n            if reloader:\n                self.out('Starting subprocess with file monitor')\n            else:\n                self.out('Starting subprocess with monitor parent')\n        while 1:\n            args = [self.quote_first_command_arg(sys.executable)] + sys.argv\n            new_environ = os.environ.copy()\n            if reloader:\n                new_environ[self._reloader_environ_key] = 'true'\n            else:\n                new_environ[self._monitor_environ_key] = 'true'\n            proc = None\n            try:\n                try:\n                    _turn_sigterm_into_systemexit()\n                    proc = subprocess.Popen(args, env=new_environ)\n                    exit_code = proc.wait()\n                    proc = None\n                except KeyboardInterrupt:\n                    self.out('^C caught in monitor process')\n                    if self.options.verbose > 1:\n                        raise\n                    return 1\n            finally:\n                if proc is not None:\n                    import signal\n                    try:\n                        kill(proc.pid, signal.SIGTERM)\n                    except (OSError, IOError):\n                        pass\n\n            if reloader:\n                # Reloader always exits with code 3; but if we are\n                # a monitor, any exit code will restart\n                if exit_code != 3:\n                    return exit_code\n            if self.options.verbose > 0:\n                self.out('%s %s %s' % ('-' * 20, 'Restarting', '-' * 20))\n\n    def change_user_group(self, user, group): # pragma: no cover\n        if not user and not group:\n            return\n        import pwd, grp\n        uid = gid = None\n        if group:\n            try:\n                gid = int(group)\n                group = grp.getgrgid(gid).gr_name\n            except ValueError:\n                import grp\n                try:\n                    entry = grp.getgrnam(group)\n                except KeyError:\n                    raise ValueError(\n                        \"Bad group: %r; no such group exists\" % group)\n                gid = entry.gr_gid\n        try:\n            uid = int(user)\n            user = pwd.getpwuid(uid).pw_name\n        except ValueError:\n            try:\n                entry = pwd.getpwnam(user)\n            except KeyError:\n                raise ValueError(\n                    \"Bad username: %r; no such user exists\" % user)\n            if not gid:\n                gid = entry.pw_gid\n            uid = entry.pw_uid\n        if self.options.verbose > 0:\n            self.out('Changing user to %s:%s (%s:%s)' % (\n                user, group or '(unknown)', uid, gid))\n        if gid:\n            os.setgid(gid)\n        if uid:\n            os.setuid(uid)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 55,
                            "end_lineno": 576,
                            "parent": null
                        },
                        {
                            "file_name": "pyramid/scripts/pserve.py",
                            "type": "method",
                            "name": "PServeCommand.out",
                            "content": "class PServeCommand(object):\n\n    usage = '%prog config_uri [start|stop|restart|status] [var=value]'\n    description = \"\"\"\\\n    This command serves a web application that uses a PasteDeploy\n    configuration file for the server and application.\n\n    If start/stop/restart is given, then --daemon is implied, and it will\n    start (normal operation), stop (--stop-daemon), or do both.\n\n    You can also include variable assignments like 'http_port=8080'\n    and then use %(http_port)s in your config files.\n    \"\"\"\n    default_verbosity = 1\n\n    parser = optparse.OptionParser(\n        usage,\n        description=textwrap.dedent(description)\n        )\n    parser.add_option(\n        '-n', '--app-name',\n        dest='app_name',\n        metavar='NAME',\n        help=\"Load the named application (default main)\")\n    parser.add_option(\n        '-s', '--server',\n        dest='server',\n        metavar='SERVER_TYPE',\n        help=\"Use the named server.\")\n    parser.add_option(\n        '--server-name',\n        dest='server_name',\n        metavar='SECTION_NAME',\n        help=(\"Use the named server as defined in the configuration file \"\n              \"(default: main)\"))\n    if hasattr(os, 'fork'):\n        parser.add_option(\n            '--daemon',\n            dest=\"daemon\",\n            action=\"store_true\",\n            help=\"Run in daemon (background) mode\")\n    parser.add_option(\n        '--pid-file',\n        dest='pid_file',\n        metavar='FILENAME',\n        help=(\"Save PID to file (default to pyramid.pid if running in \"\n              \"daemon mode)\"))\n    parser.add_option(\n        '--log-file',\n        dest='log_file',\n        metavar='LOG_FILE',\n        help=\"Save output to the given log file (redirects stdout)\")\n    parser.add_option(\n        '--reload',\n        dest='reload',\n        action='store_true',\n        help=\"Use auto-restart file monitor\")\n    parser.add_option(\n        '--reload-interval',\n        dest='reload_interval',\n        default=1,\n        help=(\"Seconds between checking files (low number can cause \"\n              \"significant CPU usage)\"))\n    parser.add_option(\n        '--monitor-restart',\n        dest='monitor_restart',\n        action='store_true',\n        help=\"Auto-restart server if it dies\")\n    parser.add_option(\n        '--status',\n        action='store_true',\n        dest='show_status',\n        help=\"Show the status of the (presumably daemonized) server\")\n    parser.add_option(\n        '-v', '--verbose',\n        default=default_verbosity,\n        dest='verbose',\n        action='count',\n        help=\"Set verbose level (default \"+str(default_verbosity)+\")\")\n    parser.add_option(\n        '-q', '--quiet',\n        action='store_const',\n        const=0,\n        dest='verbose',\n        help=\"Suppress verbose output\")\n\n    if hasattr(os, 'setuid'):\n        # I don't think these are available on Windows\n        parser.add_option(\n            '--user',\n            dest='set_user',\n            metavar=\"USERNAME\",\n            help=\"Set the user (usually only possible when run as root)\")\n        parser.add_option(\n            '--group',\n            dest='set_group',\n            metavar=\"GROUP\",\n            help=\"Set the group (usually only possible when run as root)\")\n\n    parser.add_option(\n        '--stop-daemon',\n        dest='stop_daemon',\n        action='store_true',\n        help=('Stop a daemonized server (given a PID file, or default '\n              'pyramid.pid file)'))\n\n    _scheme_re = re.compile(r'^[a-z][a-z]+:', re.I)\n\n    _reloader_environ_key = 'PYTHON_RELOADER_SHOULD_RUN'\n    _monitor_environ_key = 'PASTE_MONITOR_SHOULD_RUN'\n\n    possible_subcommands = ('start', 'stop', 'restart', 'status')\n\n    def __init__(self, argv):\n        self.options, self.args = self.parser.parse_args(argv[1:])\n\n    def out(self, msg): # pragma: no cover\n        print(msg)\n\n    def get_options(self):\n        if (len(self.args) > 1\n            and self.args[1] in self.possible_subcommands):\n            restvars = self.args[2:]\n        else:\n            restvars = self.args[1:]\n\n        return parse_vars(restvars)\n\n    def run(self): # pragma: no cover\n        if self.options.stop_daemon:\n            return self.stop_daemon()\n\n        if not hasattr(self.options, 'set_user'):\n            # Windows case:\n            self.options.set_user = self.options.set_group = None\n\n        # @@: Is this the right stage to set the user at?\n        self.change_user_group(\n            self.options.set_user, self.options.set_group)\n\n        if not self.args:\n            self.out('You must give a config file')\n            return 2\n        app_spec = self.args[0]\n\n        if (len(self.args) > 1\n            and self.args[1] in self.possible_subcommands):\n            cmd = self.args[1]\n        else:\n            cmd = None\n\n        if self.options.reload:\n            if os.environ.get(self._reloader_environ_key):\n                if self.options.verbose > 1:\n                    self.out('Running reloading file monitor')\n                install_reloader(int(self.options.reload_interval), [app_spec])\n                # if self.requires_config_file:\n                #     watch_file(self.args[0])\n            else:\n                return self.restart_with_reloader()\n\n        if cmd not in (None, 'start', 'stop', 'restart', 'status'):\n            self.out(\n                'Error: must give start|stop|restart (not %s)' % cmd)\n            return 2\n\n        if cmd == 'status' or self.options.show_status:\n            return self.show_status()\n\n        if cmd == 'restart' or cmd == 'stop':\n            result = self.stop_daemon()\n            if result:\n                if cmd == 'restart':\n                    self.out(\"Could not stop daemon; aborting\")\n                else:\n                    self.out(\"Could not stop daemon\")\n                return result\n            if cmd == 'stop':\n                return result\n            self.options.daemon = True\n\n        if cmd == 'start':\n            self.options.daemon = True\n\n        app_name = self.options.app_name\n\n        vars = self.get_options()\n\n        if not self._scheme_re.search(app_spec):\n            app_spec = 'config:' + app_spec\n        server_name = self.options.server_name\n        if self.options.server:\n            server_spec = 'egg:pyramid'\n            assert server_name is None\n            server_name = self.options.server\n        else:\n            server_spec = app_spec\n        base = os.getcwd()\n\n        if getattr(self.options, 'daemon', False):\n            if not self.options.pid_file:\n                self.options.pid_file = 'pyramid.pid'\n            if not self.options.log_file:\n                self.options.log_file = 'pyramid.log'\n\n        # Ensure the log file is writeable\n        if self.options.log_file:\n            try:\n                writeable_log_file = open(self.options.log_file, 'a')\n            except IOError as ioe:\n                msg = 'Error: Unable to write to log file: %s' % ioe\n                raise ValueError(msg)\n            writeable_log_file.close()\n\n        # Ensure the pid file is writeable\n        if self.options.pid_file:\n            try:\n                writeable_pid_file = open(self.options.pid_file, 'a')\n            except IOError as ioe:\n                msg = 'Error: Unable to write to pid file: %s' % ioe\n                raise ValueError(msg)\n            writeable_pid_file.close()\n\n        if getattr(self.options, 'daemon', False):\n            try:\n                self.daemonize()\n            except DaemonizeException as ex:\n                if self.options.verbose > 0:\n                    self.out(str(ex))\n                return 2\n\n        if (self.options.monitor_restart\n            and not os.environ.get(self._monitor_environ_key)):\n            return self.restart_with_monitor()\n\n        if self.options.pid_file:\n            self.record_pid(self.options.pid_file)\n\n        if self.options.log_file:\n            stdout_log = LazyWriter(self.options.log_file, 'a')\n            sys.stdout = stdout_log\n            sys.stderr = stdout_log\n            logging.basicConfig(stream=stdout_log)\n\n        log_fn = app_spec\n        if log_fn.startswith('config:'):\n            log_fn = app_spec[len('config:'):]\n        elif log_fn.startswith('egg:'):\n            log_fn = None\n        if log_fn:\n            log_fn = os.path.join(base, log_fn)\n            setup_logging(log_fn)\n\n        server = self.loadserver(server_spec, name=server_name,\n                                 relative_to=base, global_conf=vars)\n\n        app = self.loadapp(app_spec, name=app_name, relative_to=base,\n                global_conf=vars)\n\n        if self.options.verbose > 0:\n            if hasattr(os, 'getpid'):\n                msg = 'Starting server in PID %i.' % os.getpid()\n            else:\n                msg = 'Starting server.'\n            self.out(msg)\n\n        def serve():\n            try:\n                server(app)\n            except (SystemExit, KeyboardInterrupt) as e:\n                if self.options.verbose > 1:\n                    raise\n                if str(e):\n                    msg = ' ' + str(e)\n                else:\n                    msg = ''\n                self.out('Exiting%s (-v to see traceback)' % msg)\n\n        serve()\n\n    def loadapp(self, app_spec, name, relative_to, **kw): # pragma: no cover\n        return loadapp(app_spec, name=name, relative_to=relative_to, **kw)\n\n    def loadserver(self, server_spec, name, relative_to, **kw):# pragma:no cover\n        return loadserver(\n            server_spec, name=name, relative_to=relative_to, **kw)\n\n    def quote_first_command_arg(self, arg): # pragma: no cover\n        \"\"\"\n        There's a bug in Windows when running an executable that's\n        located inside a path with a space in it.  This method handles\n        that case, or on non-Windows systems or an executable with no\n        spaces, it just leaves well enough alone.\n        \"\"\"\n        if (sys.platform != 'win32' or ' ' not in arg):\n            # Problem does not apply:\n            return arg\n        try:\n            import win32api\n        except ImportError:\n            raise ValueError(\n                \"The executable %r contains a space, and in order to \"\n                \"handle this issue you must have the win32api module \"\n                \"installed\" % arg)\n        arg = win32api.GetShortPathName(arg)\n        return arg\n\n    def daemonize(self): # pragma: no cover\n        pid = live_pidfile(self.options.pid_file)\n        if pid:\n            raise DaemonizeException(\n                \"Daemon is already running (PID: %s from PID file %s)\"\n                % (pid, self.options.pid_file))\n\n        if self.options.verbose > 0:\n            self.out('Entering daemon mode')\n        pid = os.fork()\n        if pid:\n            # The forked process also has a handle on resources, so we\n            # *don't* want proper termination of the process, we just\n            # want to exit quick (which os._exit() does)\n            os._exit(0)\n        # Make this the session leader\n        os.setsid()\n        # Fork again for good measure!\n        pid = os.fork()\n        if pid:\n            os._exit(0)\n\n        # @@: Should we set the umask and cwd now?\n\n        import resource  # Resource usage information.\n        maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]\n        if (maxfd == resource.RLIM_INFINITY):\n            maxfd = MAXFD\n        # Iterate through and close all file descriptors.\n        for fd in range(0, maxfd):\n            try:\n                os.close(fd)\n            except OSError:  # ERROR, fd wasn't open to begin with (ignored)\n                pass\n\n        if (hasattr(os, \"devnull\")):\n            REDIRECT_TO = os.devnull\n        else:\n            REDIRECT_TO = \"/dev/null\"\n        os.open(REDIRECT_TO, os.O_RDWR)  # standard input (0)\n        # Duplicate standard input to standard output and standard error.\n        os.dup2(0, 1)  # standard output (1)\n        os.dup2(0, 2)  # standard error (2)\n\n    def _remove_pid_file(self, written_pid, filename, verbosity):\n        current_pid = os.getpid()\n        if written_pid != current_pid:\n            # A forked process must be exiting, not the process that\n            # wrote the PID file\n            return\n        if not os.path.exists(filename):\n            return\n        with open(filename) as f:\n            content = f.read().strip()\n        try:\n            pid_in_file = int(content)\n        except ValueError:\n            pass\n        else:\n            if pid_in_file != current_pid:\n                msg = \"PID file %s contains %s, not expected PID %s\"\n                self.out(msg % (filename, pid_in_file, current_pid))\n                return\n        if verbosity > 0:\n            self.out(\"Removing PID file %s\" % filename)\n        try:\n            os.unlink(filename)\n            return\n        except OSError as e:\n            # Record, but don't give traceback\n            self.out(\"Cannot remove PID file: (%s)\" % e)\n        # well, at least lets not leave the invalid PID around...\n        try:\n            with open(filename, 'w') as f:\n                f.write('')\n        except OSError as e:\n            self.out('Stale PID left in file: %s (%s)' % (filename, e))\n        else:\n            self.out('Stale PID removed')\n\n    def record_pid(self, pid_file):\n        pid = os.getpid()\n        if self.options.verbose > 1:\n            self.out('Writing PID %s to %s' % (pid, pid_file))\n        with open(pid_file, 'w') as f:\n            f.write(str(pid))\n        atexit.register(self._remove_pid_file, pid, pid_file, self.options.verbose)\n\n    def stop_daemon(self): # pragma: no cover\n        pid_file = self.options.pid_file or 'pyramid.pid'\n        if not os.path.exists(pid_file):\n            self.out('No PID file exists in %s' % pid_file)\n            return 1\n        pid = read_pidfile(pid_file)\n        if not pid:\n            self.out(\"Not a valid PID file in %s\" % pid_file)\n            return 1\n        pid = live_pidfile(pid_file)\n        if not pid:\n            self.out(\"PID in %s is not valid (deleting)\" % pid_file)\n            try:\n                os.unlink(pid_file)\n            except (OSError, IOError) as e:\n                self.out(\"Could not delete: %s\" % e)\n                return 2\n            return 1\n        for j in range(10):\n            if not live_pidfile(pid_file):\n                break\n            import signal\n            kill(pid, signal.SIGTERM)\n            time.sleep(1)\n        else:\n            self.out(\"failed to kill web process %s\" % pid)\n            return 3\n        if os.path.exists(pid_file):\n            os.unlink(pid_file)\n        return 0\n\n    def show_status(self): # pragma: no cover\n        pid_file = self.options.pid_file or 'pyramid.pid'\n        if not os.path.exists(pid_file):\n            self.out('No PID file %s' % pid_file)\n            return 1\n        pid = read_pidfile(pid_file)\n        if not pid:\n            self.out('No PID in file %s' % pid_file)\n            return 1\n        pid = live_pidfile(pid_file)\n        if not pid:\n            self.out('PID %s in %s is not running' % (pid, pid_file))\n            return 1\n        self.out('Server running in PID %s' % pid)\n        return 0\n\n    def restart_with_reloader(self): # pragma: no cover\n        self.restart_with_monitor(reloader=True)\n\n    def restart_with_monitor(self, reloader=False): # pragma: no cover\n        if self.options.verbose > 0:\n            if reloader:\n                self.out('Starting subprocess with file monitor')\n            else:\n                self.out('Starting subprocess with monitor parent')\n        while 1:\n            args = [self.quote_first_command_arg(sys.executable)] + sys.argv\n            new_environ = os.environ.copy()\n            if reloader:\n                new_environ[self._reloader_environ_key] = 'true'\n            else:\n                new_environ[self._monitor_environ_key] = 'true'\n            proc = None\n            try:\n                try:\n                    _turn_sigterm_into_systemexit()\n                    proc = subprocess.Popen(args, env=new_environ)\n                    exit_code = proc.wait()\n                    proc = None\n                except KeyboardInterrupt:\n                    self.out('^C caught in monitor process')\n                    if self.options.verbose > 1:\n                        raise\n                    return 1\n            finally:\n                if proc is not None:\n                    import signal\n                    try:\n                        kill(proc.pid, signal.SIGTERM)\n                    except (OSError, IOError):\n                        pass\n\n            if reloader:\n                # Reloader always exits with code 3; but if we are\n                # a monitor, any exit code will restart\n                if exit_code != 3:\n                    return exit_code\n            if self.options.verbose > 0:\n                self.out('%s %s %s' % ('-' * 20, 'Restarting', '-' * 20))\n\n    def change_user_group(self, user, group): # pragma: no cover\n        if not user and not group:\n            return\n        import pwd, grp\n        uid = gid = None\n        if group:\n            try:\n                gid = int(group)\n                group = grp.getgrgid(gid).gr_name\n            except ValueError:\n                import grp\n                try:\n                    entry = grp.getgrnam(group)\n                except KeyError:\n                    raise ValueError(\n                        \"Bad group: %r; no such group exists\" % group)\n                gid = entry.gr_gid\n        try:\n            uid = int(user)\n            user = pwd.getpwuid(uid).pw_name\n        except ValueError:\n            try:\n                entry = pwd.getpwnam(user)\n            except KeyError:\n                raise ValueError(\n                    \"Bad username: %r; no such user exists\" % user)\n            if not gid:\n                gid = entry.pw_gid\n            uid = entry.pw_uid\n        if self.options.verbose > 0:\n            self.out('Changing user to %s:%s (%s:%s)' % (\n                user, group or '(unknown)', uid, gid))\n        if gid:\n            os.setgid(gid)\n        if uid:\n            os.setuid(uid)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 171,
                            "end_lineno": 172,
                            "parent": {
                                "file_name": "pyramid/scripts/pserve.py",
                                "type": "class",
                                "name": "PServeCommand",
                                "content": "class PServeCommand(object):\n\n    usage = '%prog config_uri [start|stop|restart|status] [var=value]'\n    description = \"\"\"\\\n    This command serves a web application that uses a PasteDeploy\n    configuration file for the server and application.\n\n    If start/stop/restart is given, then --daemon is implied, and it will\n    start (normal operation), stop (--stop-daemon), or do both.\n\n    You can also include variable assignments like 'http_port=8080'\n    and then use %(http_port)s in your config files.\n    \"\"\"\n    default_verbosity = 1\n\n    parser = optparse.OptionParser(\n        usage,\n        description=textwrap.dedent(description)\n        )\n    parser.add_option(\n        '-n', '--app-name',\n        dest='app_name',\n        metavar='NAME',\n        help=\"Load the named application (default main)\")\n    parser.add_option(\n        '-s', '--server',\n        dest='server',\n        metavar='SERVER_TYPE',\n        help=\"Use the named server.\")\n    parser.add_option(\n        '--server-name',\n        dest='server_name',\n        metavar='SECTION_NAME',\n        help=(\"Use the named server as defined in the configuration file \"\n              \"(default: main)\"))\n    if hasattr(os, 'fork'):\n        parser.add_option(\n            '--daemon',\n            dest=\"daemon\",\n            action=\"store_true\",\n            help=\"Run in daemon (background) mode\")\n    parser.add_option(\n        '--pid-file',\n        dest='pid_file',\n        metavar='FILENAME',\n        help=(\"Save PID to file (default to pyramid.pid if running in \"\n              \"daemon mode)\"))\n    parser.add_option(\n        '--log-file',\n        dest='log_file',\n        metavar='LOG_FILE',\n        help=\"Save output to the given log file (redirects stdout)\")\n    parser.add_option(\n        '--reload',\n        dest='reload',\n        action='store_true',\n        help=\"Use auto-restart file monitor\")\n    parser.add_option(\n        '--reload-interval',\n        dest='reload_interval',\n        default=1,\n        help=(\"Seconds between checking files (low number can cause \"\n              \"significant CPU usage)\"))\n    parser.add_option(\n        '--monitor-restart',\n        dest='monitor_restart',\n        action='store_true',\n        help=\"Auto-restart server if it dies\")\n    parser.add_option(\n        '--status',\n        action='store_true',\n        dest='show_status',\n        help=\"Show the status of the (presumably daemonized) server\")\n    parser.add_option(\n        '-v', '--verbose',\n        default=default_verbosity,\n        dest='verbose',\n        action='count',\n        help=\"Set verbose level (default \"+str(default_verbosity)+\")\")\n    parser.add_option(\n        '-q', '--quiet',\n        action='store_const',\n        const=0,\n        dest='verbose',\n        help=\"Suppress verbose output\")\n\n    if hasattr(os, 'setuid'):\n        # I don't think these are available on Windows\n        parser.add_option(\n            '--user',\n            dest='set_user',\n            metavar=\"USERNAME\",\n            help=\"Set the user (usually only possible when run as root)\")\n        parser.add_option(\n            '--group',\n            dest='set_group',\n            metavar=\"GROUP\",\n            help=\"Set the group (usually only possible when run as root)\")\n\n    parser.add_option(\n        '--stop-daemon',\n        dest='stop_daemon',\n        action='store_true',\n        help=('Stop a daemonized server (given a PID file, or default '\n              'pyramid.pid file)'))\n\n    _scheme_re = re.compile(r'^[a-z][a-z]+:', re.I)\n\n    _reloader_environ_key = 'PYTHON_RELOADER_SHOULD_RUN'\n    _monitor_environ_key = 'PASTE_MONITOR_SHOULD_RUN'\n\n    possible_subcommands = ('start', 'stop', 'restart', 'status')\n\n    def __init__(self, argv):\n        self.options, self.args = self.parser.parse_args(argv[1:])\n\n    def out(self, msg): # pragma: no cover\n        print(msg)\n\n    def get_options(self):\n        if (len(self.args) > 1\n            and self.args[1] in self.possible_subcommands):\n            restvars = self.args[2:]\n        else:\n            restvars = self.args[1:]\n\n        return parse_vars(restvars)\n\n    def run(self): # pragma: no cover\n        if self.options.stop_daemon:\n            return self.stop_daemon()\n\n        if not hasattr(self.options, 'set_user'):\n            # Windows case:\n            self.options.set_user = self.options.set_group = None\n\n        # @@: Is this the right stage to set the user at?\n        self.change_user_group(\n            self.options.set_user, self.options.set_group)\n\n        if not self.args:\n            self.out('You must give a config file')\n            return 2\n        app_spec = self.args[0]\n\n        if (len(self.args) > 1\n            and self.args[1] in self.possible_subcommands):\n            cmd = self.args[1]\n        else:\n            cmd = None\n\n        if self.options.reload:\n            if os.environ.get(self._reloader_environ_key):\n                if self.options.verbose > 1:\n                    self.out('Running reloading file monitor')\n                install_reloader(int(self.options.reload_interval), [app_spec])\n                # if self.requires_config_file:\n                #     watch_file(self.args[0])\n            else:\n                return self.restart_with_reloader()\n\n        if cmd not in (None, 'start', 'stop', 'restart', 'status'):\n            self.out(\n                'Error: must give start|stop|restart (not %s)' % cmd)\n            return 2\n\n        if cmd == 'status' or self.options.show_status:\n            return self.show_status()\n\n        if cmd == 'restart' or cmd == 'stop':\n            result = self.stop_daemon()\n            if result:\n                if cmd == 'restart':\n                    self.out(\"Could not stop daemon; aborting\")\n                else:\n                    self.out(\"Could not stop daemon\")\n                return result\n            if cmd == 'stop':\n                return result\n            self.options.daemon = True\n\n        if cmd == 'start':\n            self.options.daemon = True\n\n        app_name = self.options.app_name\n\n        vars = self.get_options()\n\n        if not self._scheme_re.search(app_spec):\n            app_spec = 'config:' + app_spec\n        server_name = self.options.server_name\n        if self.options.server:\n            server_spec = 'egg:pyramid'\n            assert server_name is None\n            server_name = self.options.server\n        else:\n            server_spec = app_spec\n        base = os.getcwd()\n\n        if getattr(self.options, 'daemon', False):\n            if not self.options.pid_file:\n                self.options.pid_file = 'pyramid.pid'\n            if not self.options.log_file:\n                self.options.log_file = 'pyramid.log'\n\n        # Ensure the log file is writeable\n        if self.options.log_file:\n            try:\n                writeable_log_file = open(self.options.log_file, 'a')\n            except IOError as ioe:\n                msg = 'Error: Unable to write to log file: %s' % ioe\n                raise ValueError(msg)\n            writeable_log_file.close()\n\n        # Ensure the pid file is writeable\n        if self.options.pid_file:\n            try:\n                writeable_pid_file = open(self.options.pid_file, 'a')\n            except IOError as ioe:\n                msg = 'Error: Unable to write to pid file: %s' % ioe\n                raise ValueError(msg)\n            writeable_pid_file.close()\n\n        if getattr(self.options, 'daemon', False):\n            try:\n                self.daemonize()\n            except DaemonizeException as ex:\n                if self.options.verbose > 0:\n                    self.out(str(ex))\n                return 2\n\n        if (self.options.monitor_restart\n            and not os.environ.get(self._monitor_environ_key)):\n            return self.restart_with_monitor()\n\n        if self.options.pid_file:\n            self.record_pid(self.options.pid_file)\n\n        if self.options.log_file:\n            stdout_log = LazyWriter(self.options.log_file, 'a')\n            sys.stdout = stdout_log\n            sys.stderr = stdout_log\n            logging.basicConfig(stream=stdout_log)\n\n        log_fn = app_spec\n        if log_fn.startswith('config:'):\n            log_fn = app_spec[len('config:'):]\n        elif log_fn.startswith('egg:'):\n            log_fn = None\n        if log_fn:\n            log_fn = os.path.join(base, log_fn)\n            setup_logging(log_fn)\n\n        server = self.loadserver(server_spec, name=server_name,\n                                 relative_to=base, global_conf=vars)\n\n        app = self.loadapp(app_spec, name=app_name, relative_to=base,\n                global_conf=vars)\n\n        if self.options.verbose > 0:\n            if hasattr(os, 'getpid'):\n                msg = 'Starting server in PID %i.' % os.getpid()\n            else:\n                msg = 'Starting server.'\n            self.out(msg)\n\n        def serve():\n            try:\n                server(app)\n            except (SystemExit, KeyboardInterrupt) as e:\n                if self.options.verbose > 1:\n                    raise\n                if str(e):\n                    msg = ' ' + str(e)\n                else:\n                    msg = ''\n                self.out('Exiting%s (-v to see traceback)' % msg)\n\n        serve()\n\n    def loadapp(self, app_spec, name, relative_to, **kw): # pragma: no cover\n        return loadapp(app_spec, name=name, relative_to=relative_to, **kw)\n\n    def loadserver(self, server_spec, name, relative_to, **kw):# pragma:no cover\n        return loadserver(\n            server_spec, name=name, relative_to=relative_to, **kw)\n\n    def quote_first_command_arg(self, arg): # pragma: no cover\n        \"\"\"\n        There's a bug in Windows when running an executable that's\n        located inside a path with a space in it.  This method handles\n        that case, or on non-Windows systems or an executable with no\n        spaces, it just leaves well enough alone.\n        \"\"\"\n        if (sys.platform != 'win32' or ' ' not in arg):\n            # Problem does not apply:\n            return arg\n        try:\n            import win32api\n        except ImportError:\n            raise ValueError(\n                \"The executable %r contains a space, and in order to \"\n                \"handle this issue you must have the win32api module \"\n                \"installed\" % arg)\n        arg = win32api.GetShortPathName(arg)\n        return arg\n\n    def daemonize(self): # pragma: no cover\n        pid = live_pidfile(self.options.pid_file)\n        if pid:\n            raise DaemonizeException(\n                \"Daemon is already running (PID: %s from PID file %s)\"\n                % (pid, self.options.pid_file))\n\n        if self.options.verbose > 0:\n            self.out('Entering daemon mode')\n        pid = os.fork()\n        if pid:\n            # The forked process also has a handle on resources, so we\n            # *don't* want proper termination of the process, we just\n            # want to exit quick (which os._exit() does)\n            os._exit(0)\n        # Make this the session leader\n        os.setsid()\n        # Fork again for good measure!\n        pid = os.fork()\n        if pid:\n            os._exit(0)\n\n        # @@: Should we set the umask and cwd now?\n\n        import resource  # Resource usage information.\n        maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]\n        if (maxfd == resource.RLIM_INFINITY):\n            maxfd = MAXFD\n        # Iterate through and close all file descriptors.\n        for fd in range(0, maxfd):\n            try:\n                os.close(fd)\n            except OSError:  # ERROR, fd wasn't open to begin with (ignored)\n                pass\n\n        if (hasattr(os, \"devnull\")):\n            REDIRECT_TO = os.devnull\n        else:\n            REDIRECT_TO = \"/dev/null\"\n        os.open(REDIRECT_TO, os.O_RDWR)  # standard input (0)\n        # Duplicate standard input to standard output and standard error.\n        os.dup2(0, 1)  # standard output (1)\n        os.dup2(0, 2)  # standard error (2)\n\n    def _remove_pid_file(self, written_pid, filename, verbosity):\n        current_pid = os.getpid()\n        if written_pid != current_pid:\n            # A forked process must be exiting, not the process that\n            # wrote the PID file\n            return\n        if not os.path.exists(filename):\n            return\n        with open(filename) as f:\n            content = f.read().strip()\n        try:\n            pid_in_file = int(content)\n        except ValueError:\n            pass\n        else:\n            if pid_in_file != current_pid:\n                msg = \"PID file %s contains %s, not expected PID %s\"\n                self.out(msg % (filename, pid_in_file, current_pid))\n                return\n        if verbosity > 0:\n            self.out(\"Removing PID file %s\" % filename)\n        try:\n            os.unlink(filename)\n            return\n        except OSError as e:\n            # Record, but don't give traceback\n            self.out(\"Cannot remove PID file: (%s)\" % e)\n        # well, at least lets not leave the invalid PID around...\n        try:\n            with open(filename, 'w') as f:\n                f.write('')\n        except OSError as e:\n            self.out('Stale PID left in file: %s (%s)' % (filename, e))\n        else:\n            self.out('Stale PID removed')\n\n    def record_pid(self, pid_file):\n        pid = os.getpid()\n        if self.options.verbose > 1:\n            self.out('Writing PID %s to %s' % (pid, pid_file))\n        with open(pid_file, 'w') as f:\n            f.write(str(pid))\n        atexit.register(self._remove_pid_file, pid, pid_file, self.options.verbose)\n\n    def stop_daemon(self): # pragma: no cover\n        pid_file = self.options.pid_file or 'pyramid.pid'\n        if not os.path.exists(pid_file):\n            self.out('No PID file exists in %s' % pid_file)\n            return 1\n        pid = read_pidfile(pid_file)\n        if not pid:\n            self.out(\"Not a valid PID file in %s\" % pid_file)\n            return 1\n        pid = live_pidfile(pid_file)\n        if not pid:\n            self.out(\"PID in %s is not valid (deleting)\" % pid_file)\n            try:\n                os.unlink(pid_file)\n            except (OSError, IOError) as e:\n                self.out(\"Could not delete: %s\" % e)\n                return 2\n            return 1\n        for j in range(10):\n            if not live_pidfile(pid_file):\n                break\n            import signal\n            kill(pid, signal.SIGTERM)\n            time.sleep(1)\n        else:\n            self.out(\"failed to kill web process %s\" % pid)\n            return 3\n        if os.path.exists(pid_file):\n            os.unlink(pid_file)\n        return 0\n\n    def show_status(self): # pragma: no cover\n        pid_file = self.options.pid_file or 'pyramid.pid'\n        if not os.path.exists(pid_file):\n            self.out('No PID file %s' % pid_file)\n            return 1\n        pid = read_pidfile(pid_file)\n        if not pid:\n            self.out('No PID in file %s' % pid_file)\n            return 1\n        pid = live_pidfile(pid_file)\n        if not pid:\n            self.out('PID %s in %s is not running' % (pid, pid_file))\n            return 1\n        self.out('Server running in PID %s' % pid)\n        return 0\n\n    def restart_with_reloader(self): # pragma: no cover\n        self.restart_with_monitor(reloader=True)\n\n    def restart_with_monitor(self, reloader=False): # pragma: no cover\n        if self.options.verbose > 0:\n            if reloader:\n                self.out('Starting subprocess with file monitor')\n            else:\n                self.out('Starting subprocess with monitor parent')\n        while 1:\n            args = [self.quote_first_command_arg(sys.executable)] + sys.argv\n            new_environ = os.environ.copy()\n            if reloader:\n                new_environ[self._reloader_environ_key] = 'true'\n            else:\n                new_environ[self._monitor_environ_key] = 'true'\n            proc = None\n            try:\n                try:\n                    _turn_sigterm_into_systemexit()\n                    proc = subprocess.Popen(args, env=new_environ)\n                    exit_code = proc.wait()\n                    proc = None\n                except KeyboardInterrupt:\n                    self.out('^C caught in monitor process')\n                    if self.options.verbose > 1:\n                        raise\n                    return 1\n            finally:\n                if proc is not None:\n                    import signal\n                    try:\n                        kill(proc.pid, signal.SIGTERM)\n                    except (OSError, IOError):\n                        pass\n\n            if reloader:\n                # Reloader always exits with code 3; but if we are\n                # a monitor, any exit code will restart\n                if exit_code != 3:\n                    return exit_code\n            if self.options.verbose > 0:\n                self.out('%s %s %s' % ('-' * 20, 'Restarting', '-' * 20))\n\n    def change_user_group(self, user, group): # pragma: no cover\n        if not user and not group:\n            return\n        import pwd, grp\n        uid = gid = None\n        if group:\n            try:\n                gid = int(group)\n                group = grp.getgrgid(gid).gr_name\n            except ValueError:\n                import grp\n                try:\n                    entry = grp.getgrnam(group)\n                except KeyError:\n                    raise ValueError(\n                        \"Bad group: %r; no such group exists\" % group)\n                gid = entry.gr_gid\n        try:\n            uid = int(user)\n            user = pwd.getpwuid(uid).pw_name\n        except ValueError:\n            try:\n                entry = pwd.getpwnam(user)\n            except KeyError:\n                raise ValueError(\n                    \"Bad username: %r; no such user exists\" % user)\n            if not gid:\n                gid = entry.pw_gid\n            uid = entry.pw_uid\n        if self.options.verbose > 0:\n            self.out('Changing user to %s:%s (%s:%s)' % (\n                user, group or '(unknown)', uid, gid))\n        if gid:\n            os.setgid(gid)\n        if uid:\n            os.setuid(uid)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 55,
                                "end_lineno": 576,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "import atexit\nimport os\nimport tempfile\nimport unittest\n\nfrom pyramid.compat import PY3\nif PY3: # pragma: no cover\n    import builtins as __builtin__\nelse:\n    import __builtin__\n\nclass TestPServeCommand(unittest.TestCase):\n    def setUp(self):\n        from pyramid.compat import NativeIO\n        self.out_ = NativeIO()\n        self.pid_file = None\n\n    def tearDown(self):\n        if self.pid_file and os.path.exists(self.pid_file):\n            os.remove(self.pid_file)\n\n    def out(self, msg):\n        self.out_.write(msg)\n\n    def _get_server(*args, **kwargs):\n        def server(app):\n            return ''\n\n        return server\n\n    def _getTargetClass(self):\n        from pyramid.scripts.pserve import PServeCommand\n        return PServeCommand\n\n    def _makeOne(self, *args):\n        effargs = ['pserve']\n        effargs.extend(args)\n        cmd = self._getTargetClass()(effargs)\n        cmd.out = self.out\n        return cmd\n\n    def _makeOneWithPidFile(self, pid):\n        self.pid_file = tempfile.mktemp()\n        inst = self._makeOne()\n        with open(self.pid_file, 'w') as f:\n            f.write(str(pid))\n        return inst\n\n    def test_remove_pid_file_verbose(self):\n        inst = self._makeOneWithPidFile(os.getpid())\n        inst._remove_pid_file(os.getpid(), self.pid_file, verbosity=1)\n        self._assert_pid_file_removed(verbose=True)\n\n    def test_remove_pid_file_not_verbose(self):\n        inst = self._makeOneWithPidFile(os.getpid())\n        inst._remove_pid_file(os.getpid(), self.pid_file, verbosity=0)\n        self._assert_pid_file_removed(verbose=False)\n\n    def test_remove_pid_not_a_number(self):\n        inst = self._makeOneWithPidFile('not a number')\n        inst._remove_pid_file(os.getpid(), self.pid_file, verbosity=1)\n        self._assert_pid_file_removed(verbose=True)\n\n    def test_remove_pid_current_pid_is_not_written_pid(self):\n        inst = self._makeOneWithPidFile(os.getpid())\n        inst._remove_pid_file('99999', self.pid_file, verbosity=1)\n        self._assert_pid_file_not_removed('')\n\n    def test_remove_pid_current_pid_is_not_pid_in_file(self):\n        inst = self._makeOneWithPidFile('99999')\n        inst._remove_pid_file(os.getpid(), self.pid_file, verbosity=1)\n        msg = 'PID file %s contains 99999, not expected PID %s'\n        self._assert_pid_file_not_removed(msg % (self.pid_file, os.getpid()))\n\n    def test_remove_pid_no_pid_file(self):\n        inst = self._makeOne()\n        self.pid_file = 'some unknown path'\n        inst._remove_pid_file(os.getpid(), self.pid_file, verbosity=1)\n        self._assert_pid_file_removed(verbose=False)\n\n    def test_remove_pid_file_unlink_exception(self):\n        inst = self._makeOneWithPidFile(os.getpid())\n        self._remove_pid_unlink_exception(inst)\n        msg = [\n            'Removing PID file %s' % (self.pid_file),\n            'Cannot remove PID file: (Some OSError - unlink)',\n            'Stale PID removed']\n        self._assert_pid_file_not_removed(msg=''.join(msg))\n        with open(self.pid_file) as f:\n            self.assertEqual(f.read(), '')\n\n    def test_remove_pid_file_stale_pid_write_exception(self):\n        inst = self._makeOneWithPidFile(os.getpid())\n        self._remove_pid_unlink_and_write_exceptions(inst)\n        msg = [\n            'Removing PID file %s' % (self.pid_file),\n            'Cannot remove PID file: (Some OSError - unlink)',\n            'Stale PID left in file: %s ' % (self.pid_file),\n            '(Some OSError - open)']\n        self._assert_pid_file_not_removed(msg=''.join(msg))\n        with open(self.pid_file) as f:\n            self.assertEqual(int(f.read()), os.getpid())\n\n    def test_record_pid_verbose(self):\n        self._assert_record_pid(verbosity=2, msg='Writing PID %d to %s')\n\n    def test_record_pid_not_verbose(self):\n        self._assert_record_pid(verbosity=1, msg='')\n\n    def _remove_pid_unlink_exception(self, inst):\n        old_unlink = os.unlink\n        def fake_unlink(filename):\n            raise OSError('Some OSError - unlink')\n\n        try:\n            os.unlink = fake_unlink\n            inst._remove_pid_file(os.getpid(), self.pid_file, verbosity=1)\n        finally:\n            os.unlink = old_unlink\n\n    def _remove_pid_unlink_and_write_exceptions(self, inst):\n        old_unlink = os.unlink\n        def fake_unlink(filename):\n            raise OSError('Some OSError - unlink')\n\n        run_already = []\n        old_open = __builtin__.open\n        def fake_open(*args):\n            if not run_already:\n                run_already.append(True)\n                return old_open(*args)\n            raise OSError('Some OSError - open')\n\n        try:\n            os.unlink = fake_unlink\n            __builtin__.open = fake_open\n            inst._remove_pid_file(os.getpid(), self.pid_file, verbosity=1)\n        finally:\n            os.unlink = old_unlink\n            __builtin__.open = old_open\n\n    def _assert_pid_file_removed(self, verbose=False):\n        self.assertFalse(os.path.exists(self.pid_file))\n        msg = 'Removing PID file %s' % (self.pid_file) if verbose else ''\n        self.assertEqual(self.out_.getvalue(), msg)\n\n    def _assert_pid_file_not_removed(self, msg):\n        self.assertTrue(os.path.exists(self.pid_file))\n        self.assertEqual(self.out_.getvalue(), msg)\n\n    def _assert_record_pid(self, verbosity, msg):\n        old_atexit = atexit.register\n        def fake_atexit(*args):\n            pass\n\n        self.pid_file = tempfile.mktemp()\n        pid = os.getpid()\n        inst = self._makeOne()\n        inst.options.verbose = verbosity\n\n        try:\n            atexit.register = fake_atexit\n            inst.record_pid(self.pid_file)\n        finally:\n            atexit.register = old_atexit\n\n        msg = msg % (pid, self.pid_file) if msg else ''\n        self.assertEqual(self.out_.getvalue(), msg)\n        with open(self.pid_file) as f:\n            self.assertEqual(int(f.read()), pid)\n\n    def test_run_no_args(self):\n        inst = self._makeOne()\n        result = inst.run()\n        self.assertEqual(result, 2)\n        self.assertEqual(self.out_.getvalue(), 'You must give a config file')\n\n    def test_run_stop_daemon_no_such_pid_file(self):\n        path = os.path.join(os.path.dirname(__file__), 'wontexist.pid')\n        inst = self._makeOne('--stop-daemon', '--pid-file=%s' % path)\n        inst.run()\n        msg = 'No PID file exists in %s' % path\n        self.assertEqual(self.out_.getvalue(), msg)\n\n    def test_run_stop_daemon_bad_pid_file(self):\n        path = __file__\n        inst = self._makeOne('--stop-daemon', '--pid-file=%s' % path)\n        inst.run()\n        msg = 'Not a valid PID file in %s' % path\n        self.assertEqual(self.out_.getvalue(), msg)\n\n    def test_run_stop_daemon_invalid_pid_in_file(self):\n        fn = tempfile.mktemp()\n        with open(fn, 'wb') as tmp:\n            tmp.write(b'9999999')\n        tmp.close()\n        inst = self._makeOne('--stop-daemon', '--pid-file=%s' % fn)\n        inst.run()\n        msg = 'PID in %s is not valid (deleting)' % fn\n        self.assertEqual(self.out_.getvalue(), msg)\n\n    def test_get_options_with_command(self):\n        inst = self._makeOne()\n        inst.args = ['foo', 'stop', 'a=1', 'b=2']\n        result = inst.get_options()\n        self.assertEqual(result, {'a': '1', 'b': '2'})\n\n    def test_get_options_no_command(self):\n        inst = self._makeOne()\n        inst.args = ['foo', 'a=1', 'b=2']\n        result = inst.get_options()\n        self.assertEqual(result, {'a': '1', 'b': '2'})\n\n    def test_parse_vars_good(self):\n        from pyramid.tests.test_scripts.dummy import DummyApp\n\n        inst = self._makeOne('development.ini', 'a=1', 'b=2')\n        inst.loadserver = self._get_server\n\n\n        app = DummyApp()\n\n        def get_app(*args, **kwargs):\n            app.global_conf = kwargs.get('global_conf', None)\n\n        inst.loadapp = get_app\n        inst.run()\n\n        self.assertEqual(app.global_conf, {'a': '1', 'b': '2'})\n\n    def test_parse_vars_bad(self):\n        inst = self._makeOne('development.ini', 'a')\n        inst.loadserver = self._get_server\n        self.assertRaises(ValueError, inst.run)\n\nclass Test_read_pidfile(unittest.TestCase):\n    def _callFUT(self, filename):\n        from pyramid.scripts.pserve import read_pidfile\n        return read_pidfile(filename)\n\n    def test_read_pidfile(self):\n        filename = tempfile.mktemp()\n        try:\n            with open(filename, 'w') as f:\n                f.write('12345')\n            result = self._callFUT(filename)\n            self.assertEqual(result, 12345)\n        finally:\n            os.remove(filename)\n\n    def test_read_pidfile_no_pid_file(self):\n        result = self._callFUT('some unknown path')\n        self.assertEqual(result, None)\n\n    def test_read_pidfile_not_a_number(self):\n        result = self._callFUT(__file__)\n        self.assertEqual(result, None)\n\nclass Test_main(unittest.TestCase):\n    def _callFUT(self, argv):\n        from pyramid.scripts.pserve import main\n        return main(argv)\n\n    def test_it(self):\n        result = self._callFUT(['pserve'])\n        self.assertEqual(result, 2)\n\nclass TestLazyWriter(unittest.TestCase):\n    def _makeOne(self, filename, mode='w'):\n        from pyramid.scripts.pserve import LazyWriter\n        return LazyWriter(filename, mode)\n\n    def test_open(self):\n        filename = tempfile.mktemp()\n        try:\n            inst = self._makeOne(filename)\n            fp = inst.open()\n            self.assertEqual(fp.name, filename)\n        finally:\n            fp.close()\n            os.remove(filename)\n\n    def test_write(self):\n        filename = tempfile.mktemp()\n        try:\n            inst = self._makeOne(filename)\n            inst.write('hello')\n        finally:\n            with open(filename) as f:\n                data = f.read()\n                self.assertEqual(data, 'hello')\n            inst.close()\n            os.remove(filename)\n\n    def test_writeline(self):\n        filename = tempfile.mktemp()\n        try:\n            inst = self._makeOne(filename)\n            inst.writelines('hello')\n        finally:\n            with open(filename) as f:\n                data = f.read()\n                self.assertEqual(data, 'hello')\n            inst.close()\n            os.remove(filename)\n\n    def test_flush(self):\n        filename = tempfile.mktemp()\n        try:\n            inst = self._makeOne(filename)\n            inst.flush()\n            fp = inst.fileobj\n            self.assertEqual(fp.name, filename)\n        finally:\n            fp.close()\n            os.remove(filename)\n\nclass Test__methodwrapper(unittest.TestCase):\n    def _makeOne(self, func, obj, type):\n        from pyramid.scripts.pserve import _methodwrapper\n        return _methodwrapper(func, obj, type)\n\n    def test___call__succeed(self):\n        def foo(self, cls, a=1): return 1\n        class Bar(object): pass\n        wrapper = self._makeOne(foo, Bar, None)\n        result = wrapper(a=1)\n        self.assertEqual(result, 1)\n\n    def test___call__fail(self):\n        def foo(self, cls, a=1): return 1\n        class Bar(object): pass\n        wrapper = self._makeOne(foo, Bar, None)\n        self.assertRaises(AssertionError, wrapper, cls=1)\n",
            "new_file_content": "import atexit\nimport os\nimport tempfile\nimport unittest\n\nfrom pyramid.compat import PY3\nif PY3: # pragma: no cover\n    import builtins as __builtin__\nelse:\n    import __builtin__\n\nclass TestPServeCommand(unittest.TestCase):\n    def setUp(self):\n        from pyramid.compat import NativeIO\n        self.out_ = NativeIO()\n        self.pid_file = None\n\n    def tearDown(self):\n        if self.pid_file and os.path.exists(self.pid_file):\n            os.remove(self.pid_file)\n\n    def out(self, msg):\n        self.out_.write(msg)\n\n    def _get_server(*args, **kwargs):\n        def server(app):\n            return ''\n\n        return server\n\n    def _getTargetClass(self):\n        from pyramid.scripts.pserve import PServeCommand\n        return PServeCommand\n\n    def _makeOne(self, *args):\n        effargs = ['pserve']\n        effargs.extend(args)\n        cmd = self._getTargetClass()(effargs)\n        cmd.out = self.out\n        return cmd\n\n    def _makeOneWithPidFile(self, pid):\n        self.pid_file = tempfile.mktemp()\n        inst = self._makeOne()\n        with open(self.pid_file, 'w') as f:\n            f.write(str(pid))\n        return inst\n\n    def test_remove_pid_file_verbose(self):\n        inst = self._makeOneWithPidFile(os.getpid())\n        inst._remove_pid_file(os.getpid(), self.pid_file, verbosity=1)\n        self._assert_pid_file_removed(verbose=True)\n\n    def test_remove_pid_file_not_verbose(self):\n        inst = self._makeOneWithPidFile(os.getpid())\n        inst._remove_pid_file(os.getpid(), self.pid_file, verbosity=0)\n        self._assert_pid_file_removed(verbose=False)\n\n    def test_remove_pid_not_a_number(self):\n        inst = self._makeOneWithPidFile('not a number')\n        inst._remove_pid_file(os.getpid(), self.pid_file, verbosity=1)\n        self._assert_pid_file_removed(verbose=True)\n\n    def test_remove_pid_current_pid_is_not_written_pid(self):\n        inst = self._makeOneWithPidFile(os.getpid())\n        inst._remove_pid_file('99999', self.pid_file, verbosity=1)\n        self._assert_pid_file_not_removed('')\n\n    def test_remove_pid_current_pid_is_not_pid_in_file(self):\n        inst = self._makeOneWithPidFile('99999')\n        inst._remove_pid_file(os.getpid(), self.pid_file, verbosity=1)\n        msg = 'PID file %s contains 99999, not expected PID %s'\n        self._assert_pid_file_not_removed(msg % (self.pid_file, os.getpid()))\n\n    def test_remove_pid_no_pid_file(self):\n        inst = self._makeOne()\n        self.pid_file = 'some unknown path'\n        inst._remove_pid_file(os.getpid(), self.pid_file, verbosity=1)\n        self._assert_pid_file_removed(verbose=False)\n\n    def test_remove_pid_file_unlink_exception(self):\n        inst = self._makeOneWithPidFile(os.getpid())\n        self._remove_pid_unlink_exception(inst)\n        msg = [\n            'Removing PID file %s' % (self.pid_file),\n            'Cannot remove PID file: (Some OSError - unlink)',\n            'Stale PID removed']\n        self._assert_pid_file_not_removed(msg=''.join(msg))\n        with open(self.pid_file) as f:\n            self.assertEqual(f.read(), '')\n\n    def test_remove_pid_file_stale_pid_write_exception(self):\n        inst = self._makeOneWithPidFile(os.getpid())\n        self._remove_pid_unlink_and_write_exceptions(inst)\n        msg = [\n            'Removing PID file %s' % (self.pid_file),\n            'Cannot remove PID file: (Some OSError - unlink)',\n            'Stale PID left in file: %s ' % (self.pid_file),\n            '(Some OSError - open)']\n        self._assert_pid_file_not_removed(msg=''.join(msg))\n        with open(self.pid_file) as f:\n            self.assertEqual(int(f.read()), os.getpid())\n\n    def test_record_pid_verbose(self):\n        self._assert_record_pid(verbosity=2, msg='Writing PID %d to %s')\n\n    def test_record_pid_not_verbose(self):\n        self._assert_record_pid(verbosity=1, msg='')\n\n    def _remove_pid_unlink_exception(self, inst):\n        old_unlink = os.unlink\n        def fake_unlink(filename):\n            raise OSError('Some OSError - unlink')\n\n        try:\n            os.unlink = fake_unlink\n            inst._remove_pid_file(os.getpid(), self.pid_file, verbosity=1)\n        finally:\n            os.unlink = old_unlink\n\n    def _remove_pid_unlink_and_write_exceptions(self, inst):\n        old_unlink = os.unlink\n        def fake_unlink(filename):\n            raise OSError('Some OSError - unlink')\n\n        run_already = []\n        old_open = __builtin__.open\n        def fake_open(*args):\n            if not run_already:\n                run_already.append(True)\n                return old_open(*args)\n            raise OSError('Some OSError - open')\n\n        try:\n            os.unlink = fake_unlink\n            __builtin__.open = fake_open\n            inst._remove_pid_file(os.getpid(), self.pid_file, verbosity=1)\n        finally:\n            os.unlink = old_unlink\n            __builtin__.open = old_open\n\n    def _assert_pid_file_removed(self, verbose=False):\n        self.assertFalse(os.path.exists(self.pid_file))\n        msg = 'Removing PID file %s' % (self.pid_file) if verbose else ''\n        self.assertEqual(self.out_.getvalue(), msg)\n\n    def _assert_pid_file_not_removed(self, msg):\n        self.assertTrue(os.path.exists(self.pid_file))\n        self.assertEqual(self.out_.getvalue(), msg)\n\n    def _assert_record_pid(self, verbosity, msg):\n        old_atexit = atexit.register\n        def fake_atexit(*args):\n            pass\n\n        self.pid_file = tempfile.mktemp()\n        pid = os.getpid()\n        inst = self._makeOne()\n        inst.options.verbose = verbosity\n\n        try:\n            atexit.register = fake_atexit\n            inst.record_pid(self.pid_file)\n        finally:\n            atexit.register = old_atexit\n\n        msg = msg % (pid, self.pid_file) if msg else ''\n        self.assertEqual(self.out_.getvalue(), msg)\n        with open(self.pid_file) as f:\n            self.assertEqual(int(f.read()), pid)\n\n    def test_run_no_args(self):\n        inst = self._makeOne()\n        result = inst.run()\n        self.assertEqual(result, 2)\n        self.assertEqual(self.out_.getvalue(), 'You must give a config file')\n\n    def test_run_stop_daemon_no_such_pid_file(self):\n        path = os.path.join(os.path.dirname(__file__), 'wontexist.pid')\n        inst = self._makeOne('--stop-daemon', '--pid-file=%s' % path)\n        inst.run()\n        msg = 'No PID file exists in %s' % path\n        self.assertEqual(self.out_.getvalue(), msg)\n\n    def test_run_stop_daemon_bad_pid_file(self):\n        path = __file__\n        inst = self._makeOne('--stop-daemon', '--pid-file=%s' % path)\n        inst.run()\n        msg = 'Not a valid PID file in %s' % path\n        self.assertEqual(self.out_.getvalue(), msg)\n\n    def test_run_stop_daemon_invalid_pid_in_file(self):\n        fn = tempfile.mktemp()\n        with open(fn, 'wb') as tmp:\n            tmp.write(b'9999999')\n        tmp.close()\n        inst = self._makeOne('--stop-daemon', '--pid-file=%s' % fn)\n        inst.run()\n        msg = 'PID in %s is not valid (deleting)' % fn\n        self.assertEqual(self.out_.getvalue(), msg)\n\n    def test_get_options_with_command(self):\n        inst = self._makeOne()\n        inst.args = ['foo', 'stop', 'a=1', 'b=2']\n        result = inst.get_options()\n        self.assertEqual(result, {'a': '1', 'b': '2'})\n\n    def test_get_options_no_command(self):\n        inst = self._makeOne()\n        inst.args = ['foo', 'a=1', 'b=2']\n        result = inst.get_options()\n        self.assertEqual(result, {'a': '1', 'b': '2'})\n\n    def test_parse_vars_good(self):\n        from pyramid.tests.test_scripts.dummy import DummyApp\n\n        inst = self._makeOne('development.ini', 'a=1', 'b=2')\n        inst.loadserver = self._get_server\n\n\n        app = DummyApp()\n\n        def get_app(*args, **kwargs):\n            app.global_conf = kwargs.get('global_conf', None)\n\n        inst.loadapp = get_app\n        inst.run()\n\n        self.assertEqual(app.global_conf, {'a': '1', 'b': '2'})\n\n    def test_parse_vars_bad(self):\n        inst = self._makeOne('development.ini', 'a')\n        inst.loadserver = self._get_server\n        self.assertRaises(ValueError, inst.run)\n\nclass Test_read_pidfile(unittest.TestCase):\n    def _callFUT(self, filename):\n        from pyramid.scripts.pserve import read_pidfile\n        return read_pidfile(filename)\n\n    def test_read_pidfile(self):\n        filename = tempfile.mktemp()\n        try:\n            with open(filename, 'w') as f:\n                f.write('12345')\n            result = self._callFUT(filename)\n            self.assertEqual(result, 12345)\n        finally:\n            os.remove(filename)\n\n    def test_read_pidfile_no_pid_file(self):\n        result = self._callFUT('some unknown path')\n        self.assertEqual(result, None)\n\n    def test_read_pidfile_not_a_number(self):\n        result = self._callFUT(__file__)\n        self.assertEqual(result, None)\n\nclass Test_main(unittest.TestCase):\n    def _callFUT(self, argv):\n        from pyramid.scripts.pserve import main\n        return main(argv, quiet=True)\n\n    def test_it(self):\n        result = self._callFUT(['pserve'])\n        self.assertEqual(result, 2)\n\nclass TestLazyWriter(unittest.TestCase):\n    def _makeOne(self, filename, mode='w'):\n        from pyramid.scripts.pserve import LazyWriter\n        return LazyWriter(filename, mode)\n\n    def test_open(self):\n        filename = tempfile.mktemp()\n        try:\n            inst = self._makeOne(filename)\n            fp = inst.open()\n            self.assertEqual(fp.name, filename)\n        finally:\n            fp.close()\n            os.remove(filename)\n\n    def test_write(self):\n        filename = tempfile.mktemp()\n        try:\n            inst = self._makeOne(filename)\n            inst.write('hello')\n        finally:\n            with open(filename) as f:\n                data = f.read()\n                self.assertEqual(data, 'hello')\n            inst.close()\n            os.remove(filename)\n\n    def test_writeline(self):\n        filename = tempfile.mktemp()\n        try:\n            inst = self._makeOne(filename)\n            inst.writelines('hello')\n        finally:\n            with open(filename) as f:\n                data = f.read()\n                self.assertEqual(data, 'hello')\n            inst.close()\n            os.remove(filename)\n\n    def test_flush(self):\n        filename = tempfile.mktemp()\n        try:\n            inst = self._makeOne(filename)\n            inst.flush()\n            fp = inst.fileobj\n            self.assertEqual(fp.name, filename)\n        finally:\n            fp.close()\n            os.remove(filename)\n\nclass Test__methodwrapper(unittest.TestCase):\n    def _makeOne(self, func, obj, type):\n        from pyramid.scripts.pserve import _methodwrapper\n        return _methodwrapper(func, obj, type)\n\n    def test___call__succeed(self):\n        def foo(self, cls, a=1): return 1\n        class Bar(object): pass\n        wrapper = self._makeOne(foo, Bar, None)\n        result = wrapper(a=1)\n        self.assertEqual(result, 1)\n\n    def test___call__fail(self):\n        def foo(self, cls, a=1): return 1\n        class Bar(object): pass\n        wrapper = self._makeOne(foo, Bar, None)\n        self.assertRaises(AssertionError, wrapper, cls=1)\n",
            "header": {
                "file": {
                    "path": "pyramid/tests/test_scripts/test_pserve.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "350487e2a",
                "new_commit_hash": "107ff4c0a",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/pyramid/tests/test_scripts/test_pserve.py"
            },
            "plus_file": {
                "path": "b/pyramid/tests/test_scripts/test_pserve.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 259,
                            "length": 7
                        },
                        "new_range": {
                            "start": 259,
                            "length": 7
                        },
                        "section": "class Test_read_pidfile(unittest.TestCase):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "class Test_main(unittest.TestCase):",
                                "type": "context"
                            },
                            {
                                "content": "    def _callFUT(self, argv):",
                                "type": "context"
                            },
                            {
                                "content": "        from pyramid.scripts.pserve import main",
                                "type": "context"
                            },
                            {
                                "content": "        return main(argv)",
                                "type": "deleted"
                            },
                            {
                                "content": "        return main(argv, quiet=True)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def test_it(self):",
                                "type": "context"
                            },
                            {
                                "content": "        result = self._callFUT(['pserve'])",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "pyramid/tests/test_scripts/test_pserve.py",
                            "type": "class",
                            "name": "Test_main",
                            "content": "class Test_main(unittest.TestCase):\n    def _callFUT(self, argv):\n        from pyramid.scripts.pserve import main\n        return main(argv)\n\n    def test_it(self):\n        result = self._callFUT(['pserve'])\n        self.assertEqual(result, 2)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 259,
                            "end_lineno": 266,
                            "parent": null
                        },
                        {
                            "file_name": "pyramid/tests/test_scripts/test_pserve.py",
                            "type": "method",
                            "name": "Test_main._callFUT",
                            "content": "class Test_main(unittest.TestCase):\n    def _callFUT(self, argv):\n        from pyramid.scripts.pserve import main\n        return main(argv)\n\n    def test_it(self):\n        result = self._callFUT(['pserve'])\n        self.assertEqual(result, 2)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 260,
                            "end_lineno": 262,
                            "parent": {
                                "file_name": "pyramid/tests/test_scripts/test_pserve.py",
                                "type": "class",
                                "name": "Test_main",
                                "content": "class Test_main(unittest.TestCase):\n    def _callFUT(self, argv):\n        from pyramid.scripts.pserve import main\n        return main(argv)\n\n    def test_it(self):\n        result = self._callFUT(['pserve'])\n        self.assertEqual(result, 2)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 259,
                                "end_lineno": 266,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        }
    ],
    "old_commit_hash": "eac06005ac849b279b94149bbbf87d2aff802495^",
    "new_commit_hash": "eac06005ac849b279b94149bbbf87d2aff802495",
    "commit_message": "quiet keyword sets verbose level to 0, test_pserve.py restored to previous state",
    "commit_date": "2013-08-02T19:57:42+10:00",
    "metadata": {}
}
{
    "repo_name": "pyramid",
    "new_commit_hash": "eac06005ac849b279b94149bbbf87d2aff802495",
    "test_file_codes": [
        "import atexit\nimport os\nimport tempfile\nimport unittest\n\nfrom pyramid.compat import PY3\nif PY3: # pragma: no cover\n    import builtins as __builtin__\nelse:\n    import __builtin__\n\nclass TestPServeCommand(unittest.TestCase):\n    def setUp(self):\n        from pyramid.compat import NativeIO\n        self.out_ = NativeIO()\n        self.pid_file = None\n\n    def tearDown(self):\n        if self.pid_file and os.path.exists(self.pid_file):\n            os.remove(self.pid_file)\n\n    def out(self, msg):\n        self.out_.write(msg)\n\n    def _get_server(*args, **kwargs):\n        def server(app):\n            return ''\n\n        return server\n\n    def _getTargetClass(self):\n        from pyramid.scripts.pserve import PServeCommand\n        return PServeCommand\n\n    def _makeOne(self, *args):\n        effargs = ['pserve']\n        effargs.extend(args)\n        cmd = self._getTargetClass()(effargs)\n        cmd.out = self.out\n        return cmd\n\n    def _makeOneWithPidFile(self, pid):\n        self.pid_file = tempfile.mktemp()\n        inst = self._makeOne()\n        with open(self.pid_file, 'w') as f:\n            f.write(str(pid))\n        return inst\n\n    def test_remove_pid_file_verbose(self):\n        inst = self._makeOneWithPidFile(os.getpid())\n        inst._remove_pid_file(os.getpid(), self.pid_file, verbosity=1)\n        self._assert_pid_file_removed(verbose=True)\n\n    def test_remove_pid_file_not_verbose(self):\n        inst = self._makeOneWithPidFile(os.getpid())\n        inst._remove_pid_file(os.getpid(), self.pid_file, verbosity=0)\n        self._assert_pid_file_removed(verbose=False)\n\n    def test_remove_pid_not_a_number(self):\n        inst = self._makeOneWithPidFile('not a number')\n        inst._remove_pid_file(os.getpid(), self.pid_file, verbosity=1)\n        self._assert_pid_file_removed(verbose=True)\n\n    def test_remove_pid_current_pid_is_not_written_pid(self):\n        inst = self._makeOneWithPidFile(os.getpid())\n        inst._remove_pid_file('99999', self.pid_file, verbosity=1)\n        self._assert_pid_file_not_removed('')\n\n    def test_remove_pid_current_pid_is_not_pid_in_file(self):\n        inst = self._makeOneWithPidFile('99999')\n        inst._remove_pid_file(os.getpid(), self.pid_file, verbosity=1)\n        msg = 'PID file %s contains 99999, not expected PID %s'\n        self._assert_pid_file_not_removed(msg % (self.pid_file, os.getpid()))\n\n    def test_remove_pid_no_pid_file(self):\n        inst = self._makeOne()\n        self.pid_file = 'some unknown path'\n        inst._remove_pid_file(os.getpid(), self.pid_file, verbosity=1)\n        self._assert_pid_file_removed(verbose=False)\n\n    def test_remove_pid_file_unlink_exception(self):\n        inst = self._makeOneWithPidFile(os.getpid())\n        self._remove_pid_unlink_exception(inst)\n        msg = [\n            'Removing PID file %s' % (self.pid_file),\n            'Cannot remove PID file: (Some OSError - unlink)',\n            'Stale PID removed']\n        self._assert_pid_file_not_removed(msg=''.join(msg))\n        with open(self.pid_file) as f:\n            self.assertEqual(f.read(), '')\n\n    def test_remove_pid_file_stale_pid_write_exception(self):\n        inst = self._makeOneWithPidFile(os.getpid())\n        self._remove_pid_unlink_and_write_exceptions(inst)\n        msg = [\n            'Removing PID file %s' % (self.pid_file),\n            'Cannot remove PID file: (Some OSError - unlink)',\n            'Stale PID left in file: %s ' % (self.pid_file),\n            '(Some OSError - open)']\n        self._assert_pid_file_not_removed(msg=''.join(msg))\n        with open(self.pid_file) as f:\n            self.assertEqual(int(f.read()), os.getpid())\n\n    def test_record_pid_verbose(self):\n        self._assert_record_pid(verbosity=2, msg='Writing PID %d to %s')\n\n    def test_record_pid_not_verbose(self):\n        self._assert_record_pid(verbosity=1, msg='')\n\n    def _remove_pid_unlink_exception(self, inst):\n        old_unlink = os.unlink\n        def fake_unlink(filename):\n            raise OSError('Some OSError - unlink')\n\n        try:\n            os.unlink = fake_unlink\n            inst._remove_pid_file(os.getpid(), self.pid_file, verbosity=1)\n        finally:\n            os.unlink = old_unlink\n\n    def _remove_pid_unlink_and_write_exceptions(self, inst):\n        old_unlink = os.unlink\n        def fake_unlink(filename):\n            raise OSError('Some OSError - unlink')\n\n        run_already = []\n        old_open = __builtin__.open\n        def fake_open(*args):\n            if not run_already:\n                run_already.append(True)\n                return old_open(*args)\n            raise OSError('Some OSError - open')\n\n        try:\n            os.unlink = fake_unlink\n            __builtin__.open = fake_open\n            inst._remove_pid_file(os.getpid(), self.pid_file, verbosity=1)\n        finally:\n            os.unlink = old_unlink\n            __builtin__.open = old_open\n\n    def _assert_pid_file_removed(self, verbose=False):\n        self.assertFalse(os.path.exists(self.pid_file))\n        msg = 'Removing PID file %s' % (self.pid_file) if verbose else ''\n        self.assertEqual(self.out_.getvalue(), msg)\n\n    def _assert_pid_file_not_removed(self, msg):\n        self.assertTrue(os.path.exists(self.pid_file))\n        self.assertEqual(self.out_.getvalue(), msg)\n\n    def _assert_record_pid(self, verbosity, msg):\n        old_atexit = atexit.register\n        def fake_atexit(*args):\n            pass\n\n        self.pid_file = tempfile.mktemp()\n        pid = os.getpid()\n        inst = self._makeOne()\n        inst.options.verbose = verbosity\n\n        try:\n            atexit.register = fake_atexit\n            inst.record_pid(self.pid_file)\n        finally:\n            atexit.register = old_atexit\n\n        msg = msg % (pid, self.pid_file) if msg else ''\n        self.assertEqual(self.out_.getvalue(), msg)\n        with open(self.pid_file) as f:\n            self.assertEqual(int(f.read()), pid)\n\n    def test_run_no_args(self):\n        inst = self._makeOne()\n        result = inst.run()\n        self.assertEqual(result, 2)\n        self.assertEqual(self.out_.getvalue(), 'You must give a config file')\n\n    def test_run_stop_daemon_no_such_pid_file(self):\n        path = os.path.join(os.path.dirname(__file__), 'wontexist.pid')\n        inst = self._makeOne('--stop-daemon', '--pid-file=%s' % path)\n        inst.run()\n        msg = 'No PID file exists in %s' % path\n        self.assertEqual(self.out_.getvalue(), msg)\n\n    def test_run_stop_daemon_bad_pid_file(self):\n        path = __file__\n        inst = self._makeOne('--stop-daemon', '--pid-file=%s' % path)\n        inst.run()\n        msg = 'Not a valid PID file in %s' % path\n        self.assertEqual(self.out_.getvalue(), msg)\n\n    def test_run_stop_daemon_invalid_pid_in_file(self):\n        fn = tempfile.mktemp()\n        with open(fn, 'wb') as tmp:\n            tmp.write(b'9999999')\n        tmp.close()\n        inst = self._makeOne('--stop-daemon', '--pid-file=%s' % fn)\n        inst.run()\n        msg = 'PID in %s is not valid (deleting)' % fn\n        self.assertEqual(self.out_.getvalue(), msg)\n\n    def test_get_options_with_command(self):\n        inst = self._makeOne()\n        inst.args = ['foo', 'stop', 'a=1', 'b=2']\n        result = inst.get_options()\n        self.assertEqual(result, {'a': '1', 'b': '2'})\n\n    def test_get_options_no_command(self):\n        inst = self._makeOne()\n        inst.args = ['foo', 'a=1', 'b=2']\n        result = inst.get_options()\n        self.assertEqual(result, {'a': '1', 'b': '2'})\n\n    def test_parse_vars_good(self):\n        from pyramid.tests.test_scripts.dummy import DummyApp\n\n        inst = self._makeOne('development.ini', 'a=1', 'b=2')\n        inst.loadserver = self._get_server\n\n\n        app = DummyApp()\n\n        def get_app(*args, **kwargs):\n            app.global_conf = kwargs.get('global_conf', None)\n\n        inst.loadapp = get_app\n        inst.run()\n\n        self.assertEqual(app.global_conf, {'a': '1', 'b': '2'})\n\n    def test_parse_vars_bad(self):\n        inst = self._makeOne('development.ini', 'a')\n        inst.loadserver = self._get_server\n        self.assertRaises(ValueError, inst.run)\n\nclass Test_read_pidfile(unittest.TestCase):\n    def _callFUT(self, filename):\n        from pyramid.scripts.pserve import read_pidfile\n        return read_pidfile(filename)\n\n    def test_read_pidfile(self):\n        filename = tempfile.mktemp()\n        try:\n            with open(filename, 'w') as f:\n                f.write('12345')\n            result = self._callFUT(filename)\n            self.assertEqual(result, 12345)\n        finally:\n            os.remove(filename)\n\n    def test_read_pidfile_no_pid_file(self):\n        result = self._callFUT('some unknown path')\n        self.assertEqual(result, None)\n\n    def test_read_pidfile_not_a_number(self):\n        result = self._callFUT(__file__)\n        self.assertEqual(result, None)\n\nclass Test_main(unittest.TestCase):\n    def _callFUT(self, argv):\n        from pyramid.scripts.pserve import main\n        return main(argv, quiet=True)\n\n    def test_it(self):\n        result = self._callFUT(['pserve'])\n        self.assertEqual(result, 2)\n\nclass TestLazyWriter(unittest.TestCase):\n    def _makeOne(self, filename, mode='w'):\n        from pyramid.scripts.pserve import LazyWriter\n        return LazyWriter(filename, mode)\n\n    def test_open(self):\n        filename = tempfile.mktemp()\n        try:\n            inst = self._makeOne(filename)\n            fp = inst.open()\n            self.assertEqual(fp.name, filename)\n        finally:\n            fp.close()\n            os.remove(filename)\n\n    def test_write(self):\n        filename = tempfile.mktemp()\n        try:\n            inst = self._makeOne(filename)\n            inst.write('hello')\n        finally:\n            with open(filename) as f:\n                data = f.read()\n                self.assertEqual(data, 'hello')\n            inst.close()\n            os.remove(filename)\n\n    def test_writeline(self):\n        filename = tempfile.mktemp()\n        try:\n            inst = self._makeOne(filename)\n            inst.writelines('hello')\n        finally:\n            with open(filename) as f:\n                data = f.read()\n                self.assertEqual(data, 'hello')\n            inst.close()\n            os.remove(filename)\n\n    def test_flush(self):\n        filename = tempfile.mktemp()\n        try:\n            inst = self._makeOne(filename)\n            inst.flush()\n            fp = inst.fileobj\n            self.assertEqual(fp.name, filename)\n        finally:\n            fp.close()\n            os.remove(filename)\n\nclass Test__methodwrapper(unittest.TestCase):\n    def _makeOne(self, func, obj, type):\n        from pyramid.scripts.pserve import _methodwrapper\n        return _methodwrapper(func, obj, type)\n\n    def test___call__succeed(self):\n        def foo(self, cls, a=1): return 1\n        class Bar(object): pass\n        wrapper = self._makeOne(foo, Bar, None)\n        result = wrapper(a=1)\n        self.assertEqual(result, 1)\n\n    def test___call__fail(self):\n        def foo(self, cls, a=1): return 1\n        class Bar(object): pass\n        wrapper = self._makeOne(foo, Bar, None)\n        self.assertRaises(AssertionError, wrapper, cls=1)\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 15 packages in 1.11s\nPrepared 1 package in 994ms\nInstalled 15 packages in 22ms\n + chameleon==4.4.4\n + importlib-metadata==8.5.0\n + importlib-resources==6.4.5\n + mako==1.3.8\n + markupsafe==2.1.5\n + pastedeploy==3.1.0\n + pyramid==1.5.dev0 (from file:///home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495)\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 + zipp==3.20.2\n + zope-deprecation==5.0\n + zope-interface==7.2\nResolved 25 packages in 47ms\nInstalled 10 packages in 16ms\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\nResolved 16 packages in 7ms\nInstalled 12 packages in 10ms\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_eac06005ac849b279b94149bbbf87d2aff802495\ncollected 882 items\n\nr2e_tests/test_1.py ............................                         [  3%]\nr2e_tests/test_config/test_adapters.py .FF..............F...             [  5%]\nr2e_tests/test_config/test_assets.py ...........FF...................... [  9%]\n.....F..........................                                         [ 13%]\nr2e_tests/test_config/test_factories.py ..................               [ 15%]\nr2e_tests/test_config/test_i18n.py FFF.FF....                            [ 16%]\nr2e_tests/test_config/test_init.py ..................................... [ 20%]\nF..F....................F...........F.................................FF [ 28%]\n...FF...................                                                 [ 31%]\nr2e_tests/test_config/test_predicates.py ............................... [ 34%]\n........................................                                 [ 39%]\nr2e_tests/test_config/test_rendering.py ....                             [ 39%]\nr2e_tests/test_config/test_routes.py ........................            [ 42%]\nr2e_tests/test_config/test_security.py ..........                        [ 43%]\nr2e_tests/test_config/test_settings.py .......................           [ 46%]\nr2e_tests/test_config/test_testing.py ............                       [ 47%]\nr2e_tests/test_config/test_tweens.py .................................   [ 51%]\nr2e_tests/test_config/test_util.py ..................................... [ 55%]\n.............                                                            [ 57%]\nr2e_tests/test_config/test_views.py ...................F................ [ 61%]\n........................................................................ [ 69%]\nFF...................................................................... [ 77%]\nFF.........F...F....F................................................... [ 85%]\n...........F                                                             [ 87%]\nr2e_tests/test_scripts/test_common.py ...                                [ 87%]\nr2e_tests/test_scripts/test_pcreate.py .........                         [ 88%]\nr2e_tests/test_scripts/test_prequest.py F.FFFFFFFFF.F.FFF.               [ 90%]\nr2e_tests/test_scripts/test_proutes.py ...........                       [ 91%]\nr2e_tests/test_scripts/test_pserve.py ............................       [ 94%]\nr2e_tests/test_scripts/test_pshell.py .................                  [ 96%]\nr2e_tests/test_scripts/test_ptweens.py .....                             [ 97%]\nr2e_tests/test_scripts/test_pviews.py ................F......            [100%]\n\n=================================== FAILURES ===================================\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 0x72f0a27d2b50>, <r2e_tests.test_config.test_adapters.DummyIface object at 0x72f0a27d2b50>)\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 0x72f0a27d2b50>, <r2e_tests.test_config.test_adapters.DummyIface object at 0x72f0a27d2b50>), <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 0x72f0a27e9a90>\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 0x72f0a27e9a90>, <InterfaceClass pyramid.interfaces.ITraverser>, '')\n\n.venv/lib/python3.8/site-packages/zope/interface/registry.py:368: ComponentLookupError\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        import os\n        resource_name = 'test_assets.py'\n        import pyramid.tests.test_config\n        provider = self._makeOne(pyramid.tests.test_config)\n        here = os.path.dirname(os.path.abspath(__file__))\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]4149bbbf87d2aff802495/pyramid/tests/test_config/test_assets.py' != '/hom[73 chars]4149bbbf87d2aff802495/r2e_tests/test_config/test_assets.py'\nE       - /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495/pyramid/tests/test_config/test_assets.py\nE       ?                                                                                                    -- ^^^^^\nE       + /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495/r2e_tests/test_config/test_assets.py\nE       ?                                                                                                     ^^^\n\nr2e_tests/test_config/test_assets.py:158: 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        import os\n        resource_name = 'test_assets.py'\n        import pyramid.tests.test_config\n        provider = self._makeOne(pyramid.tests.test_config)\n        here = os.path.dirname(os.path.abspath(__file__))\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]4149bbbf87d2aff802495/pyramid/tests/test_config/test_assets.py' != '/hom[73 chars]4149bbbf87d2aff802495/r2e_tests/test_config/test_assets.py'\nE       - /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495/pyramid/tests/test_config/test_assets.py\nE       ?                                                                                                    -- ^^^^^\nE       + /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495/r2e_tests/test_config/test_assets.py\nE       ?                                                                                                     ^^^\n\nr2e_tests/test_config/test_assets.py:212: AssertionError\n____________________ TestPackageOverrides.test_get_filename ____________________\n\nself = <r2e_tests.test_config.test_assets.TestPackageOverrides testMethod=test_get_filename>\n\n    def test_get_filename(self):\n        import os\n        overrides = [ DummyOverride(None), DummyOverride(\n            ('pyramid.tests.test_config', 'test_assets.py'))]\n        package = DummyPackage('package')\n        po = self._makeOne(package)\n        po.overrides= overrides\n        here = os.path.dirname(os.path.abspath(__file__))\n        expected = os.path.join(here, 'test_assets.py')\n>       self.assertEqual(po.get_filename('whatever'), expected)\nE       AssertionError: '/hom[73 chars]4149bbbf87d2aff802495/pyramid/tests/test_config/test_assets.py' != '/hom[73 chars]4149bbbf87d2aff802495/r2e_tests/test_config/test_assets.py'\nE       - /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495/pyramid/tests/test_config/test_assets.py\nE       ?                                                                                                    -- ^^^^^\nE       + /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495/r2e_tests/test_config/test_assets.py\nE       ?                                                                                                     ^^^\n\nr2e_tests/test_config/test_assets.py:425: 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:511: in wrapper\n    result = wrapped(self, *arg, **kw)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <pyramid.config.Configurator object at 0x72f0a278c9d0>\nspecs = ('/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495/r2e_tests/pkgs/localeapp/locale',)\nintrospectables = []\nspec = '/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495/r2e_tests/pkgs/localeapp/locale'\npackage_name = None\n\n    @action_method\n    def add_translation_dirs(self, *specs):\n        \"\"\" Add one or more :term:`translation directory` paths to the\n        current configuration state.  The ``specs`` argument is a\n        sequence that may contain absolute directory paths\n        (e.g. ``/usr/share/locale``) or :term:`asset specification`\n        names naming a directory path (e.g. ``some.package:locale``)\n        or a combination of the two.\n    \n        Example:\n    \n        .. code-block:: python\n    \n           config.add_translation_dirs('/usr/share/locale',\n                                       'some.package:locale')\n    \n        Later calls to ``add_translation_dir`` insert directories into the\n        beginning of the list of translation directories created by earlier\n        calls.  This means that the same translation found in a directory\n        added later in the configuration process will be found before one\n        added earlier in the configuration process.  However, if multiple\n        specs are provided in a single call to ``add_translation_dirs``, the\n        directories will be inserted into the beginning of the directory list\n        in the order they're provided in the ``*specs`` list argument (items\n        earlier in the list trump ones later in the list).\n        \"\"\"\n        directories = []\n        introspectables = []\n    \n        for spec in specs[::-1]: # reversed\n            package_name, filename = self._split_spec(spec)\n            if package_name is None: # absolute filename\n                directory = filename\n            else:\n                __import__(package_name)\n                package = sys.modules[package_name]\n                directory = os.path.join(package_path(package), filename)\n    \n            if not os.path.isdir(os.path.realpath(directory)):\n>               raise ConfigurationError('\"%s\" is not a directory' %\n                                         directory)\nE               pyramid.exceptions.ConfigurationError: \"/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495/r2e_tests/pkgs/localeapp/locale\" is not a directory\n\npyramid/config/i18n.py:91: 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]79b94149bbbf87d2aff802495/pyramid/tests/pkgs/localeapp/locale'] != ['/ho[70 chars]79b94149bbbf87d2aff802495/r2e_tests/pkgs/localeapp/locale']\nE       \nE       First differing element 0:\nE       '/hom[68 chars]279b94149bbbf87d2aff802495/pyramid/tests/pkgs/localeapp/locale'\nE       '/hom[68 chars]279b94149bbbf87d2aff802495/r2e_tests/pkgs/localeapp/locale'\nE       \nE       - ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495/pyramid/tests/pkgs/localeapp/locale']\nE       ?                                                                                                      -- ^^^^^\nE       \nE       + ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495/r2e_tests/pkgs/localeapp/locale']\nE       ?                                                                                                       ^^^\n\nr2e_tests/test_config/test_i18n.py:57: 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]9bbbf87d2aff802495/pyramid/tests/pkgs/localeapp/locale', 'abc'] != ['/ho[77 chars]9bbbf87d2aff802495/r2e_tests/pkgs/localeapp/locale', 'abc']\nE       \nE       First differing element 0:\nE       '/hom[68 chars]279b94149bbbf87d2aff802495/pyramid/tests/pkgs/localeapp/locale'\nE       '/hom[68 chars]279b94149bbbf87d2aff802495/r2e_tests/pkgs/localeapp/locale'\nE       \nE       - ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495/pyramid/tests/pkgs/localeapp/locale',\nE       ?                                                                                                      -- ^^^^^\nE       \nE       + ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495/r2e_tests/pkgs/localeapp/locale',\nE       ?                                                                                                       ^^^\nE       \nE          'abc']\n\nr2e_tests/test_config/test_i18n.py:67: 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]2495/pyramid/tests/pkgs/localeapp/locale', '/h[130 chars]le2'] != ['/ho[91 chars]2495/r2e_tests/pkgs/localeapp/locale', '/home/[122 chars]le2']\nE       \nE       First differing element 0:\nE       '/hom[68 chars]279b94149bbbf87d2aff802495/pyramid/tests/pkgs/localeapp/locale'\nE       '/hom[68 chars]279b94149bbbf87d2aff802495/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:74: 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]2495/pyramid/tests/pkgs/localeapp/locale3', '/[269 chars]le2'] != ['/ho[91 chars]2495/r2e_tests/pkgs/localeapp/locale3', '/home[257 chars]le2']\nE       \nE       First differing element 0:\nE       '/hom[69 chars]79b94149bbbf87d2aff802495/pyramid/tests/pkgs/localeapp/locale3'\nE       '/hom[69 chars]79b94149bbbf87d2aff802495/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:83: 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:129: 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:1026: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \npyramid/config/__init__.py:633: in commit\n    self.action_state.execute_actions(introspector=self.introspector)\npyramid/config/__init__.py:1071: in execute_actions\n    for action in resolveConflicts(self.actions):\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nactions = []\n\n    def resolveConflicts(actions):\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        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    \n        def orderandpos(v):\n            n, v = v\n            if not isinstance(v, dict):\n                # old-style tuple action\n                v = expand_action(*v)\n            return (v['order'] or 0, n)\n    \n        sactions = sorted(enumerate(actions), key=orderandpos)\n    \n        def orderonly(v):\n            n, v = v\n            if not isinstance(v, dict):\n                # old-style tuple action\n                v = expand_action(*v)\n            return v['order'] or 0\n    \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    \n            unique = {}\n            output = []\n    \n            for i, action in actiongroup:\n                # Within an order, actions are executed sequentially based on\n                # original action ordering (\"i\").\n    \n                if not isinstance(action, dict):\n                    # old-style tuple action\n                    action = expand_action(*action)\n    \n                # \"ainfo\" is a tuple of (order, i, action) where \"order\" is a\n                # user-supplied grouping, \"i\" is an integer expressing the relative\n                # position of this action in the action list being resolved, and\n                # \"action\" is an action dictionary.  The purpose of an ainfo is to\n                # associate an \"order\" and an \"i\" with a particular action; \"order\"\n                # and \"i\" exist for sorting purposes after conflict resolution.\n                ainfo = (order, i, action)\n    \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    \n            for discriminator, ainfos in unique.items():\n                # We use (includepath, order, 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 \"order\", then\n                # \"i\".\n                def bypath(ainfo):\n                    path, order, i = ainfo[2]['includepath'], ainfo[0], ainfo[1]\n                    return path, order, i\n    \n                ainfos.sort(key=bypath)\n                ainfo, rest = ainfos[0], ainfos[1:]\n                output.append(ainfo)\n                _, _, action = ainfo\n                basepath, baseinfo, discriminator = (\n                    action['includepath'],\n                    action['info'],\n                    action['discriminator'],\n                    )\n    \n                for _, _, action in rest:\n                    includepath = action['includepath']\n                    # Test whether path is a prefix of opath\n                    if (includepath[:len(basepath)] != basepath # not a prefix\n                        or 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_eac06005ac849b279b94149bbbf87d2aff802495/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_eac06005ac849b279b94149bbbf87d2aff802495/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_eac06005ac849b279b94149bbbf87d2aff802495/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_eac06005ac849b279b94149bbbf87d2aff802495/pyramid/tests/test_config/pkgs/selfscan/another.py:\nE                       def two(request):\n\npyramid/config/__init__.py:1199: 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:1035: 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:426: 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:1449: 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:1436: 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:1423: 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:1462: AssertionError\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]2f0a2740b20>, 'static', 'r2e_tests.test_config:files', {})] != [(<py[39 chars]2f0a2740b20>, 'static', 'pyramid.tests.test_config:files', {})]\nE       \nE       First differing element 0:\nE       (<pyr[37 chars]72f0a2740b20>, 'static', 'r2e_tests.test_config:files', {})\nE       (<pyr[37 chars]72f0a2740b20>, 'static', 'pyramid.tests.test_config:files', {})\nE       \nE         [(<pyramid.config.Configurator object at 0x72f0a2740b20>,\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:1713: 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.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:1041: 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.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:1081: AssertionError\n_____________ TestViewDeriver.test_function_returns_non_adaptable ______________\n\nself = <r2e_tests.test_config.test_views.TestViewDeriver testMethod=test_function_returns_non_adaptable>\n\n    def test_function_returns_non_adaptable(self):\n        def view(request):\n            return None\n        deriver = self._makeOne()\n        result = deriver(view)\n        self.assertFalse(result is view)\n        try:\n>           result(None, None)\n\nr2e_tests/test_config/test_views.py:2262: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\ncontext = None, request = None\n\n    def viewresult_to_response(context, request):\n        result = view(context, request)\n        if result.__class__ is Response: # common case\n            response = result\n        else:\n            response = registry.queryAdapterOrSelf(result, IResponse)\n            if response is None:\n                if result is None:\n                    append = (' You may have forgotten to return a value '\n                              'from the view callable.')\n                elif isinstance(result, dict):\n                    append = (' You may have forgotten to define a '\n                              'renderer in the view configuration.')\n                else:\n                    append = ''\n    \n                msg = ('Could not convert return value of the view '\n                       'callable %s into a response object. '\n                       'The value returned was %r.' + append)\n    \n>               raise ValueError(msg % (view_description(view), result))\nE               ValueError: Could not convert return value of the view callable function r2e_tests.test_config.test_views.view into a response object. The value returned was None. You may have forgotten to return a value from the view callable.\n\npyramid/config/views.py:396: ValueError\n\nDuring handling of the above exception, another exception occurred:\n\nself = <r2e_tests.test_config.test_views.TestViewDeriver testMethod=test_function_returns_non_adaptable>\n\n    def test_function_returns_non_adaptable(self):\n        def view(request):\n            return None\n        deriver = self._makeOne()\n        result = deriver(view)\n        self.assertFalse(result is view)\n        try:\n            result(None, None)\n        except ValueError as e:\n>           self.assertEqual(\n                e.args[0],\n                'Could not convert return value of the view callable function '\n                'pyramid.tests.test_config.test_views.view into a response '\n                'object. The value returned was None. You may have forgotten '\n                'to return a value from the view callable.'\n                )\nE           AssertionError: 'Coul[52 chars]tion r2e_tests.test_config.test_views.view int[110 chars]ble.' != 'Coul[52 chars]tion pyramid.tests.test_config.test_views.view[114 chars]ble.'\nE           Diff is 663 characters long. Set self.maxDiff to None to see it.\n\nr2e_tests/test_config/test_views.py:2264: AssertionError\n___________ TestViewDeriver.test_function_returns_non_adaptable_dict ___________\n\nself = <r2e_tests.test_config.test_views.TestViewDeriver testMethod=test_function_returns_non_adaptable_dict>\n\n    def test_function_returns_non_adaptable_dict(self):\n        def view(request):\n            return {'a':1}\n        deriver = self._makeOne()\n        result = deriver(view)\n        self.assertFalse(result is view)\n        try:\n>           result(None, None)\n\nr2e_tests/test_config/test_views.py:2281: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\ncontext = None, request = None\n\n    def viewresult_to_response(context, request):\n        result = view(context, request)\n        if result.__class__ is Response: # common case\n            response = result\n        else:\n            response = registry.queryAdapterOrSelf(result, IResponse)\n            if response is None:\n                if result is None:\n                    append = (' You may have forgotten to return a value '\n                              'from the view callable.')\n                elif isinstance(result, dict):\n                    append = (' You may have forgotten to define a '\n                              'renderer in the view configuration.')\n                else:\n                    append = ''\n    \n                msg = ('Could not convert return value of the view '\n                       'callable %s into a response object. '\n                       'The value returned was %r.' + append)\n    \n>               raise ValueError(msg % (view_description(view), result))\nE               ValueError: Could not convert return value of the view callable function r2e_tests.test_config.test_views.view into a response object. The value returned was {'a': 1}. You may have forgotten to define a renderer in the view configuration.\n\npyramid/config/views.py:396: ValueError\n\nDuring handling of the above exception, another exception occurred:\n\nself = <r2e_tests.test_config.test_views.TestViewDeriver testMethod=test_function_returns_non_adaptable_dict>\n\n    def test_function_returns_non_adaptable_dict(self):\n        def view(request):\n            return {'a':1}\n        deriver = self._makeOne()\n        result = deriver(view)\n        self.assertFalse(result is view)\n        try:\n            result(None, None)\n        except ValueError as e:\n>           self.assertEqual(\n                e.args[0],\n                \"Could not convert return value of the view callable function \"\n                \"pyramid.tests.test_config.test_views.view into a response \"\n                \"object. The value returned was {'a': 1}. You may have \"\n                \"forgotten to define a renderer in the view configuration.\"\n                )\nE           AssertionError: \"Coul[52 chars]tion r2e_tests.test_config.test_views.view int[120 chars]ion.\" != \"Coul[52 chars]tion pyramid.tests.test_config.test_views.view[124 chars]ion.\"\nE           Diff is 683 characters long. Set self.maxDiff to None to see it.\n\nr2e_tests/test_config/test_views.py:2283: AssertionError\n_____________ TestViewDeriver.test_instance_returns_non_adaptable ______________\n\nself = <r2e_tests.test_config.test_views.TestViewDeriver testMethod=test_instance_returns_non_adaptable>\n\n    def test_instance_returns_non_adaptable(self):\n        class AView(object):\n            def __call__(self, request):\n                return None\n        view = AView()\n        deriver = self._makeOne()\n        result = deriver(view)\n        self.assertFalse(result is view)\n        try:\n>           result(None, None)\n\nr2e_tests/test_config/test_views.py:2302: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\ncontext = None, request = None\n\n    def viewresult_to_response(context, request):\n        result = view(context, request)\n        if result.__class__ is Response: # common case\n            response = result\n        else:\n            response = registry.queryAdapterOrSelf(result, IResponse)\n            if response is None:\n                if result is None:\n                    append = (' You may have forgotten to return a value '\n                              'from the view callable.')\n                elif isinstance(result, dict):\n                    append = (' You may have forgotten to define a '\n                              'renderer in the view configuration.')\n                else:\n                    append = ''\n    \n                msg = ('Could not convert return value of the view '\n                       'callable %s into a response object. '\n                       'The value returned was %r.' + append)\n    \n>               raise ValueError(msg % (view_description(view), result))\nE               ValueError: Could not convert return value of the view callable object <r2e_tests.test_config.test_views.TestViewDeriver.test_instance_returns_non_adaptable.<locals>.AView object at 0x72f0a2408ca0> into a response object. The value returned was None. You may have forgotten to return a value from the view callable.\n\npyramid/config/views.py:396: ValueError\n\nDuring handling of the above exception, another exception occurred:\n\nself = <r2e_tests.test_config.test_views.TestViewDeriver testMethod=test_instance_returns_non_adaptable>\n\n    def test_instance_returns_non_adaptable(self):\n        class AView(object):\n            def __call__(self, request):\n                return None\n        view = AView()\n        deriver = self._makeOne()\n        result = deriver(view)\n        self.assertFalse(result is view)\n        try:\n            result(None, None)\n        except ValueError as e:\n            msg = e.args[0]\n>           self.assertTrue(msg.startswith(\n                'Could not convert return value of the view callable object '\n                '<pyramid.tests.test_config.test_views.'))\nE           AssertionError: False is not true\n\nr2e_tests/test_config/test_views.py:2305: AssertionError\n____ TestViewDeriver.test_requestonly_default_method_returns_non_adaptable _____\n\nself = <r2e_tests.test_config.test_views.TestViewDeriver testMethod=test_requestonly_default_method_returns_non_adaptable>\n\n    def test_requestonly_default_method_returns_non_adaptable(self):\n        request = DummyRequest()\n        class AView(object):\n            def __init__(self, request):\n                pass\n            def __call__(self):\n                return None\n        deriver = self._makeOne()\n        result = deriver(AView)\n        self.assertFalse(result is AView)\n        try:\n>           result(None, request)\n\nr2e_tests/test_config/test_views.py:2348: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\ncontext = None\nrequest = <r2e_tests.test_config.test_views.DummyRequest object at 0x72f0a26db400>\n\n    def viewresult_to_response(context, request):\n        result = view(context, request)\n        if result.__class__ is Response: # common case\n            response = result\n        else:\n            response = registry.queryAdapterOrSelf(result, IResponse)\n            if response is None:\n                if result is None:\n                    append = (' You may have forgotten to return a value '\n                              'from the view callable.')\n                elif isinstance(result, dict):\n                    append = (' You may have forgotten to define a '\n                              'renderer in the view configuration.')\n                else:\n                    append = ''\n    \n                msg = ('Could not convert return value of the view '\n                       'callable %s into a response object. '\n                       'The value returned was %r.' + append)\n    \n>               raise ValueError(msg % (view_description(view), result))\nE               ValueError: Could not convert return value of the view callable method __call__ of class r2e_tests.test_config.test_views.AView into a response object. The value returned was None. You may have forgotten to return a value from the view callable.\n\npyramid/config/views.py:396: ValueError\n\nDuring handling of the above exception, another exception occurred:\n\nself = <r2e_tests.test_config.test_views.TestViewDeriver testMethod=test_requestonly_default_method_returns_non_adaptable>\n\n    def test_requestonly_default_method_returns_non_adaptable(self):\n        request = DummyRequest()\n        class AView(object):\n            def __init__(self, request):\n                pass\n            def __call__(self):\n                return None\n        deriver = self._makeOne()\n        result = deriver(AView)\n        self.assertFalse(result is AView)\n        try:\n            result(None, request)\n        except ValueError as e:\n>           self.assertEqual(\n                e.args[0],\n                'Could not convert return value of the view callable '\n                'method __call__ of '\n                'class pyramid.tests.test_config.test_views.AView into a '\n                'response object. The value returned was None. You may have '\n                'forgotten to return a value from the view callable.'\n                )\nE           AssertionError: 'Coul[68 chars]lass r2e_tests.test_config.test_views.AView in[111 chars]ble.' != 'Coul[68 chars]lass pyramid.tests.test_config.test_views.AVie[115 chars]ble.'\nE           Diff is 649 characters long. Set self.maxDiff to None to see it.\n\nr2e_tests/test_config/test_views.py:2350: AssertionError\n___ TestViewDeriver.test_requestonly_nondefault_method_returns_non_adaptable ___\n\nself = <r2e_tests.test_config.test_views.TestViewDeriver testMethod=test_requestonly_nondefault_method_returns_non_adaptable>\n\n    def test_requestonly_nondefault_method_returns_non_adaptable(self):\n        request = DummyRequest()\n        class AView(object):\n            def __init__(self, request):\n                pass\n            def theviewmethod(self):\n                return None\n        deriver = self._makeOne(attr='theviewmethod')\n        result = deriver(AView)\n        self.assertFalse(result is AView)\n        try:\n>           result(None, request)\n\nr2e_tests/test_config/test_views.py:2372: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\ncontext = None\nrequest = <r2e_tests.test_config.test_views.DummyRequest object at 0x72f0a22f3850>\n\n    def viewresult_to_response(context, request):\n        result = view(context, request)\n        if result.__class__ is Response: # common case\n            response = result\n        else:\n            response = registry.queryAdapterOrSelf(result, IResponse)\n            if response is None:\n                if result is None:\n                    append = (' You may have forgotten to return a value '\n                              'from the view callable.')\n                elif isinstance(result, dict):\n                    append = (' You may have forgotten to define a '\n                              'renderer in the view configuration.')\n                else:\n                    append = ''\n    \n                msg = ('Could not convert return value of the view '\n                       'callable %s into a response object. '\n                       'The value returned was %r.' + append)\n    \n>               raise ValueError(msg % (view_description(view), result))\nE               ValueError: Could not convert return value of the view callable method theviewmethod of class r2e_tests.test_config.test_views.AView into a response object. The value returned was None. You may have forgotten to return a value from the view callable.\n\npyramid/config/views.py:396: ValueError\n\nDuring handling of the above exception, another exception occurred:\n\nself = <r2e_tests.test_config.test_views.TestViewDeriver testMethod=test_requestonly_nondefault_method_returns_non_adaptable>\n\n    def test_requestonly_nondefault_method_returns_non_adaptable(self):\n        request = DummyRequest()\n        class AView(object):\n            def __init__(self, request):\n                pass\n            def theviewmethod(self):\n                return None\n        deriver = self._makeOne(attr='theviewmethod')\n        result = deriver(AView)\n        self.assertFalse(result is AView)\n        try:\n            result(None, request)\n        except ValueError as e:\n>           self.assertEqual(\n                e.args[0],\n                'Could not convert return value of the view callable '\n                'method theviewmethod of '\n                'class pyramid.tests.test_config.test_views.AView into a '\n                'response object. The value returned was None. You may have '\n                'forgotten to return a value from the view callable.'\n                )\nE           AssertionError: 'Coul[73 chars]lass r2e_tests.test_config.test_views.AView in[111 chars]ble.' != 'Coul[73 chars]lass pyramid.tests.test_config.test_views.AVie[115 chars]ble.'\nE           Diff is 669 characters long. Set self.maxDiff to None to see it.\n\nr2e_tests/test_config/test_views.py:2374: 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:3841: AssertionError\n_______________ TestPRequestCommand.test_command_display_headers _______________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_display_headers>\n\n    def test_command_display_headers(self):\n        command = self._makeOne(\n            ['', '--display-headers', 'development.ini', '/'])\n        command.run()\n        self.assertEqual(self._path_info, '/')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(\n            self._out,\n            ['200 OK', 'Content-Type: text/html; charset=UTF-8', 'abc'])\nE       AssertionError: Lists differ: ['200 OK', b'abc'] != ['200 OK', 'Content-Type: text/html; charset=UTF-8', 'abc']\nE       \nE       First differing element 1:\nE       b'abc'\nE       'Content-Type: text/html; charset=UTF-8'\nE       \nE       Second list contains 1 additional elements.\nE       First extra element 2:\nE       'abc'\nE       \nE       - ['200 OK', b'abc']\nE       + ['200 OK', 'Content-Type: text/html; charset=UTF-8', 'abc']\n\nr2e_tests/test_scripts/test_prequest.py:202: AssertionError\n_________ TestPRequestCommand.test_command_has_content_type_header_var _________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_has_content_type_header_var>\n\n    def test_command_has_content_type_header_var(self):\n        command = self._makeOne(\n            ['', '--header=content-type:app/foo','development.ini', '/'])\n        command.run()\n        self.assertEqual(self._environ['CONTENT_TYPE'], 'app/foo')\n        self.assertEqual(self._path_info, '/')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(self._out, ['abc'])\nE       AssertionError: Lists differ: [b'abc'] != ['abc']\nE       \nE       First differing element 0:\nE       b'abc'\nE       'abc'\nE       \nE       - [b'abc']\nE       ?  -\nE       \nE       + ['abc']\n\nr2e_tests/test_scripts/test_prequest.py:92: AssertionError\n_____________ TestPRequestCommand.test_command_has_good_header_var _____________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_has_good_header_var>\n\n    def test_command_has_good_header_var(self):\n        command = self._makeOne(\n            ['', '--header=name:value','development.ini', '/'])\n        command.run()\n        self.assertEqual(self._environ['HTTP_NAME'], 'value')\n        self.assertEqual(self._path_info, '/')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(self._out, ['abc'])\nE       AssertionError: Lists differ: [b'abc'] != ['abc']\nE       \nE       First differing element 0:\nE       b'abc'\nE       'abc'\nE       \nE       - [b'abc']\nE       ?  -\nE       \nE       + ['abc']\n\nr2e_tests/test_scripts/test_prequest.py:69: AssertionError\n__________ TestPRequestCommand.test_command_has_multiple_header_vars ___________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_has_multiple_header_vars>\n\n    def test_command_has_multiple_header_vars(self):\n        command = self._makeOne(\n            ['',\n             '--header=name:value',\n             '--header=name2:value2',\n             'development.ini',\n             '/'])\n        command.run()\n        self.assertEqual(self._environ['HTTP_NAME'], 'value')\n        self.assertEqual(self._environ['HTTP_NAME2'], 'value2')\n        self.assertEqual(self._path_info, '/')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(self._out, ['abc'])\nE       AssertionError: Lists differ: [b'abc'] != ['abc']\nE       \nE       First differing element 0:\nE       b'abc'\nE       'abc'\nE       \nE       - [b'abc']\nE       ?  -\nE       \nE       + ['abc']\n\nr2e_tests/test_scripts/test_prequest.py:107: AssertionError\n_________________ TestPRequestCommand.test_command_method_get __________________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_method_get>\n\n    def test_command_method_get(self):\n        command = self._makeOne(['', '--method=GET', 'development.ini', '/'])\n        command.run()\n        self.assertEqual(self._environ['REQUEST_METHOD'], 'GET')\n        self.assertEqual(self._path_info, '/')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(self._out, ['abc'])\nE       AssertionError: Lists differ: [b'abc'] != ['abc']\nE       \nE       First differing element 0:\nE       b'abc'\nE       'abc'\nE       \nE       - [b'abc']\nE       ?  -\nE       \nE       + ['abc']\n\nr2e_tests/test_scripts/test_prequest.py:116: AssertionError\n_______________ TestPRequestCommand.test_command_method_options ________________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_method_options>\n\n    def test_command_method_options(self):\n        from pyramid.compat import NativeIO\n        command = self._makeOne(['', '--method=OPTIONS', 'development.ini',\n                                '/'])\n        stdin = NativeIO()\n        command.stdin = stdin\n        command.run()\n        self.assertEqual(self._environ['REQUEST_METHOD'], 'OPTIONS')\n        self.assertEqual(self._path_info, '/')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(self._out, ['abc'])\nE       AssertionError: Lists differ: [b'abc'] != ['abc']\nE       \nE       First differing element 0:\nE       b'abc'\nE       'abc'\nE       \nE       - [b'abc']\nE       ?  -\nE       \nE       + ['abc']\n\nr2e_tests/test_scripts/test_prequest.py:184: AssertionError\n________________ TestPRequestCommand.test_command_method_patch _________________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_method_patch>\n\n    def test_command_method_patch(self):\n        from pyramid.compat import NativeIO\n        command = self._makeOne(['', '--method=PATCH', 'development.ini', '/'])\n        stdin = NativeIO()\n        command.stdin = stdin\n        command.run()\n        self.assertEqual(self._environ['REQUEST_METHOD'], 'PATCH')\n        self.assertEqual(self._environ['CONTENT_LENGTH'], '-1')\n        self.assertEqual(self._environ['wsgi.input'], stdin)\n        self.assertEqual(self._path_info, '/')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(self._out, ['abc'])\nE       AssertionError: Lists differ: [b'abc'] != ['abc']\nE       \nE       First differing element 0:\nE       b'abc'\nE       'abc'\nE       \nE       - [b'abc']\nE       ?  -\nE       \nE       + ['abc']\n\nr2e_tests/test_scripts/test_prequest.py:158: AssertionError\n_________________ TestPRequestCommand.test_command_method_post _________________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_method_post>\n\n    def test_command_method_post(self):\n        from pyramid.compat import NativeIO\n        command = self._makeOne(['', '--method=POST', 'development.ini', '/'])\n        stdin = NativeIO()\n        command.stdin = stdin\n        command.run()\n        self.assertEqual(self._environ['REQUEST_METHOD'], 'POST')\n        self.assertEqual(self._environ['CONTENT_LENGTH'], '-1')\n        self.assertEqual(self._environ['wsgi.input'], stdin)\n        self.assertEqual(self._path_info, '/')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(self._out, ['abc'])\nE       AssertionError: Lists differ: [b'abc'] != ['abc']\nE       \nE       First differing element 0:\nE       b'abc'\nE       'abc'\nE       \nE       - [b'abc']\nE       ?  -\nE       \nE       + ['abc']\n\nr2e_tests/test_scripts/test_prequest.py:130: AssertionError\n_______________ TestPRequestCommand.test_command_method_propfind _______________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_method_propfind>\n\n    def test_command_method_propfind(self):\n        from pyramid.compat import NativeIO\n        command = self._makeOne(['', '--method=PROPFIND', 'development.ini',\n                                '/'])\n        stdin = NativeIO()\n        command.stdin = stdin\n        command.run()\n        self.assertEqual(self._environ['REQUEST_METHOD'], 'PROPFIND')\n        self.assertEqual(self._path_info, '/')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(self._out, ['abc'])\nE       AssertionError: Lists differ: [b'abc'] != ['abc']\nE       \nE       First differing element 0:\nE       b'abc'\nE       'abc'\nE       \nE       - [b'abc']\nE       ?  -\nE       \nE       + ['abc']\n\nr2e_tests/test_scripts/test_prequest.py:171: AssertionError\n_________________ TestPRequestCommand.test_command_method_put __________________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_method_put>\n\n    def test_command_method_put(self):\n        from pyramid.compat import NativeIO\n        command = self._makeOne(['', '--method=PUT', 'development.ini', '/'])\n        stdin = NativeIO()\n        command.stdin = stdin\n        command.run()\n        self.assertEqual(self._environ['REQUEST_METHOD'], 'PUT')\n        self.assertEqual(self._environ['CONTENT_LENGTH'], '-1')\n        self.assertEqual(self._environ['wsgi.input'], stdin)\n        self.assertEqual(self._path_info, '/')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(self._out, ['abc'])\nE       AssertionError: Lists differ: [b'abc'] != ['abc']\nE       \nE       First differing element 0:\nE       b'abc'\nE       'abc'\nE       \nE       - [b'abc']\nE       ?  -\nE       \nE       + ['abc']\n\nr2e_tests/test_scripts/test_prequest.py:144: AssertionError\n________ TestPRequestCommand.test_command_path_doesnt_start_with_slash _________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_path_doesnt_start_with_slash>\n\n    def test_command_path_doesnt_start_with_slash(self):\n        command = self._makeOne(['', 'development.ini', 'abc'])\n        command.run()\n        self.assertEqual(self._path_info, '/abc')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(self._out, ['abc'])\nE       AssertionError: Lists differ: [b'abc'] != ['abc']\nE       \nE       First differing element 0:\nE       b'abc'\nE       'abc'\nE       \nE       - [b'abc']\nE       ?  -\nE       \nE       + ['abc']\n\nr2e_tests/test_scripts/test_prequest.py:50: AssertionError\n__________________ TestPRequestCommand.test_command_two_args ___________________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_two_args>\n\n    def test_command_two_args(self):\n        command = self._makeOne(['', 'development.ini', '/'])\n        command.run()\n        self.assertEqual(self._path_info, '/')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(self._out, ['abc'])\nE       AssertionError: Lists differ: [b'abc'] != ['abc']\nE       \nE       First differing element 0:\nE       b'abc'\nE       'abc'\nE       \nE       - [b'abc']\nE       ?  -\nE       \nE       + ['abc']\n\nr2e_tests/test_scripts/test_prequest.py:42: AssertionError\n________________ TestPRequestCommand.test_command_w_basic_auth _________________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_w_basic_auth>\n\n    def test_command_w_basic_auth(self):\n        command = self._makeOne(\n            ['', '--login=user:password',\n                 '--header=name:value','development.ini', '/'])\n        command.run()\n        self.assertEqual(self._environ['HTTP_NAME'], 'value')\n        self.assertEqual(self._environ['HTTP_AUTHORIZATION'],\n                        'Basic dXNlcjpwYXNzd29yZA==')\n        self.assertEqual(self._path_info, '/')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(self._out, ['abc'])\nE       AssertionError: Lists differ: [b'abc'] != ['abc']\nE       \nE       First differing element 0:\nE       b'abc'\nE       'abc'\nE       \nE       - [b'abc']\nE       ?  -\nE       \nE       + ['abc']\n\nr2e_tests/test_scripts/test_prequest.py:82: AssertionError\n______________ TestPRequestCommand.test_command_with_query_string ______________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_with_query_string>\n\n    def test_command_with_query_string(self):\n        command = self._makeOne(['', 'development.ini', '/abc?a=1&b=2&c'])\n        command.run()\n        self.assertEqual(self._environ['QUERY_STRING'], 'a=1&b=2&c')\n        self.assertEqual(self._path_info, '/abc')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(self._out, ['abc'])\nE       AssertionError: Lists differ: [b'abc'] != ['abc']\nE       \nE       First differing element 0:\nE       b'abc'\nE       'abc'\nE       \nE       - [b'abc']\nE       ?  -\nE       \nE       + ['abc']\n\nr2e_tests/test_scripts/test_prequest.py:193: 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, arg2: view\n        command.args = ('/foo/bar/myapp.ini#myapp', '/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:283: AssertionError\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_get_options_no_command\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_get_options_with_command\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_parse_vars_bad\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_parse_vars_good\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_record_pid_not_verbose\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_record_pid_verbose\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_remove_pid_current_pid_is_not_pid_in_file\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_remove_pid_current_pid_is_not_written_pid\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_remove_pid_file_not_verbose\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_remove_pid_file_stale_pid_write_exception\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_remove_pid_file_unlink_exception\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_remove_pid_file_verbose\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_remove_pid_no_pid_file\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_remove_pid_not_a_number\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_run_no_args\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_run_stop_daemon_bad_pid_file\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_run_stop_daemon_invalid_pid_in_file\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_run_stop_daemon_no_such_pid_file\nPASSED r2e_tests/test_1.py::Test_read_pidfile::test_read_pidfile\nPASSED r2e_tests/test_1.py::Test_read_pidfile::test_read_pidfile_no_pid_file\nPASSED r2e_tests/test_1.py::Test_read_pidfile::test_read_pidfile_not_a_number\nPASSED r2e_tests/test_1.py::Test_main::test_it\nPASSED r2e_tests/test_1.py::TestLazyWriter::test_flush\nPASSED r2e_tests/test_1.py::TestLazyWriter::test_open\nPASSED r2e_tests/test_1.py::TestLazyWriter::test_write\nPASSED r2e_tests/test_1.py::TestLazyWriter::test_writeline\nPASSED r2e_tests/test_1.py::Test__methodwrapper::test___call__fail\nPASSED r2e_tests/test_1.py::Test__methodwrapper::test___call__succeed\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_directory\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_directory_with_package\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_file\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_directory\nPASSED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_package_with_package\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_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_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::TestPackageOverrides::test_search_path\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_unnamed_callable\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_multiple_request_properties\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_multiple_request_properties_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_request_property_with_callable\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_request_property_with_property\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_request_property_with_unnamed_callable\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_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_add_translation_dirs_registers_chameleon_translate\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_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_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_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_renderer_globals_factory\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_renderer_globals_factory_dottedname\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_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::TestConfiguratorDeprecatedFeatures::test_add_route_with_for_\nPASSED r2e_tests/test_config/test_init.py::TestConfiguratorDeprecatedFeatures::test_add_route_with_view\nPASSED r2e_tests/test_config/test_init.py::TestConfiguratorDeprecatedFeatures::test_add_route_with_view_attr\nPASSED r2e_tests/test_config/test_init.py::TestConfiguratorDeprecatedFeatures::test_add_route_with_view_context\nPASSED r2e_tests/test_config/test_init.py::TestConfiguratorDeprecatedFeatures::test_add_route_with_view_exception\nPASSED r2e_tests/test_config/test_init.py::TestConfiguratorDeprecatedFeatures::test_add_route_with_view_for\nPASSED r2e_tests/test_config/test_init.py::TestConfiguratorDeprecatedFeatures::test_add_route_with_view_permission\nPASSED r2e_tests/test_config/test_init.py::TestConfiguratorDeprecatedFeatures::test_add_route_with_view_permission_alias\nPASSED r2e_tests/test_config/test_init.py::TestConfiguratorDeprecatedFeatures::test_add_route_with_view_renderer\nPASSED r2e_tests/test_config/test_init.py::TestConfiguratorDeprecatedFeatures::test_add_route_with_view_renderer_alias\nPASSED r2e_tests/test_config/test_init.py::TestConfiguratorDeprecatedFeatures::test_conflict_route_with_view\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::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_it\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_processSpec\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::TestGlobalRegistriesIntegration::test_global_registries\nPASSED r2e_tests/test_config/test_init.py::TestGlobalRegistriesIntegration::test_global_registries_empty\nPASSED r2e_tests/test_config/test_predicates.py::TestXHRPredicate::test___call___false\nPASSED r2e_tests/test_config/test_predicates.py::TestXHRPredicate::test___call___true\nPASSED r2e_tests/test_config/test_predicates.py::TestXHRPredicate::test_phash\nPASSED r2e_tests/test_config/test_predicates.py::TestXHRPredicate::test_text\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestMethodPredicate::test___call___false\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestMethodPredicate::test___call___true_multi\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestMethodPredicate::test___call___true_single\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestMethodPredicate::test_ctor_get_but_no_head\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestMethodPredicate::test_phash\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestMethodPredicate::test_text\nPASSED r2e_tests/test_config/test_predicates.py::TestPathInfoPredicate::test___call___false\nPASSED r2e_tests/test_config/test_predicates.py::TestPathInfoPredicate::test___call___true\nPASSED r2e_tests/test_config/test_predicates.py::TestPathInfoPredicate::test_ctor_compilefail\nPASSED r2e_tests/test_config/test_predicates.py::TestPathInfoPredicate::test_phash\nPASSED r2e_tests/test_config/test_predicates.py::TestPathInfoPredicate::test_text\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestParamPredicate::test___call___false\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestParamPredicate::test___call___false_multi\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestParamPredicate::test___call___true_exists\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestParamPredicate::test___call___true_multi\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestParamPredicate::test___call___true_withval\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestParamPredicate::test_phash_exists\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestParamPredicate::test_phash_withval\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestParamPredicate::test_text_exists\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestParamPredicate::test_text_multi\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestParamPredicate::test_text_withval\nPASSED r2e_tests/test_config/test_predicates.py::TestMatchParamPredicate::test___call___false\nPASSED r2e_tests/test_config/test_predicates.py::TestMatchParamPredicate::test___call___matchdict_is_None\nPASSED r2e_tests/test_config/test_predicates.py::TestMatchParamPredicate::test___call___true_multi\nPASSED r2e_tests/test_config/test_predicates.py::TestMatchParamPredicate::test___call___true_single\nPASSED r2e_tests/test_config/test_predicates.py::TestMatchParamPredicate::test_phash\nPASSED r2e_tests/test_config/test_predicates.py::TestMatchParamPredicate::test_text\nPASSED r2e_tests/test_config/test_predicates.py::TestCustomPredicate::test___call___false\nPASSED r2e_tests/test_config/test_predicates.py::TestCustomPredicate::test___call___true\nPASSED r2e_tests/test_config/test_predicates.py::TestCustomPredicate::test_phash\nPASSED r2e_tests/test_config/test_predicates.py::TestCustomPredicate::test_text_func_has___text__\nPASSED r2e_tests/test_config/test_predicates.py::TestCustomPredicate::test_text_func_repr\nPASSED r2e_tests/test_config/test_predicates.py::TestTraversePredicate::test___call__traverse_has_remainder_already\nPASSED r2e_tests/test_config/test_predicates.py::TestTraversePredicate::test___call__traverse_matches\nPASSED r2e_tests/test_config/test_predicates.py::TestTraversePredicate::test___call__traverse_matches_with_highorder_chars\nPASSED r2e_tests/test_config/test_predicates.py::TestTraversePredicate::test_phash\nPASSED r2e_tests/test_config/test_predicates.py::TestTraversePredicate::test_text\nPASSED r2e_tests/test_config/test_predicates.py::Test_CheckCSRFTokenPredicate::test_it_call_val_False\nPASSED r2e_tests/test_config/test_predicates.py::Test_CheckCSRFTokenPredicate::test_it_call_val_True\nPASSED r2e_tests/test_config/test_predicates.py::Test_CheckCSRFTokenPredicate::test_it_call_val_str\nPASSED r2e_tests/test_config/test_predicates.py::Test_CheckCSRFTokenPredicate::test_phash\nPASSED r2e_tests/test_config/test_predicates.py::Test_CheckCSRFTokenPredicate::test_text\nPASSED r2e_tests/test_config/test_predicates.py::TestHeaderPredicate::test___call___false\nPASSED r2e_tests/test_config/test_predicates.py::TestHeaderPredicate::test___call___false_withregex\nPASSED r2e_tests/test_config/test_predicates.py::TestHeaderPredicate::test___call___true_exists\nPASSED r2e_tests/test_config/test_predicates.py::TestHeaderPredicate::test___call___true_withregex\nPASSED r2e_tests/test_config/test_predicates.py::TestHeaderPredicate::test___call___true_withval\nPASSED r2e_tests/test_config/test_predicates.py::TestHeaderPredicate::test_phash_exists\nPASSED r2e_tests/test_config/test_predicates.py::TestHeaderPredicate::test_phash_withregex\nPASSED r2e_tests/test_config/test_predicates.py::TestHeaderPredicate::test_phash_withval\nPASSED r2e_tests/test_config/test_predicates.py::TestHeaderPredicate::test_text_exists\nPASSED r2e_tests/test_config/test_predicates.py::TestHeaderPredicate::test_text_withregex\nPASSED r2e_tests/test_config/test_predicates.py::TestHeaderPredicate::test_text_withval\nPASSED r2e_tests/test_config/test_predicates.py::Test_PhysicalPathPredicate::test_it_call_False\nPASSED r2e_tests/test_config/test_predicates.py::Test_PhysicalPathPredicate::test_it_call_context_has_no_name\nPASSED r2e_tests/test_config/test_predicates.py::Test_PhysicalPathPredicate::test_it_call_val_list_True\nPASSED r2e_tests/test_config/test_predicates.py::Test_PhysicalPathPredicate::test_it_call_val_str_True\nPASSED r2e_tests/test_config/test_predicates.py::Test_PhysicalPathPredicate::test_it_call_val_tuple_True\nPASSED r2e_tests/test_config/test_predicates.py::Test_PhysicalPathPredicate::test_phash\nPASSED r2e_tests/test_config/test_predicates.py::Test_PhysicalPathPredicate::test_text\nPASSED r2e_tests/test_config/test_predicates.py::Test_EffectivePrincipalsPredicate::test_it_call_authentication_policy_doesnt_provide_superset\nPASSED r2e_tests/test_config/test_predicates.py::Test_EffectivePrincipalsPredicate::test_it_call_authentication_policy_provides_superset\nPASSED r2e_tests/test_config/test_predicates.py::Test_EffectivePrincipalsPredicate::test_it_call_authentication_policy_provides_superset_implicit\nPASSED r2e_tests/test_config/test_predicates.py::Test_EffectivePrincipalsPredicate::test_it_call_no_authentication_policy\nPASSED r2e_tests/test_config/test_predicates.py::Test_EffectivePrincipalsPredicate::test_phash\nPASSED r2e_tests/test_config/test_predicates.py::Test_EffectivePrincipalsPredicate::test_text\nPASSED r2e_tests/test_config/test_predicates.py::Test_EffectivePrincipalsPredicate::test_text_noniter\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_rendering.py::TestRenderingConfiguratorMixin::test_set_renderer_globals_factory\nPASSED r2e_tests/test_config/test_rendering.py::TestRenderingConfiguratorMixin::test_set_renderer_globals_factory_dottedname\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_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_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_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::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_getattr_fail\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_getattr_raises_attribute_error\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_getattr_success\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_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_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_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_http_cache\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_with_renderer\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_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_http_cache\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_with_renderer\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_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_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_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_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_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_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_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::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::TestViewDeriver::test_as_function_context_and_request\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_as_function_requestonly\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_as_instance_context_and_request\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_as_instance_context_and_request_attr_and_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_as_instance_requestonly\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_as_instance_requestonly_attr_and_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_as_newstyle_class_context_and_request\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_as_newstyle_class_context_and_request_attr_and_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_as_newstyle_class_requestonly\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_as_newstyle_class_requestonly_attr_and_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_as_oldstyle_class_context_and_request\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_as_oldstyle_class_requestonly\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_as_oldstyle_cls_context_request_attr_and_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_as_oldstyle_cls_requestonly_attr_and_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_attr_wrapped_view_branching_default_phash\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_attr_wrapped_view_branching_nondefault_phash\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_class_with_attr\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_class_without_attr\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_debug_auth_permission_authpol_denied\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_debug_auth_permission_authpol_denied2\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_debug_auth_permission_authpol_overridden\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_debug_auth_permission_authpol_permitted\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_debug_auth_permission_authpol_permitted_no_request\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_function_returns_true_Response_no_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_function_returns_true_Response_with_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_http_cached_prevent_http_cache_in_settings\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_http_cached_view_bad_tuple\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_http_cached_view_integer\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_http_cached_view_prevent_auto_set\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_http_cached_view_timedelta\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_http_cached_view_tuple\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_http_cached_view_tuple_seconds_None\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_predicate_mismatch_exception_has_text_in_detail\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_predicate_mismatch_view_has_name\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_predicate_mismatch_view_has_no_name\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_requestonly_function\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_requestonly_function_with_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_requestonly_function_with_renderer_request_has_view\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_requestonly_function_with_renderer_request_override\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_secured_view_authn_policy_no_authz_policy\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_secured_view_authz_policy_no_authn_policy\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_secured_view_raises_forbidden_no_name\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_secured_view_raises_forbidden_with_name\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_with_debug_authorization_authn_policy_no_authz_policy\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_with_debug_authorization_authz_policy_no_authn_policy\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_with_debug_authorization_no_authpol\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_with_debug_authorization_no_permission\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_with_predicates_all\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_with_predicates_checker\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_with_predicates_notall\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_with_view_mapper_config_specified\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_with_view_mapper_default_mapper_specified\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_with_view_mapper_view_specified\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_with_wrapper_viewname\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_with_wrapper_viewname_notfound\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_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_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_add_viewname_with_view_attr\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_viewname_with_view_context\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_viewname_with_view_for\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_viewname_with_view_permission\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_viewname_with_view_renderer\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_registration_no_registry_on_request\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_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_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::Test_logging_file_config::test_it\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_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_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_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_unknown_scaffold_name\nPASSED r2e_tests/test_scripts/test_pcreate.py::Test_main::test_it\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_not_enough_args\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_response_has_no_charset\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_good_args\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_with_no_slash_prefix\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\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::Test_main::test_it\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_get_options_no_command\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_get_options_with_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_record_pid_not_verbose\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_record_pid_verbose\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_remove_pid_current_pid_is_not_pid_in_file\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_remove_pid_current_pid_is_not_written_pid\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_remove_pid_file_not_verbose\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_remove_pid_file_stale_pid_write_exception\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_remove_pid_file_unlink_exception\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_remove_pid_file_verbose\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_remove_pid_no_pid_file\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_remove_pid_not_a_number\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_run_no_args\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_run_stop_daemon_bad_pid_file\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_run_stop_daemon_invalid_pid_in_file\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_run_stop_daemon_no_such_pid_file\nPASSED r2e_tests/test_scripts/test_pserve.py::Test_read_pidfile::test_read_pidfile\nPASSED r2e_tests/test_scripts/test_pserve.py::Test_read_pidfile::test_read_pidfile_no_pid_file\nPASSED r2e_tests/test_scripts/test_pserve.py::Test_read_pidfile::test_read_pidfile_not_a_number\nPASSED r2e_tests/test_scripts/test_pserve.py::Test_main::test_it\nPASSED r2e_tests/test_scripts/test_pserve.py::TestLazyWriter::test_flush\nPASSED r2e_tests/test_scripts/test_pserve.py::TestLazyWriter::test_open\nPASSED r2e_tests/test_scripts/test_pserve.py::TestLazyWriter::test_write\nPASSED r2e_tests/test_scripts/test_pserve.py::TestLazyWriter::test_writeline\nPASSED r2e_tests/test_scripts/test_pserve.py::Test__methodwrapper::test___call__fail\nPASSED r2e_tests/test_scripts/test_pserve.py::Test__methodwrapper::test___call__succeed\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_loads_bpython_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_default_shell_with_unknown_shell\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_command_loads_ipython_v0_10\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_command_loads_ipython_v0_11\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_make_bpython_shell\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_make_default_shell\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_make_ipython_v0_10_shell\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_make_ipython_v0_11_shell\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_shell_ipython_ordering\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_shell_ordering\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_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::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::TestPackageOverrides::test_get_filename\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_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_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_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_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::TestViewDeriver::test_function_returns_non_adaptable\nFAILED r2e_tests/test_config/test_views.py::TestViewDeriver::test_function_returns_non_adaptable_dict\nFAILED r2e_tests/test_config/test_views.py::TestViewDeriver::test_instance_returns_non_adaptable\nFAILED r2e_tests/test_config/test_views.py::TestViewDeriver::test_requestonly_default_method_returns_non_adaptable\nFAILED r2e_tests/test_config/test_views.py::TestViewDeriver::test_requestonly_nondefault_method_returns_non_adaptable\nFAILED r2e_tests/test_config/test_views.py::Test_view_description::test_without_text\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_display_headers\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_has_content_type_header_var\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_has_good_header_var\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_has_multiple_header_vars\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_method_get\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_method_options\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_method_patch\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_method_post\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_method_propfind\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_method_put\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_path_doesnt_start_with_slash\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_two_args\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_w_basic_auth\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_with_query_string\nFAILED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test_views_command_single_view_function_traversal\n======================== 43 failed, 839 passed in 5.56s ========================\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_eac06005ac849b279b94149bbbf87d2aff802495\ncollected 882 items\n\nr2e_tests/test_1.py .....................F......                         [  3%]\nr2e_tests/test_config/test_adapters.py .FF..............F...             [  5%]\nr2e_tests/test_config/test_assets.py ...........FF...................... [  9%]\n.....F..........................                                         [ 13%]\nr2e_tests/test_config/test_factories.py ..................               [ 15%]\nr2e_tests/test_config/test_i18n.py FFF.FF....                            [ 16%]\nr2e_tests/test_config/test_init.py ..................................... [ 20%]\nF..F....................F...........F.................................FF [ 28%]\n...FF...................                                                 [ 31%]\nr2e_tests/test_config/test_predicates.py ............................... [ 34%]\n........................................                                 [ 39%]\nr2e_tests/test_config/test_rendering.py ....                             [ 39%]\nr2e_tests/test_config/test_routes.py ........................            [ 42%]\nr2e_tests/test_config/test_security.py ..........                        [ 43%]\nr2e_tests/test_config/test_settings.py .......................           [ 46%]\nr2e_tests/test_config/test_testing.py ............                       [ 47%]\nr2e_tests/test_config/test_tweens.py .................................   [ 51%]\nr2e_tests/test_config/test_util.py ..................................... [ 55%]\n.............                                                            [ 57%]\nr2e_tests/test_config/test_views.py ...................F................ [ 61%]\n........................................................................ [ 69%]\nFF...................................................................... [ 77%]\nFF.........F...F....F................................................... [ 85%]\n...........F                                                             [ 87%]\nr2e_tests/test_scripts/test_common.py ...                                [ 87%]\nr2e_tests/test_scripts/test_pcreate.py .........                         [ 88%]\nr2e_tests/test_scripts/test_prequest.py F.FFFFFFFFF.F.FFF.               [ 90%]\nr2e_tests/test_scripts/test_proutes.py ...........                       [ 91%]\nr2e_tests/test_scripts/test_pserve.py .....................F......       [ 94%]\nr2e_tests/test_scripts/test_pshell.py .................                  [ 96%]\nr2e_tests/test_scripts/test_ptweens.py .....                             [ 97%]\nr2e_tests/test_scripts/test_pviews.py ................F......            [100%]\n\n=================================== FAILURES ===================================\n______________________________ Test_main.test_it _______________________________\n\nself = <r2e_tests.test_1.Test_main testMethod=test_it>\n\n    def test_it(self):\n>       result = self._callFUT(['pserve'])\n\nr2e_tests/test_1.py:265: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <r2e_tests.test_1.Test_main testMethod=test_it>, argv = ['pserve']\n\n    def _callFUT(self, argv):\n        from pyramid.scripts.pserve import main\n>       return main(argv, quiet=True)\nE       TypeError: main() got an unexpected keyword argument 'quiet'\n\nr2e_tests/test_1.py:262: TypeError\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 0x70c15c48cdf0>, <r2e_tests.test_config.test_adapters.DummyIface object at 0x70c15c48cdf0>)\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 0x70c15c48cdf0>, <r2e_tests.test_config.test_adapters.DummyIface object at 0x70c15c48cdf0>), <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 0x70c15c2cb520>\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 0x70c15c2cb520>, <InterfaceClass pyramid.interfaces.ITraverser>, '')\n\n.venv/lib/python3.8/site-packages/zope/interface/registry.py:368: ComponentLookupError\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        import os\n        resource_name = 'test_assets.py'\n        import pyramid.tests.test_config\n        provider = self._makeOne(pyramid.tests.test_config)\n        here = os.path.dirname(os.path.abspath(__file__))\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]4149bbbf87d2aff802495/pyramid/tests/test_config/test_assets.py' != '/hom[73 chars]4149bbbf87d2aff802495/r2e_tests/test_config/test_assets.py'\nE       - /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495/pyramid/tests/test_config/test_assets.py\nE       ?                                                                                                    -- ^^^^^\nE       + /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495/r2e_tests/test_config/test_assets.py\nE       ?                                                                                                     ^^^\n\nr2e_tests/test_config/test_assets.py:158: 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        import os\n        resource_name = 'test_assets.py'\n        import pyramid.tests.test_config\n        provider = self._makeOne(pyramid.tests.test_config)\n        here = os.path.dirname(os.path.abspath(__file__))\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]4149bbbf87d2aff802495/pyramid/tests/test_config/test_assets.py' != '/hom[73 chars]4149bbbf87d2aff802495/r2e_tests/test_config/test_assets.py'\nE       - /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495/pyramid/tests/test_config/test_assets.py\nE       ?                                                                                                    -- ^^^^^\nE       + /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495/r2e_tests/test_config/test_assets.py\nE       ?                                                                                                     ^^^\n\nr2e_tests/test_config/test_assets.py:212: AssertionError\n____________________ TestPackageOverrides.test_get_filename ____________________\n\nself = <r2e_tests.test_config.test_assets.TestPackageOverrides testMethod=test_get_filename>\n\n    def test_get_filename(self):\n        import os\n        overrides = [ DummyOverride(None), DummyOverride(\n            ('pyramid.tests.test_config', 'test_assets.py'))]\n        package = DummyPackage('package')\n        po = self._makeOne(package)\n        po.overrides= overrides\n        here = os.path.dirname(os.path.abspath(__file__))\n        expected = os.path.join(here, 'test_assets.py')\n>       self.assertEqual(po.get_filename('whatever'), expected)\nE       AssertionError: '/hom[73 chars]4149bbbf87d2aff802495/pyramid/tests/test_config/test_assets.py' != '/hom[73 chars]4149bbbf87d2aff802495/r2e_tests/test_config/test_assets.py'\nE       - /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495/pyramid/tests/test_config/test_assets.py\nE       ?                                                                                                    -- ^^^^^\nE       + /home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495/r2e_tests/test_config/test_assets.py\nE       ?                                                                                                     ^^^\n\nr2e_tests/test_config/test_assets.py:425: 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:511: in wrapper\n    result = wrapped(self, *arg, **kw)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <pyramid.config.Configurator object at 0x70c15c988a00>\nspecs = ('/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495/r2e_tests/pkgs/localeapp/locale',)\nintrospectables = []\nspec = '/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495/r2e_tests/pkgs/localeapp/locale'\npackage_name = None\n\n    @action_method\n    def add_translation_dirs(self, *specs):\n        \"\"\" Add one or more :term:`translation directory` paths to the\n        current configuration state.  The ``specs`` argument is a\n        sequence that may contain absolute directory paths\n        (e.g. ``/usr/share/locale``) or :term:`asset specification`\n        names naming a directory path (e.g. ``some.package:locale``)\n        or a combination of the two.\n    \n        Example:\n    \n        .. code-block:: python\n    \n           config.add_translation_dirs('/usr/share/locale',\n                                       'some.package:locale')\n    \n        Later calls to ``add_translation_dir`` insert directories into the\n        beginning of the list of translation directories created by earlier\n        calls.  This means that the same translation found in a directory\n        added later in the configuration process will be found before one\n        added earlier in the configuration process.  However, if multiple\n        specs are provided in a single call to ``add_translation_dirs``, the\n        directories will be inserted into the beginning of the directory list\n        in the order they're provided in the ``*specs`` list argument (items\n        earlier in the list trump ones later in the list).\n        \"\"\"\n        directories = []\n        introspectables = []\n    \n        for spec in specs[::-1]: # reversed\n            package_name, filename = self._split_spec(spec)\n            if package_name is None: # absolute filename\n                directory = filename\n            else:\n                __import__(package_name)\n                package = sys.modules[package_name]\n                directory = os.path.join(package_path(package), filename)\n    \n            if not os.path.isdir(os.path.realpath(directory)):\n>               raise ConfigurationError('\"%s\" is not a directory' %\n                                         directory)\nE               pyramid.exceptions.ConfigurationError: \"/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495/r2e_tests/pkgs/localeapp/locale\" is not a directory\n\npyramid/config/i18n.py:91: 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]79b94149bbbf87d2aff802495/pyramid/tests/pkgs/localeapp/locale'] != ['/ho[70 chars]79b94149bbbf87d2aff802495/r2e_tests/pkgs/localeapp/locale']\nE       \nE       First differing element 0:\nE       '/hom[68 chars]279b94149bbbf87d2aff802495/pyramid/tests/pkgs/localeapp/locale'\nE       '/hom[68 chars]279b94149bbbf87d2aff802495/r2e_tests/pkgs/localeapp/locale'\nE       \nE       - ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495/pyramid/tests/pkgs/localeapp/locale']\nE       ?                                                                                                      -- ^^^^^\nE       \nE       + ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495/r2e_tests/pkgs/localeapp/locale']\nE       ?                                                                                                       ^^^\n\nr2e_tests/test_config/test_i18n.py:57: 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]9bbbf87d2aff802495/pyramid/tests/pkgs/localeapp/locale', 'abc'] != ['/ho[77 chars]9bbbf87d2aff802495/r2e_tests/pkgs/localeapp/locale', 'abc']\nE       \nE       First differing element 0:\nE       '/hom[68 chars]279b94149bbbf87d2aff802495/pyramid/tests/pkgs/localeapp/locale'\nE       '/hom[68 chars]279b94149bbbf87d2aff802495/r2e_tests/pkgs/localeapp/locale'\nE       \nE       - ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495/pyramid/tests/pkgs/localeapp/locale',\nE       ?                                                                                                      -- ^^^^^\nE       \nE       + ['/home/gcpuser/buckets/local_repoeval_bucket/repos/pyramid_eac06005ac849b279b94149bbbf87d2aff802495/r2e_tests/pkgs/localeapp/locale',\nE       ?                                                                                                       ^^^\nE       \nE          'abc']\n\nr2e_tests/test_config/test_i18n.py:67: 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]2495/pyramid/tests/pkgs/localeapp/locale', '/h[130 chars]le2'] != ['/ho[91 chars]2495/r2e_tests/pkgs/localeapp/locale', '/home/[122 chars]le2']\nE       \nE       First differing element 0:\nE       '/hom[68 chars]279b94149bbbf87d2aff802495/pyramid/tests/pkgs/localeapp/locale'\nE       '/hom[68 chars]279b94149bbbf87d2aff802495/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:74: 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]2495/pyramid/tests/pkgs/localeapp/locale3', '/[269 chars]le2'] != ['/ho[91 chars]2495/r2e_tests/pkgs/localeapp/locale3', '/home[257 chars]le2']\nE       \nE       First differing element 0:\nE       '/hom[69 chars]79b94149bbbf87d2aff802495/pyramid/tests/pkgs/localeapp/locale3'\nE       '/hom[69 chars]79b94149bbbf87d2aff802495/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:83: 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:129: 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:1026: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \npyramid/config/__init__.py:633: in commit\n    self.action_state.execute_actions(introspector=self.introspector)\npyramid/config/__init__.py:1071: in execute_actions\n    for action in resolveConflicts(self.actions):\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nactions = []\n\n    def resolveConflicts(actions):\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        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    \n        def orderandpos(v):\n            n, v = v\n            if not isinstance(v, dict):\n                # old-style tuple action\n                v = expand_action(*v)\n            return (v['order'] or 0, n)\n    \n        sactions = sorted(enumerate(actions), key=orderandpos)\n    \n        def orderonly(v):\n            n, v = v\n            if not isinstance(v, dict):\n                # old-style tuple action\n                v = expand_action(*v)\n            return v['order'] or 0\n    \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    \n            unique = {}\n            output = []\n    \n            for i, action in actiongroup:\n                # Within an order, actions are executed sequentially based on\n                # original action ordering (\"i\").\n    \n                if not isinstance(action, dict):\n                    # old-style tuple action\n                    action = expand_action(*action)\n    \n                # \"ainfo\" is a tuple of (order, i, action) where \"order\" is a\n                # user-supplied grouping, \"i\" is an integer expressing the relative\n                # position of this action in the action list being resolved, and\n                # \"action\" is an action dictionary.  The purpose of an ainfo is to\n                # associate an \"order\" and an \"i\" with a particular action; \"order\"\n                # and \"i\" exist for sorting purposes after conflict resolution.\n                ainfo = (order, i, action)\n    \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    \n            for discriminator, ainfos in unique.items():\n                # We use (includepath, order, 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 \"order\", then\n                # \"i\".\n                def bypath(ainfo):\n                    path, order, i = ainfo[2]['includepath'], ainfo[0], ainfo[1]\n                    return path, order, i\n    \n                ainfos.sort(key=bypath)\n                ainfo, rest = ainfos[0], ainfos[1:]\n                output.append(ainfo)\n                _, _, action = ainfo\n                basepath, baseinfo, discriminator = (\n                    action['includepath'],\n                    action['info'],\n                    action['discriminator'],\n                    )\n    \n                for _, _, action in rest:\n                    includepath = action['includepath']\n                    # Test whether path is a prefix of opath\n                    if (includepath[:len(basepath)] != basepath # not a prefix\n                        or 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_eac06005ac849b279b94149bbbf87d2aff802495/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_eac06005ac849b279b94149bbbf87d2aff802495/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_eac06005ac849b279b94149bbbf87d2aff802495/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_eac06005ac849b279b94149bbbf87d2aff802495/pyramid/tests/test_config/pkgs/selfscan/another.py:\nE                       def two(request):\n\npyramid/config/__init__.py:1199: 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:1035: 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:426: 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:1449: 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:1436: 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:1423: 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:1462: AssertionError\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]0c15c215dc0>, 'static', 'r2e_tests.test_config:files', {})] != [(<py[39 chars]0c15c215dc0>, 'static', 'pyramid.tests.test_config:files', {})]\nE       \nE       First differing element 0:\nE       (<pyr[37 chars]70c15c215dc0>, 'static', 'r2e_tests.test_config:files', {})\nE       (<pyr[37 chars]70c15c215dc0>, 'static', 'pyramid.tests.test_config:files', {})\nE       \nE         [(<pyramid.config.Configurator object at 0x70c15c215dc0>,\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:1713: 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.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:1041: 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.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:1081: AssertionError\n_____________ TestViewDeriver.test_function_returns_non_adaptable ______________\n\nself = <r2e_tests.test_config.test_views.TestViewDeriver testMethod=test_function_returns_non_adaptable>\n\n    def test_function_returns_non_adaptable(self):\n        def view(request):\n            return None\n        deriver = self._makeOne()\n        result = deriver(view)\n        self.assertFalse(result is view)\n        try:\n>           result(None, None)\n\nr2e_tests/test_config/test_views.py:2262: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\ncontext = None, request = None\n\n    def viewresult_to_response(context, request):\n        result = view(context, request)\n        if result.__class__ is Response: # common case\n            response = result\n        else:\n            response = registry.queryAdapterOrSelf(result, IResponse)\n            if response is None:\n                if result is None:\n                    append = (' You may have forgotten to return a value '\n                              'from the view callable.')\n                elif isinstance(result, dict):\n                    append = (' You may have forgotten to define a '\n                              'renderer in the view configuration.')\n                else:\n                    append = ''\n    \n                msg = ('Could not convert return value of the view '\n                       'callable %s into a response object. '\n                       'The value returned was %r.' + append)\n    \n>               raise ValueError(msg % (view_description(view), result))\nE               ValueError: Could not convert return value of the view callable function r2e_tests.test_config.test_views.view into a response object. The value returned was None. You may have forgotten to return a value from the view callable.\n\npyramid/config/views.py:396: ValueError\n\nDuring handling of the above exception, another exception occurred:\n\nself = <r2e_tests.test_config.test_views.TestViewDeriver testMethod=test_function_returns_non_adaptable>\n\n    def test_function_returns_non_adaptable(self):\n        def view(request):\n            return None\n        deriver = self._makeOne()\n        result = deriver(view)\n        self.assertFalse(result is view)\n        try:\n            result(None, None)\n        except ValueError as e:\n>           self.assertEqual(\n                e.args[0],\n                'Could not convert return value of the view callable function '\n                'pyramid.tests.test_config.test_views.view into a response '\n                'object. The value returned was None. You may have forgotten '\n                'to return a value from the view callable.'\n                )\nE           AssertionError: 'Coul[52 chars]tion r2e_tests.test_config.test_views.view int[110 chars]ble.' != 'Coul[52 chars]tion pyramid.tests.test_config.test_views.view[114 chars]ble.'\nE           Diff is 663 characters long. Set self.maxDiff to None to see it.\n\nr2e_tests/test_config/test_views.py:2264: AssertionError\n___________ TestViewDeriver.test_function_returns_non_adaptable_dict ___________\n\nself = <r2e_tests.test_config.test_views.TestViewDeriver testMethod=test_function_returns_non_adaptable_dict>\n\n    def test_function_returns_non_adaptable_dict(self):\n        def view(request):\n            return {'a':1}\n        deriver = self._makeOne()\n        result = deriver(view)\n        self.assertFalse(result is view)\n        try:\n>           result(None, None)\n\nr2e_tests/test_config/test_views.py:2281: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\ncontext = None, request = None\n\n    def viewresult_to_response(context, request):\n        result = view(context, request)\n        if result.__class__ is Response: # common case\n            response = result\n        else:\n            response = registry.queryAdapterOrSelf(result, IResponse)\n            if response is None:\n                if result is None:\n                    append = (' You may have forgotten to return a value '\n                              'from the view callable.')\n                elif isinstance(result, dict):\n                    append = (' You may have forgotten to define a '\n                              'renderer in the view configuration.')\n                else:\n                    append = ''\n    \n                msg = ('Could not convert return value of the view '\n                       'callable %s into a response object. '\n                       'The value returned was %r.' + append)\n    \n>               raise ValueError(msg % (view_description(view), result))\nE               ValueError: Could not convert return value of the view callable function r2e_tests.test_config.test_views.view into a response object. The value returned was {'a': 1}. You may have forgotten to define a renderer in the view configuration.\n\npyramid/config/views.py:396: ValueError\n\nDuring handling of the above exception, another exception occurred:\n\nself = <r2e_tests.test_config.test_views.TestViewDeriver testMethod=test_function_returns_non_adaptable_dict>\n\n    def test_function_returns_non_adaptable_dict(self):\n        def view(request):\n            return {'a':1}\n        deriver = self._makeOne()\n        result = deriver(view)\n        self.assertFalse(result is view)\n        try:\n            result(None, None)\n        except ValueError as e:\n>           self.assertEqual(\n                e.args[0],\n                \"Could not convert return value of the view callable function \"\n                \"pyramid.tests.test_config.test_views.view into a response \"\n                \"object. The value returned was {'a': 1}. You may have \"\n                \"forgotten to define a renderer in the view configuration.\"\n                )\nE           AssertionError: \"Coul[52 chars]tion r2e_tests.test_config.test_views.view int[120 chars]ion.\" != \"Coul[52 chars]tion pyramid.tests.test_config.test_views.view[124 chars]ion.\"\nE           Diff is 683 characters long. Set self.maxDiff to None to see it.\n\nr2e_tests/test_config/test_views.py:2283: AssertionError\n_____________ TestViewDeriver.test_instance_returns_non_adaptable ______________\n\nself = <r2e_tests.test_config.test_views.TestViewDeriver testMethod=test_instance_returns_non_adaptable>\n\n    def test_instance_returns_non_adaptable(self):\n        class AView(object):\n            def __call__(self, request):\n                return None\n        view = AView()\n        deriver = self._makeOne()\n        result = deriver(view)\n        self.assertFalse(result is view)\n        try:\n>           result(None, None)\n\nr2e_tests/test_config/test_views.py:2302: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\ncontext = None, request = None\n\n    def viewresult_to_response(context, request):\n        result = view(context, request)\n        if result.__class__ is Response: # common case\n            response = result\n        else:\n            response = registry.queryAdapterOrSelf(result, IResponse)\n            if response is None:\n                if result is None:\n                    append = (' You may have forgotten to return a value '\n                              'from the view callable.')\n                elif isinstance(result, dict):\n                    append = (' You may have forgotten to define a '\n                              'renderer in the view configuration.')\n                else:\n                    append = ''\n    \n                msg = ('Could not convert return value of the view '\n                       'callable %s into a response object. '\n                       'The value returned was %r.' + append)\n    \n>               raise ValueError(msg % (view_description(view), result))\nE               ValueError: Could not convert return value of the view callable object <r2e_tests.test_config.test_views.TestViewDeriver.test_instance_returns_non_adaptable.<locals>.AView object at 0x70c15c094940> into a response object. The value returned was None. You may have forgotten to return a value from the view callable.\n\npyramid/config/views.py:396: ValueError\n\nDuring handling of the above exception, another exception occurred:\n\nself = <r2e_tests.test_config.test_views.TestViewDeriver testMethod=test_instance_returns_non_adaptable>\n\n    def test_instance_returns_non_adaptable(self):\n        class AView(object):\n            def __call__(self, request):\n                return None\n        view = AView()\n        deriver = self._makeOne()\n        result = deriver(view)\n        self.assertFalse(result is view)\n        try:\n            result(None, None)\n        except ValueError as e:\n            msg = e.args[0]\n>           self.assertTrue(msg.startswith(\n                'Could not convert return value of the view callable object '\n                '<pyramid.tests.test_config.test_views.'))\nE           AssertionError: False is not true\n\nr2e_tests/test_config/test_views.py:2305: AssertionError\n____ TestViewDeriver.test_requestonly_default_method_returns_non_adaptable _____\n\nself = <r2e_tests.test_config.test_views.TestViewDeriver testMethod=test_requestonly_default_method_returns_non_adaptable>\n\n    def test_requestonly_default_method_returns_non_adaptable(self):\n        request = DummyRequest()\n        class AView(object):\n            def __init__(self, request):\n                pass\n            def __call__(self):\n                return None\n        deriver = self._makeOne()\n        result = deriver(AView)\n        self.assertFalse(result is AView)\n        try:\n>           result(None, request)\n\nr2e_tests/test_config/test_views.py:2348: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\ncontext = None\nrequest = <r2e_tests.test_config.test_views.DummyRequest object at 0x70c15c0342e0>\n\n    def viewresult_to_response(context, request):\n        result = view(context, request)\n        if result.__class__ is Response: # common case\n            response = result\n        else:\n            response = registry.queryAdapterOrSelf(result, IResponse)\n            if response is None:\n                if result is None:\n                    append = (' You may have forgotten to return a value '\n                              'from the view callable.')\n                elif isinstance(result, dict):\n                    append = (' You may have forgotten to define a '\n                              'renderer in the view configuration.')\n                else:\n                    append = ''\n    \n                msg = ('Could not convert return value of the view '\n                       'callable %s into a response object. '\n                       'The value returned was %r.' + append)\n    \n>               raise ValueError(msg % (view_description(view), result))\nE               ValueError: Could not convert return value of the view callable method __call__ of class r2e_tests.test_config.test_views.AView into a response object. The value returned was None. You may have forgotten to return a value from the view callable.\n\npyramid/config/views.py:396: ValueError\n\nDuring handling of the above exception, another exception occurred:\n\nself = <r2e_tests.test_config.test_views.TestViewDeriver testMethod=test_requestonly_default_method_returns_non_adaptable>\n\n    def test_requestonly_default_method_returns_non_adaptable(self):\n        request = DummyRequest()\n        class AView(object):\n            def __init__(self, request):\n                pass\n            def __call__(self):\n                return None\n        deriver = self._makeOne()\n        result = deriver(AView)\n        self.assertFalse(result is AView)\n        try:\n            result(None, request)\n        except ValueError as e:\n>           self.assertEqual(\n                e.args[0],\n                'Could not convert return value of the view callable '\n                'method __call__ of '\n                'class pyramid.tests.test_config.test_views.AView into a '\n                'response object. The value returned was None. You may have '\n                'forgotten to return a value from the view callable.'\n                )\nE           AssertionError: 'Coul[68 chars]lass r2e_tests.test_config.test_views.AView in[111 chars]ble.' != 'Coul[68 chars]lass pyramid.tests.test_config.test_views.AVie[115 chars]ble.'\nE           Diff is 649 characters long. Set self.maxDiff to None to see it.\n\nr2e_tests/test_config/test_views.py:2350: AssertionError\n___ TestViewDeriver.test_requestonly_nondefault_method_returns_non_adaptable ___\n\nself = <r2e_tests.test_config.test_views.TestViewDeriver testMethod=test_requestonly_nondefault_method_returns_non_adaptable>\n\n    def test_requestonly_nondefault_method_returns_non_adaptable(self):\n        request = DummyRequest()\n        class AView(object):\n            def __init__(self, request):\n                pass\n            def theviewmethod(self):\n                return None\n        deriver = self._makeOne(attr='theviewmethod')\n        result = deriver(AView)\n        self.assertFalse(result is AView)\n        try:\n>           result(None, request)\n\nr2e_tests/test_config/test_views.py:2372: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\ncontext = None\nrequest = <r2e_tests.test_config.test_views.DummyRequest object at 0x70c15c1637f0>\n\n    def viewresult_to_response(context, request):\n        result = view(context, request)\n        if result.__class__ is Response: # common case\n            response = result\n        else:\n            response = registry.queryAdapterOrSelf(result, IResponse)\n            if response is None:\n                if result is None:\n                    append = (' You may have forgotten to return a value '\n                              'from the view callable.')\n                elif isinstance(result, dict):\n                    append = (' You may have forgotten to define a '\n                              'renderer in the view configuration.')\n                else:\n                    append = ''\n    \n                msg = ('Could not convert return value of the view '\n                       'callable %s into a response object. '\n                       'The value returned was %r.' + append)\n    \n>               raise ValueError(msg % (view_description(view), result))\nE               ValueError: Could not convert return value of the view callable method theviewmethod of class r2e_tests.test_config.test_views.AView into a response object. The value returned was None. You may have forgotten to return a value from the view callable.\n\npyramid/config/views.py:396: ValueError\n\nDuring handling of the above exception, another exception occurred:\n\nself = <r2e_tests.test_config.test_views.TestViewDeriver testMethod=test_requestonly_nondefault_method_returns_non_adaptable>\n\n    def test_requestonly_nondefault_method_returns_non_adaptable(self):\n        request = DummyRequest()\n        class AView(object):\n            def __init__(self, request):\n                pass\n            def theviewmethod(self):\n                return None\n        deriver = self._makeOne(attr='theviewmethod')\n        result = deriver(AView)\n        self.assertFalse(result is AView)\n        try:\n            result(None, request)\n        except ValueError as e:\n>           self.assertEqual(\n                e.args[0],\n                'Could not convert return value of the view callable '\n                'method theviewmethod of '\n                'class pyramid.tests.test_config.test_views.AView into a '\n                'response object. The value returned was None. You may have '\n                'forgotten to return a value from the view callable.'\n                )\nE           AssertionError: 'Coul[73 chars]lass r2e_tests.test_config.test_views.AView in[111 chars]ble.' != 'Coul[73 chars]lass pyramid.tests.test_config.test_views.AVie[115 chars]ble.'\nE           Diff is 669 characters long. Set self.maxDiff to None to see it.\n\nr2e_tests/test_config/test_views.py:2374: 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:3841: AssertionError\n_______________ TestPRequestCommand.test_command_display_headers _______________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_display_headers>\n\n    def test_command_display_headers(self):\n        command = self._makeOne(\n            ['', '--display-headers', 'development.ini', '/'])\n        command.run()\n        self.assertEqual(self._path_info, '/')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(\n            self._out,\n            ['200 OK', 'Content-Type: text/html; charset=UTF-8', 'abc'])\nE       AssertionError: Lists differ: ['200 OK', b'abc'] != ['200 OK', 'Content-Type: text/html; charset=UTF-8', 'abc']\nE       \nE       First differing element 1:\nE       b'abc'\nE       'Content-Type: text/html; charset=UTF-8'\nE       \nE       Second list contains 1 additional elements.\nE       First extra element 2:\nE       'abc'\nE       \nE       - ['200 OK', b'abc']\nE       + ['200 OK', 'Content-Type: text/html; charset=UTF-8', 'abc']\n\nr2e_tests/test_scripts/test_prequest.py:202: AssertionError\n_________ TestPRequestCommand.test_command_has_content_type_header_var _________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_has_content_type_header_var>\n\n    def test_command_has_content_type_header_var(self):\n        command = self._makeOne(\n            ['', '--header=content-type:app/foo','development.ini', '/'])\n        command.run()\n        self.assertEqual(self._environ['CONTENT_TYPE'], 'app/foo')\n        self.assertEqual(self._path_info, '/')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(self._out, ['abc'])\nE       AssertionError: Lists differ: [b'abc'] != ['abc']\nE       \nE       First differing element 0:\nE       b'abc'\nE       'abc'\nE       \nE       - [b'abc']\nE       ?  -\nE       \nE       + ['abc']\n\nr2e_tests/test_scripts/test_prequest.py:92: AssertionError\n_____________ TestPRequestCommand.test_command_has_good_header_var _____________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_has_good_header_var>\n\n    def test_command_has_good_header_var(self):\n        command = self._makeOne(\n            ['', '--header=name:value','development.ini', '/'])\n        command.run()\n        self.assertEqual(self._environ['HTTP_NAME'], 'value')\n        self.assertEqual(self._path_info, '/')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(self._out, ['abc'])\nE       AssertionError: Lists differ: [b'abc'] != ['abc']\nE       \nE       First differing element 0:\nE       b'abc'\nE       'abc'\nE       \nE       - [b'abc']\nE       ?  -\nE       \nE       + ['abc']\n\nr2e_tests/test_scripts/test_prequest.py:69: AssertionError\n__________ TestPRequestCommand.test_command_has_multiple_header_vars ___________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_has_multiple_header_vars>\n\n    def test_command_has_multiple_header_vars(self):\n        command = self._makeOne(\n            ['',\n             '--header=name:value',\n             '--header=name2:value2',\n             'development.ini',\n             '/'])\n        command.run()\n        self.assertEqual(self._environ['HTTP_NAME'], 'value')\n        self.assertEqual(self._environ['HTTP_NAME2'], 'value2')\n        self.assertEqual(self._path_info, '/')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(self._out, ['abc'])\nE       AssertionError: Lists differ: [b'abc'] != ['abc']\nE       \nE       First differing element 0:\nE       b'abc'\nE       'abc'\nE       \nE       - [b'abc']\nE       ?  -\nE       \nE       + ['abc']\n\nr2e_tests/test_scripts/test_prequest.py:107: AssertionError\n_________________ TestPRequestCommand.test_command_method_get __________________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_method_get>\n\n    def test_command_method_get(self):\n        command = self._makeOne(['', '--method=GET', 'development.ini', '/'])\n        command.run()\n        self.assertEqual(self._environ['REQUEST_METHOD'], 'GET')\n        self.assertEqual(self._path_info, '/')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(self._out, ['abc'])\nE       AssertionError: Lists differ: [b'abc'] != ['abc']\nE       \nE       First differing element 0:\nE       b'abc'\nE       'abc'\nE       \nE       - [b'abc']\nE       ?  -\nE       \nE       + ['abc']\n\nr2e_tests/test_scripts/test_prequest.py:116: AssertionError\n_______________ TestPRequestCommand.test_command_method_options ________________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_method_options>\n\n    def test_command_method_options(self):\n        from pyramid.compat import NativeIO\n        command = self._makeOne(['', '--method=OPTIONS', 'development.ini',\n                                '/'])\n        stdin = NativeIO()\n        command.stdin = stdin\n        command.run()\n        self.assertEqual(self._environ['REQUEST_METHOD'], 'OPTIONS')\n        self.assertEqual(self._path_info, '/')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(self._out, ['abc'])\nE       AssertionError: Lists differ: [b'abc'] != ['abc']\nE       \nE       First differing element 0:\nE       b'abc'\nE       'abc'\nE       \nE       - [b'abc']\nE       ?  -\nE       \nE       + ['abc']\n\nr2e_tests/test_scripts/test_prequest.py:184: AssertionError\n________________ TestPRequestCommand.test_command_method_patch _________________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_method_patch>\n\n    def test_command_method_patch(self):\n        from pyramid.compat import NativeIO\n        command = self._makeOne(['', '--method=PATCH', 'development.ini', '/'])\n        stdin = NativeIO()\n        command.stdin = stdin\n        command.run()\n        self.assertEqual(self._environ['REQUEST_METHOD'], 'PATCH')\n        self.assertEqual(self._environ['CONTENT_LENGTH'], '-1')\n        self.assertEqual(self._environ['wsgi.input'], stdin)\n        self.assertEqual(self._path_info, '/')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(self._out, ['abc'])\nE       AssertionError: Lists differ: [b'abc'] != ['abc']\nE       \nE       First differing element 0:\nE       b'abc'\nE       'abc'\nE       \nE       - [b'abc']\nE       ?  -\nE       \nE       + ['abc']\n\nr2e_tests/test_scripts/test_prequest.py:158: AssertionError\n_________________ TestPRequestCommand.test_command_method_post _________________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_method_post>\n\n    def test_command_method_post(self):\n        from pyramid.compat import NativeIO\n        command = self._makeOne(['', '--method=POST', 'development.ini', '/'])\n        stdin = NativeIO()\n        command.stdin = stdin\n        command.run()\n        self.assertEqual(self._environ['REQUEST_METHOD'], 'POST')\n        self.assertEqual(self._environ['CONTENT_LENGTH'], '-1')\n        self.assertEqual(self._environ['wsgi.input'], stdin)\n        self.assertEqual(self._path_info, '/')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(self._out, ['abc'])\nE       AssertionError: Lists differ: [b'abc'] != ['abc']\nE       \nE       First differing element 0:\nE       b'abc'\nE       'abc'\nE       \nE       - [b'abc']\nE       ?  -\nE       \nE       + ['abc']\n\nr2e_tests/test_scripts/test_prequest.py:130: AssertionError\n_______________ TestPRequestCommand.test_command_method_propfind _______________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_method_propfind>\n\n    def test_command_method_propfind(self):\n        from pyramid.compat import NativeIO\n        command = self._makeOne(['', '--method=PROPFIND', 'development.ini',\n                                '/'])\n        stdin = NativeIO()\n        command.stdin = stdin\n        command.run()\n        self.assertEqual(self._environ['REQUEST_METHOD'], 'PROPFIND')\n        self.assertEqual(self._path_info, '/')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(self._out, ['abc'])\nE       AssertionError: Lists differ: [b'abc'] != ['abc']\nE       \nE       First differing element 0:\nE       b'abc'\nE       'abc'\nE       \nE       - [b'abc']\nE       ?  -\nE       \nE       + ['abc']\n\nr2e_tests/test_scripts/test_prequest.py:171: AssertionError\n_________________ TestPRequestCommand.test_command_method_put __________________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_method_put>\n\n    def test_command_method_put(self):\n        from pyramid.compat import NativeIO\n        command = self._makeOne(['', '--method=PUT', 'development.ini', '/'])\n        stdin = NativeIO()\n        command.stdin = stdin\n        command.run()\n        self.assertEqual(self._environ['REQUEST_METHOD'], 'PUT')\n        self.assertEqual(self._environ['CONTENT_LENGTH'], '-1')\n        self.assertEqual(self._environ['wsgi.input'], stdin)\n        self.assertEqual(self._path_info, '/')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(self._out, ['abc'])\nE       AssertionError: Lists differ: [b'abc'] != ['abc']\nE       \nE       First differing element 0:\nE       b'abc'\nE       'abc'\nE       \nE       - [b'abc']\nE       ?  -\nE       \nE       + ['abc']\n\nr2e_tests/test_scripts/test_prequest.py:144: AssertionError\n________ TestPRequestCommand.test_command_path_doesnt_start_with_slash _________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_path_doesnt_start_with_slash>\n\n    def test_command_path_doesnt_start_with_slash(self):\n        command = self._makeOne(['', 'development.ini', 'abc'])\n        command.run()\n        self.assertEqual(self._path_info, '/abc')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(self._out, ['abc'])\nE       AssertionError: Lists differ: [b'abc'] != ['abc']\nE       \nE       First differing element 0:\nE       b'abc'\nE       'abc'\nE       \nE       - [b'abc']\nE       ?  -\nE       \nE       + ['abc']\n\nr2e_tests/test_scripts/test_prequest.py:50: AssertionError\n__________________ TestPRequestCommand.test_command_two_args ___________________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_two_args>\n\n    def test_command_two_args(self):\n        command = self._makeOne(['', 'development.ini', '/'])\n        command.run()\n        self.assertEqual(self._path_info, '/')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(self._out, ['abc'])\nE       AssertionError: Lists differ: [b'abc'] != ['abc']\nE       \nE       First differing element 0:\nE       b'abc'\nE       'abc'\nE       \nE       - [b'abc']\nE       ?  -\nE       \nE       + ['abc']\n\nr2e_tests/test_scripts/test_prequest.py:42: AssertionError\n________________ TestPRequestCommand.test_command_w_basic_auth _________________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_w_basic_auth>\n\n    def test_command_w_basic_auth(self):\n        command = self._makeOne(\n            ['', '--login=user:password',\n                 '--header=name:value','development.ini', '/'])\n        command.run()\n        self.assertEqual(self._environ['HTTP_NAME'], 'value')\n        self.assertEqual(self._environ['HTTP_AUTHORIZATION'],\n                        'Basic dXNlcjpwYXNzd29yZA==')\n        self.assertEqual(self._path_info, '/')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(self._out, ['abc'])\nE       AssertionError: Lists differ: [b'abc'] != ['abc']\nE       \nE       First differing element 0:\nE       b'abc'\nE       'abc'\nE       \nE       - [b'abc']\nE       ?  -\nE       \nE       + ['abc']\n\nr2e_tests/test_scripts/test_prequest.py:82: AssertionError\n______________ TestPRequestCommand.test_command_with_query_string ______________\n\nself = <r2e_tests.test_scripts.test_prequest.TestPRequestCommand testMethod=test_command_with_query_string>\n\n    def test_command_with_query_string(self):\n        command = self._makeOne(['', 'development.ini', '/abc?a=1&b=2&c'])\n        command.run()\n        self.assertEqual(self._environ['QUERY_STRING'], 'a=1&b=2&c')\n        self.assertEqual(self._path_info, '/abc')\n        self.assertEqual(self._spec, 'development.ini')\n        self.assertEqual(self._app_name, None)\n>       self.assertEqual(self._out, ['abc'])\nE       AssertionError: Lists differ: [b'abc'] != ['abc']\nE       \nE       First differing element 0:\nE       b'abc'\nE       'abc'\nE       \nE       - [b'abc']\nE       ?  -\nE       \nE       + ['abc']\n\nr2e_tests/test_scripts/test_prequest.py:193: AssertionError\n______________________________ Test_main.test_it _______________________________\n\nself = <r2e_tests.test_scripts.test_pserve.Test_main testMethod=test_it>\n\n    def test_it(self):\n>       result = self._callFUT(['pserve'])\n\nr2e_tests/test_scripts/test_pserve.py:265: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <r2e_tests.test_scripts.test_pserve.Test_main testMethod=test_it>\nargv = ['pserve']\n\n    def _callFUT(self, argv):\n        from pyramid.scripts.pserve import main\n>       return main(argv, quiet=True)\nE       TypeError: main() got an unexpected keyword argument 'quiet'\n\nr2e_tests/test_scripts/test_pserve.py:262: TypeError\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, arg2: view\n        command.args = ('/foo/bar/myapp.ini#myapp', '/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:283: AssertionError\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_get_options_no_command\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_get_options_with_command\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_parse_vars_bad\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_parse_vars_good\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_record_pid_not_verbose\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_record_pid_verbose\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_remove_pid_current_pid_is_not_pid_in_file\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_remove_pid_current_pid_is_not_written_pid\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_remove_pid_file_not_verbose\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_remove_pid_file_stale_pid_write_exception\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_remove_pid_file_unlink_exception\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_remove_pid_file_verbose\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_remove_pid_no_pid_file\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_remove_pid_not_a_number\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_run_no_args\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_run_stop_daemon_bad_pid_file\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_run_stop_daemon_invalid_pid_in_file\nPASSED r2e_tests/test_1.py::TestPServeCommand::test_run_stop_daemon_no_such_pid_file\nPASSED r2e_tests/test_1.py::Test_read_pidfile::test_read_pidfile\nPASSED r2e_tests/test_1.py::Test_read_pidfile::test_read_pidfile_no_pid_file\nPASSED r2e_tests/test_1.py::Test_read_pidfile::test_read_pidfile_not_a_number\nPASSED r2e_tests/test_1.py::TestLazyWriter::test_flush\nPASSED r2e_tests/test_1.py::TestLazyWriter::test_open\nPASSED r2e_tests/test_1.py::TestLazyWriter::test_write\nPASSED r2e_tests/test_1.py::TestLazyWriter::test_writeline\nPASSED r2e_tests/test_1.py::Test__methodwrapper::test___call__fail\nPASSED r2e_tests/test_1.py::Test__methodwrapper::test___call__succeed\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_directory\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_directory_with_package\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_file\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_directory\nPASSED r2e_tests/test_config/test_assets.py::TestAssetsConfiguratorMixin::test_override_asset_package_with_package\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_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_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::TestPackageOverrides::test_search_path\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_unnamed_callable\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_multiple_request_properties\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_multiple_request_properties_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_request_property_with_callable\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_request_property_with_property\nPASSED r2e_tests/test_config/test_factories.py::TestFactoriesMixin::test_set_request_property_with_unnamed_callable\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_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_add_translation_dirs_registers_chameleon_translate\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_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_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_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_renderer_globals_factory\nPASSED r2e_tests/test_config/test_init.py::ConfiguratorTests::test_setup_registry_renderer_globals_factory_dottedname\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_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::TestConfiguratorDeprecatedFeatures::test_add_route_with_for_\nPASSED r2e_tests/test_config/test_init.py::TestConfiguratorDeprecatedFeatures::test_add_route_with_view\nPASSED r2e_tests/test_config/test_init.py::TestConfiguratorDeprecatedFeatures::test_add_route_with_view_attr\nPASSED r2e_tests/test_config/test_init.py::TestConfiguratorDeprecatedFeatures::test_add_route_with_view_context\nPASSED r2e_tests/test_config/test_init.py::TestConfiguratorDeprecatedFeatures::test_add_route_with_view_exception\nPASSED r2e_tests/test_config/test_init.py::TestConfiguratorDeprecatedFeatures::test_add_route_with_view_for\nPASSED r2e_tests/test_config/test_init.py::TestConfiguratorDeprecatedFeatures::test_add_route_with_view_permission\nPASSED r2e_tests/test_config/test_init.py::TestConfiguratorDeprecatedFeatures::test_add_route_with_view_permission_alias\nPASSED r2e_tests/test_config/test_init.py::TestConfiguratorDeprecatedFeatures::test_add_route_with_view_renderer\nPASSED r2e_tests/test_config/test_init.py::TestConfiguratorDeprecatedFeatures::test_add_route_with_view_renderer_alias\nPASSED r2e_tests/test_config/test_init.py::TestConfiguratorDeprecatedFeatures::test_conflict_route_with_view\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::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_it\nPASSED r2e_tests/test_config/test_init.py::TestActionState::test_processSpec\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::TestGlobalRegistriesIntegration::test_global_registries\nPASSED r2e_tests/test_config/test_init.py::TestGlobalRegistriesIntegration::test_global_registries_empty\nPASSED r2e_tests/test_config/test_predicates.py::TestXHRPredicate::test___call___false\nPASSED r2e_tests/test_config/test_predicates.py::TestXHRPredicate::test___call___true\nPASSED r2e_tests/test_config/test_predicates.py::TestXHRPredicate::test_phash\nPASSED r2e_tests/test_config/test_predicates.py::TestXHRPredicate::test_text\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestMethodPredicate::test___call___false\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestMethodPredicate::test___call___true_multi\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestMethodPredicate::test___call___true_single\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestMethodPredicate::test_ctor_get_but_no_head\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestMethodPredicate::test_phash\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestMethodPredicate::test_text\nPASSED r2e_tests/test_config/test_predicates.py::TestPathInfoPredicate::test___call___false\nPASSED r2e_tests/test_config/test_predicates.py::TestPathInfoPredicate::test___call___true\nPASSED r2e_tests/test_config/test_predicates.py::TestPathInfoPredicate::test_ctor_compilefail\nPASSED r2e_tests/test_config/test_predicates.py::TestPathInfoPredicate::test_phash\nPASSED r2e_tests/test_config/test_predicates.py::TestPathInfoPredicate::test_text\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestParamPredicate::test___call___false\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestParamPredicate::test___call___false_multi\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestParamPredicate::test___call___true_exists\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestParamPredicate::test___call___true_multi\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestParamPredicate::test___call___true_withval\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestParamPredicate::test_phash_exists\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestParamPredicate::test_phash_withval\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestParamPredicate::test_text_exists\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestParamPredicate::test_text_multi\nPASSED r2e_tests/test_config/test_predicates.py::TestRequestParamPredicate::test_text_withval\nPASSED r2e_tests/test_config/test_predicates.py::TestMatchParamPredicate::test___call___false\nPASSED r2e_tests/test_config/test_predicates.py::TestMatchParamPredicate::test___call___matchdict_is_None\nPASSED r2e_tests/test_config/test_predicates.py::TestMatchParamPredicate::test___call___true_multi\nPASSED r2e_tests/test_config/test_predicates.py::TestMatchParamPredicate::test___call___true_single\nPASSED r2e_tests/test_config/test_predicates.py::TestMatchParamPredicate::test_phash\nPASSED r2e_tests/test_config/test_predicates.py::TestMatchParamPredicate::test_text\nPASSED r2e_tests/test_config/test_predicates.py::TestCustomPredicate::test___call___false\nPASSED r2e_tests/test_config/test_predicates.py::TestCustomPredicate::test___call___true\nPASSED r2e_tests/test_config/test_predicates.py::TestCustomPredicate::test_phash\nPASSED r2e_tests/test_config/test_predicates.py::TestCustomPredicate::test_text_func_has___text__\nPASSED r2e_tests/test_config/test_predicates.py::TestCustomPredicate::test_text_func_repr\nPASSED r2e_tests/test_config/test_predicates.py::TestTraversePredicate::test___call__traverse_has_remainder_already\nPASSED r2e_tests/test_config/test_predicates.py::TestTraversePredicate::test___call__traverse_matches\nPASSED r2e_tests/test_config/test_predicates.py::TestTraversePredicate::test___call__traverse_matches_with_highorder_chars\nPASSED r2e_tests/test_config/test_predicates.py::TestTraversePredicate::test_phash\nPASSED r2e_tests/test_config/test_predicates.py::TestTraversePredicate::test_text\nPASSED r2e_tests/test_config/test_predicates.py::Test_CheckCSRFTokenPredicate::test_it_call_val_False\nPASSED r2e_tests/test_config/test_predicates.py::Test_CheckCSRFTokenPredicate::test_it_call_val_True\nPASSED r2e_tests/test_config/test_predicates.py::Test_CheckCSRFTokenPredicate::test_it_call_val_str\nPASSED r2e_tests/test_config/test_predicates.py::Test_CheckCSRFTokenPredicate::test_phash\nPASSED r2e_tests/test_config/test_predicates.py::Test_CheckCSRFTokenPredicate::test_text\nPASSED r2e_tests/test_config/test_predicates.py::TestHeaderPredicate::test___call___false\nPASSED r2e_tests/test_config/test_predicates.py::TestHeaderPredicate::test___call___false_withregex\nPASSED r2e_tests/test_config/test_predicates.py::TestHeaderPredicate::test___call___true_exists\nPASSED r2e_tests/test_config/test_predicates.py::TestHeaderPredicate::test___call___true_withregex\nPASSED r2e_tests/test_config/test_predicates.py::TestHeaderPredicate::test___call___true_withval\nPASSED r2e_tests/test_config/test_predicates.py::TestHeaderPredicate::test_phash_exists\nPASSED r2e_tests/test_config/test_predicates.py::TestHeaderPredicate::test_phash_withregex\nPASSED r2e_tests/test_config/test_predicates.py::TestHeaderPredicate::test_phash_withval\nPASSED r2e_tests/test_config/test_predicates.py::TestHeaderPredicate::test_text_exists\nPASSED r2e_tests/test_config/test_predicates.py::TestHeaderPredicate::test_text_withregex\nPASSED r2e_tests/test_config/test_predicates.py::TestHeaderPredicate::test_text_withval\nPASSED r2e_tests/test_config/test_predicates.py::Test_PhysicalPathPredicate::test_it_call_False\nPASSED r2e_tests/test_config/test_predicates.py::Test_PhysicalPathPredicate::test_it_call_context_has_no_name\nPASSED r2e_tests/test_config/test_predicates.py::Test_PhysicalPathPredicate::test_it_call_val_list_True\nPASSED r2e_tests/test_config/test_predicates.py::Test_PhysicalPathPredicate::test_it_call_val_str_True\nPASSED r2e_tests/test_config/test_predicates.py::Test_PhysicalPathPredicate::test_it_call_val_tuple_True\nPASSED r2e_tests/test_config/test_predicates.py::Test_PhysicalPathPredicate::test_phash\nPASSED r2e_tests/test_config/test_predicates.py::Test_PhysicalPathPredicate::test_text\nPASSED r2e_tests/test_config/test_predicates.py::Test_EffectivePrincipalsPredicate::test_it_call_authentication_policy_doesnt_provide_superset\nPASSED r2e_tests/test_config/test_predicates.py::Test_EffectivePrincipalsPredicate::test_it_call_authentication_policy_provides_superset\nPASSED r2e_tests/test_config/test_predicates.py::Test_EffectivePrincipalsPredicate::test_it_call_authentication_policy_provides_superset_implicit\nPASSED r2e_tests/test_config/test_predicates.py::Test_EffectivePrincipalsPredicate::test_it_call_no_authentication_policy\nPASSED r2e_tests/test_config/test_predicates.py::Test_EffectivePrincipalsPredicate::test_phash\nPASSED r2e_tests/test_config/test_predicates.py::Test_EffectivePrincipalsPredicate::test_text\nPASSED r2e_tests/test_config/test_predicates.py::Test_EffectivePrincipalsPredicate::test_text_noniter\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_rendering.py::TestRenderingConfiguratorMixin::test_set_renderer_globals_factory\nPASSED r2e_tests/test_config/test_rendering.py::TestRenderingConfiguratorMixin::test_set_renderer_globals_factory_dottedname\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_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_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_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::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_getattr_fail\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_getattr_raises_attribute_error\nPASSED r2e_tests/test_config/test_settings.py::TestSettings::test_getattr_success\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_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_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_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_http_cache\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_with_renderer\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_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_http_cache\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_with_renderer\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_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_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_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_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_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_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_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::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::TestViewDeriver::test_as_function_context_and_request\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_as_function_requestonly\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_as_instance_context_and_request\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_as_instance_context_and_request_attr_and_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_as_instance_requestonly\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_as_instance_requestonly_attr_and_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_as_newstyle_class_context_and_request\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_as_newstyle_class_context_and_request_attr_and_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_as_newstyle_class_requestonly\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_as_newstyle_class_requestonly_attr_and_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_as_oldstyle_class_context_and_request\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_as_oldstyle_class_requestonly\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_as_oldstyle_cls_context_request_attr_and_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_as_oldstyle_cls_requestonly_attr_and_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_attr_wrapped_view_branching_default_phash\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_attr_wrapped_view_branching_nondefault_phash\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_class_with_attr\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_class_without_attr\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_debug_auth_permission_authpol_denied\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_debug_auth_permission_authpol_denied2\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_debug_auth_permission_authpol_overridden\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_debug_auth_permission_authpol_permitted\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_debug_auth_permission_authpol_permitted_no_request\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_function_returns_true_Response_no_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_function_returns_true_Response_with_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_http_cached_prevent_http_cache_in_settings\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_http_cached_view_bad_tuple\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_http_cached_view_integer\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_http_cached_view_prevent_auto_set\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_http_cached_view_timedelta\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_http_cached_view_tuple\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_http_cached_view_tuple_seconds_None\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_predicate_mismatch_exception_has_text_in_detail\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_predicate_mismatch_view_has_name\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_predicate_mismatch_view_has_no_name\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_requestonly_function\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_requestonly_function_with_renderer\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_requestonly_function_with_renderer_request_has_view\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_requestonly_function_with_renderer_request_override\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_secured_view_authn_policy_no_authz_policy\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_secured_view_authz_policy_no_authn_policy\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_secured_view_raises_forbidden_no_name\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_secured_view_raises_forbidden_with_name\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_with_debug_authorization_authn_policy_no_authz_policy\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_with_debug_authorization_authz_policy_no_authn_policy\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_with_debug_authorization_no_authpol\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_with_debug_authorization_no_permission\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_with_predicates_all\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_with_predicates_checker\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_with_predicates_notall\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_with_view_mapper_config_specified\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_with_view_mapper_default_mapper_specified\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_with_view_mapper_view_specified\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_with_wrapper_viewname\nPASSED r2e_tests/test_config/test_views.py::TestViewDeriver::test_with_wrapper_viewname_notfound\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_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_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_add_viewname_with_view_attr\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_viewname_with_view_context\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_viewname_with_view_for\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_viewname_with_view_permission\nPASSED r2e_tests/test_config/test_views.py::TestStaticURLInfo::test_add_viewname_with_view_renderer\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_registration_no_registry_on_request\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_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_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::Test_logging_file_config::test_it\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_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_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_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_unknown_scaffold_name\nPASSED r2e_tests/test_scripts/test_pcreate.py::Test_main::test_it\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_not_enough_args\nPASSED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_response_has_no_charset\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_good_args\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_with_no_slash_prefix\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\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::Test_main::test_it\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_get_options_no_command\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_get_options_with_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_record_pid_not_verbose\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_record_pid_verbose\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_remove_pid_current_pid_is_not_pid_in_file\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_remove_pid_current_pid_is_not_written_pid\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_remove_pid_file_not_verbose\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_remove_pid_file_stale_pid_write_exception\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_remove_pid_file_unlink_exception\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_remove_pid_file_verbose\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_remove_pid_no_pid_file\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_remove_pid_not_a_number\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_run_no_args\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_run_stop_daemon_bad_pid_file\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_run_stop_daemon_invalid_pid_in_file\nPASSED r2e_tests/test_scripts/test_pserve.py::TestPServeCommand::test_run_stop_daemon_no_such_pid_file\nPASSED r2e_tests/test_scripts/test_pserve.py::Test_read_pidfile::test_read_pidfile\nPASSED r2e_tests/test_scripts/test_pserve.py::Test_read_pidfile::test_read_pidfile_no_pid_file\nPASSED r2e_tests/test_scripts/test_pserve.py::Test_read_pidfile::test_read_pidfile_not_a_number\nPASSED r2e_tests/test_scripts/test_pserve.py::TestLazyWriter::test_flush\nPASSED r2e_tests/test_scripts/test_pserve.py::TestLazyWriter::test_open\nPASSED r2e_tests/test_scripts/test_pserve.py::TestLazyWriter::test_write\nPASSED r2e_tests/test_scripts/test_pserve.py::TestLazyWriter::test_writeline\nPASSED r2e_tests/test_scripts/test_pserve.py::Test__methodwrapper::test___call__fail\nPASSED r2e_tests/test_scripts/test_pserve.py::Test__methodwrapper::test___call__succeed\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_loads_bpython_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_default_shell_with_unknown_shell\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_command_loads_ipython_v0_10\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_command_loads_ipython_v0_11\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_make_bpython_shell\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_make_default_shell\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_make_ipython_v0_10_shell\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_make_ipython_v0_11_shell\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_shell_ipython_ordering\nPASSED r2e_tests/test_scripts/test_pshell.py::TestPShellCommand::test_shell_ordering\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::Test_main::test_it - TypeError: main() got an une...\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::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::TestPackageOverrides::test_get_filename\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_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_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_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_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::TestViewDeriver::test_function_returns_non_adaptable\nFAILED r2e_tests/test_config/test_views.py::TestViewDeriver::test_function_returns_non_adaptable_dict\nFAILED r2e_tests/test_config/test_views.py::TestViewDeriver::test_instance_returns_non_adaptable\nFAILED r2e_tests/test_config/test_views.py::TestViewDeriver::test_requestonly_default_method_returns_non_adaptable\nFAILED r2e_tests/test_config/test_views.py::TestViewDeriver::test_requestonly_nondefault_method_returns_non_adaptable\nFAILED r2e_tests/test_config/test_views.py::Test_view_description::test_without_text\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_display_headers\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_has_content_type_header_var\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_has_good_header_var\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_has_multiple_header_vars\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_method_get\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_method_options\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_method_patch\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_method_post\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_method_propfind\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_method_put\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_path_doesnt_start_with_slash\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_two_args\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_w_basic_auth\nFAILED r2e_tests/test_scripts/test_prequest.py::TestPRequestCommand::test_command_with_query_string\nFAILED r2e_tests/test_scripts/test_pserve.py::Test_main::test_it - TypeError:...\nFAILED r2e_tests/test_scripts/test_pviews.py::TestPViewsCommand::test_views_command_single_view_function_traversal\n======================== 45 failed, 837 passed in 4.54s ========================\n",
    "old_commit_res_stderr": ""
}
pyramid/scripts/pserve.py pyramid/tests/test_scripts/test_pserve.py
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]
**Title:** Passing `quiet` Argument to `pserve.main` Causes TypeError

**Description:**
When attempting to run the server with the `quiet` option, a `TypeError` is raised because the `main` function does not accept the `quiet` keyword argument.

**Example Buggy Code:**
```python
from pyramid.scripts.pserve import main

def test_pserve_quiet_option():
    argv = ['pserve']
    result = main(argv, quiet=True)
```

**Expected Behavior:**
The server should run with the verbose output level set to `0` when the `quiet` argument is provided, without raising any errors.

**Actual Behavior:**
A `TypeError` is raised indicating that the `main()` function received an unexpected keyword argument `quiet`:

```
TypeError: main() got an unexpected keyword argument 'quiet'
```
[/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/scripts/pserve.py
# (c) 2005 Ian Bicking and contributors; written for Paste
# (http://pythonpaste.org) Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license.php
#
# For discussion of daemonizing:
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/278731
#
# Code taken also from QP: http://www.mems-exchange.org/software/qp/ From
# lib/site.py

import atexit
import ctypes
import errno
import logging
import optparse
import os
import re
import subprocess
import sys
import textwrap
import threading
import time
import traceback

from paste.deploy import loadserver
from paste.deploy import loadapp

from pyramid.compat import WIN

from pyramid.paster import setup_logging

from pyramid.scripts.common import parse_vars

MAXFD = 1024

if WIN and not hasattr(os, 'kill'): # pragma: no cover
    # py 2.6 on windows
    def kill(pid, sig=None):
        """kill function for Win32"""
        # signal is ignored, semibogus raise message
        kernel32 = ctypes.windll.kernel32
        handle = kernel32.OpenProcess(1, 0, pid)
        if (0 == kernel32.TerminateProcess(handle, 0)):
            raise OSError('No such process %s' % pid)
else:
    kill = os.kill

def main(argv=sys.argv):
    command = PServeCommand(argv)
    return command.run()

class DaemonizeException(Exception):
    pass

class PServeCommand(object):

    usage = '%prog config_uri [start|stop|restart|status] [var=value]'
    description = """\
    This command serves a web application that uses a PasteDeploy
    configuration file for the server and application.

    If start/stop/restart is given, then --daemon is implied, and it will
    start (normal operation), stop (--stop-daemon), or do both.

    You can also include variable assignments like 'http_port=8080'
    and then use %(http_port)s in your config files.
    """
    default_verbosity = 1

    parser = optparse.OptionParser(
        usage,
        description=textwrap.dedent(description)
        )
    parser.add_option(
        '-n', '--app-name',
        dest='app_name',
        metavar='NAME',
        help="Load the named application (default main)")
    parser.add_option(
        '-s', '--server',
        dest='server',
        metavar='SERVER_TYPE',
        help="Use the named server.")
    parser.add_option(
        '--server-name',
        dest='server_name',
        metavar='SECTION_NAME',
        help=("Use the named server as defined in the configuration file "
              "(default: main)"))
    if hasattr(os, 'fork'):
        parser.add_option(
            '--daemon',
            dest="daemon",
            action="store_true",
            help="Run in daemon (background) mode")
    parser.add_option(
        '--pid-file',
        dest='pid_file',
        metavar='FILENAME',
        help=("Save PID to file (default to pyramid.pid if running in "
              "daemon mode)"))
    parser.add_option(
        '--log-file',
        dest='log_file',
        metavar='LOG_FILE',
        help="Save output to the given log file (redirects stdout)")
    parser.add_option(
        '--reload',
        dest='reload',
        action='store_true',
        help="Use auto-restart file monitor")
    parser.add_option(
        '--reload-interval',
        dest='reload_interval',
        default=1,
        help=("Seconds between checking files (low number can cause "
              "significant CPU usage)"))
    parser.add_option(
        '--monitor-restart',
        dest='monitor_restart',
        action='store_true',
        help="Auto-restart server if it dies")
    parser.add_option(
        '--status',
        action='store_true',
        dest='show_status',
        help="Show the status of the (presumably daemonized) server")
    parser.add_option(
        '-v', '--verbose',
        default=default_verbosity,
        dest='verbose',
        action='count',
        help="Set verbose level (default "+str(default_verbosity)+")")
    parser.add_option(
        '-q', '--quiet',
        action='store_const',
        const=0,
        dest='verbose',
        help="Suppress verbose output")

    if hasattr(os, 'setuid'):
        # I don't think these are available on Windows
        parser.add_option(
            '--user',
            dest='set_user',
            metavar="USERNAME",
            help="Set the user (usually only possible when run as root)")
        parser.add_option(
            '--group',
            dest='set_group',
            metavar="GROUP",
            help="Set the group (usually only possible when run as root)")

    parser.add_option(
        '--stop-daemon',
        dest='stop_daemon',
        action='store_true',
        help=('Stop a daemonized server (given a PID file, or default '
              'pyramid.pid file)'))

    _scheme_re = re.compile(r'^[a-z][a-z]+:', re.I)

    _reloader_environ_key = 'PYTHON_RELOADER_SHOULD_RUN'
    _monitor_environ_key = 'PASTE_MONITOR_SHOULD_RUN'

    possible_subcommands = ('start', 'stop', 'restart', 'status')

    def __init__(self, argv):
        self.options, self.args = self.parser.parse_args(argv[1:])

    def out(self, msg): # pragma: no cover
        print(msg)

    def get_options(self):
        if (len(self.args) > 1
            and self.args[1] in self.possible_subcommands):
            restvars = self.args[2:]
        else:
            restvars = self.args[1:]

        return parse_vars(restvars)

    def run(self): # pragma: no cover
        if self.options.stop_daemon:
            return self.stop_daemon()

        if not hasattr(self.options, 'set_user'):
            # Windows case:
            self.options.set_user = self.options.set_group = None

        # @@: Is this the right stage to set the user at?
        self.change_user_group(
            self.options.set_user, self.options.set_group)

        if not self.args:
            self.out('You must give a config file')
            return 2
        app_spec = self.args[0]

        if (len(self.args) > 1
            and self.args[1] in self.possible_subcommands):
            cmd = self.args[1]
        else:
            cmd = None

        if self.options.reload:
            if os.environ.get(self._reloader_environ_key):
                if self.options.verbose > 1:
                    self.out('Running reloading file monitor')
                install_reloader(int(self.options.reload_interval), [app_spec])
                # if self.requires_config_file:
                #     watch_file(self.args[0])
            else:
                return self.restart_with_reloader()

        if cmd not in (None, 'start', 'stop', 'restart', 'status'):
            self.out(
                'Error: must give start|stop|restart (not %s)' % cmd)
            return 2

        if cmd == 'status' or self.options.show_status:
            return self.show_status()

        if cmd == 'restart' or cmd == 'stop':
            result = self.stop_daemon()
            if result:
                if cmd == 'restart':
                    self.out("Could not stop daemon; aborting")
                else:
                    self.out("Could not stop daemon")
                return result
            if cmd == 'stop':
                return result
            self.options.daemon = True

        if cmd == 'start':
            self.options.daemon = True

        app_name = self.options.app_name

        vars = self.get_options()

        if not self._scheme_re.search(app_spec):
            app_spec = 'config:' + app_spec
        server_name = self.options.server_name
        if self.options.server:
            server_spec = 'egg:pyramid'
            assert server_name is None
            server_name = self.options.server
        else:
            server_spec = app_spec
        base = os.getcwd()

        if getattr(self.options, 'daemon', False):
            if not self.options.pid_file:
                self.options.pid_file = 'pyramid.pid'
            if not self.options.log_file:
                self.options.log_file = 'pyramid.log'

        # Ensure the log file is writeable
        if self.options.log_file:
            try:
                writeable_log_file = open(self.options.log_file, 'a')
            except IOError as ioe:
                msg = 'Error: Unable to write to log file: %s' % ioe
                raise ValueError(msg)
            writeable_log_file.close()

        # Ensure the pid file is writeable
        if self.options.pid_file:
            try:
                writeable_pid_file = open(self.options.pid_file, 'a')
            except IOError as ioe:
                msg = 'Error: Unable to write to pid file: %s' % ioe
                raise ValueError(msg)
            writeable_pid_file.close()

        if getattr(self.options, 'daemon', False):
            try:
                self.daemonize()
            except DaemonizeException as ex:
                if self.options.verbose > 0:
                    self.out(str(ex))
                return 2

        if (self.options.monitor_restart
            and not os.environ.get(self._monitor_environ_key)):
            return self.restart_with_monitor()

        if self.options.pid_file:
            self.record_pid(self.options.pid_file)

        if self.options.log_file:
            stdout_log = LazyWriter(self.options.log_file, 'a')
            sys.stdout = stdout_log
            sys.stderr = stdout_log
            logging.basicConfig(stream=stdout_log)

        log_fn = app_spec
        if log_fn.startswith('config:'):
            log_fn = app_spec[len('config:'):]
        elif log_fn.startswith('egg:'):
            log_fn = None
        if log_fn:
            log_fn = os.path.join(base, log_fn)
            setup_logging(log_fn)

        server = self.loadserver(server_spec, name=server_name,
                                 relative_to=base, global_conf=vars)

        app = self.loadapp(app_spec, name=app_name, relative_to=base,
                global_conf=vars)

        if self.options.verbose > 0:
            if hasattr(os, 'getpid'):
                msg = 'Starting server in PID %i.' % os.getpid()
            else:
                msg = 'Starting server.'
            self.out(msg)

        def serve():
            try:
                server(app)
            except (SystemExit, KeyboardInterrupt) as e:
                if self.options.verbose > 1:
                    raise
                if str(e):
                    msg = ' ' + str(e)
                else:
                    msg = ''
                self.out('Exiting%s (-v to see traceback)' % msg)

        serve()

    def loadapp(self, app_spec, name, relative_to, **kw): # pragma: no cover
        return loadapp(app_spec, name=name, relative_to=relative_to, **kw)

    def loadserver(self, server_spec, name, relative_to, **kw):# pragma:no cover
        return loadserver(
            server_spec, name=name, relative_to=relative_to, **kw)

    def quote_first_command_arg(self, arg): # pragma: no cover
        """
        There's a bug in Windows when running an executable that's
        located inside a path with a space in it.  This method handles
        that case, or on non-Windows systems or an executable with no
        spaces, it just leaves well enough alone.
        """
        if (sys.platform != 'win32' or ' ' not in arg):
            # Problem does not apply:
            return arg
        try:
            import win32api
        except ImportError:
            raise ValueError(
                "The executable %r contains a space, and in order to "
                "handle this issue you must have the win32api module "
                "installed" % arg)
        arg = win32api.GetShortPathName(arg)
        return arg

    def daemonize(self): # pragma: no cover
        pid = live_pidfile(self.options.pid_file)
        if pid:
            raise DaemonizeException(
                "Daemon is already running (PID: %s from PID file %s)"
                % (pid, self.options.pid_file))

        if self.options.verbose > 0:
            self.out('Entering daemon mode')
        pid = os.fork()
        if pid:
            # The forked process also has a handle on resources, so we
            # *don't* want proper termination of the process, we just
            # want to exit quick (which os._exit() does)
            os._exit(0)
        # Make this the session leader
        os.setsid()
        # Fork again for good measure!
        pid = os.fork()
        if pid:
            os._exit(0)

        # @@: Should we set the umask and cwd now?

        import resource  # Resource usage information.
        maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]
        if (maxfd == resource.RLIM_INFINITY):
            maxfd = MAXFD
        # Iterate through and close all file descriptors.
        for fd in range(0, maxfd):
            try:
                os.close(fd)
            except OSError:  # ERROR, fd wasn't open to begin with (ignored)
                pass

        if (hasattr(os, "devnull")):
            REDIRECT_TO = os.devnull
        else:
            REDIRECT_TO = "/dev/null"
        os.open(REDIRECT_TO, os.O_RDWR)  # standard input (0)
        # Duplicate standard input to standard output and standard error.
        os.dup2(0, 1)  # standard output (1)
        os.dup2(0, 2)  # standard error (2)

    def _remove_pid_file(self, written_pid, filename, verbosity):
        current_pid = os.getpid()
        if written_pid != current_pid:
            # A forked process must be exiting, not the process that
            # wrote the PID file
            return
        if not os.path.exists(filename):
            return
        with open(filename) as f:
            content = f.read().strip()
        try:
            pid_in_file = int(content)
        except ValueError:
            pass
        else:
            if pid_in_file != current_pid:
                msg = "PID file %s contains %s, not expected PID %s"
                self.out(msg % (filename, pid_in_file, current_pid))
                return
        if verbosity > 0:
            self.out("Removing PID file %s" % filename)
        try:
            os.unlink(filename)
            return
        except OSError as e:
            # Record, but don't give traceback
            self.out("Cannot remove PID file: (%s)" % e)
        # well, at least lets not leave the invalid PID around...
        try:
            with open(filename, 'w') as f:
                f.write('')
        except OSError as e:
            self.out('Stale PID left in file: %s (%s)' % (filename, e))
        else:
            self.out('Stale PID removed')

    def record_pid(self, pid_file):
        pid = os.getpid()
        if self.options.verbose > 1:
            self.out('Writing PID %s to %s' % (pid, pid_file))
        with open(pid_file, 'w') as f:
            f.write(str(pid))
        atexit.register(self._remove_pid_file, pid, pid_file, self.options.verbose)

    def stop_daemon(self): # pragma: no cover
        pid_file = self.options.pid_file or 'pyramid.pid'
        if not os.path.exists(pid_file):
            self.out('No PID file exists in %s' % pid_file)
            return 1
        pid = read_pidfile(pid_file)
        if not pid:
            self.out("Not a valid PID file in %s" % pid_file)
            return 1
        pid = live_pidfile(pid_file)
        if not pid:
            self.out("PID in %s is not valid (deleting)" % pid_file)
            try:
                os.unlink(pid_file)
            except (OSError, IOError) as e:
                self.out("Could not delete: %s" % e)
                return 2
            return 1
        for j in range(10):
            if not live_pidfile(pid_file):
                break
            import signal
            kill(pid, signal.SIGTERM)
            time.sleep(1)
        else:
            self.out("failed to kill web process %s" % pid)
            return 3
        if os.path.exists(pid_file):
            os.unlink(pid_file)
        return 0

    def show_status(self): # pragma: no cover
        pid_file = self.options.pid_file or 'pyramid.pid'
        if not os.path.exists(pid_file):
            self.out('No PID file %s' % pid_file)
            return 1
        pid = read_pidfile(pid_file)
        if not pid:
            self.out('No PID in file %s' % pid_file)
            return 1
        pid = live_pidfile(pid_file)
        if not pid:
            self.out('PID %s in %s is not running' % (pid, pid_file))
            return 1
        self.out('Server running in PID %s' % pid)
        return 0

    def restart_with_reloader(self): # pragma: no cover
        self.restart_with_monitor(reloader=True)

    def restart_with_monitor(self, reloader=False): # pragma: no cover
        if self.options.verbose > 0:
            if reloader:
                self.out('Starting subprocess with file monitor')
            else:
                self.out('Starting subprocess with monitor parent')
        while 1:
            args = [self.quote_first_command_arg(sys.executable)] + sys.argv
            new_environ = os.environ.copy()
            if reloader:
                new_environ[self._reloader_environ_key] = 'true'
            else:
                new_environ[self._monitor_environ_key] = 'true'
            proc = None
            try:
                try:
                    _turn_sigterm_into_systemexit()
                    proc = subprocess.Popen(args, env=new_environ)
                    exit_code = proc.wait()
                    proc = None
                except KeyboardInterrupt:
                    self.out('^C caught in monitor process')
                    if self.options.verbose > 1:
                        raise
                    return 1
            finally:
                if proc is not None:
                    import signal
                    try:
                        kill(proc.pid, signal.SIGTERM)
                    except (OSError, IOError):
                        pass

            if reloader:
                # Reloader always exits with code 3; but if we are
                # a monitor, any exit code will restart
                if exit_code != 3:
                    return exit_code
            if self.options.verbose > 0:
                self.out('%s %s %s' % ('-' * 20, 'Restarting', '-' * 20))

    def change_user_group(self, user, group): # pragma: no cover
        if not user and not group:
            return
        import pwd, grp
        uid = gid = None
        if group:
            try:
                gid = int(group)
                group = grp.getgrgid(gid).gr_name
            except ValueError:
                import grp
                try:
                    entry = grp.getgrnam(group)
                except KeyError:
                    raise ValueError(
                        "Bad group: %r; no such group exists" % group)
                gid = entry.gr_gid
        try:
            uid = int(user)
            user = pwd.getpwuid(uid).pw_name
        except ValueError:
            try:
                entry = pwd.getpwnam(user)
            except KeyError:
                raise ValueError(
                    "Bad username: %r; no such user exists" % user)
            if not gid:
                gid = entry.pw_gid
            uid = entry.pw_uid
        if self.options.verbose > 0:
            self.out('Changing user to %s:%s (%s:%s)' % (
                user, group or '(unknown)', uid, gid))
        if gid:
            os.setgid(gid)
        if uid:
            os.setuid(uid)

class LazyWriter(object):

    """
    File-like object that opens a file lazily when it is first written
    to.
    """

    def __init__(self, filename, mode='w'):
        self.filename = filename
        self.fileobj = None
        self.lock = threading.Lock()
        self.mode = mode

    def open(self):
        if self.fileobj is None:
            with self.lock:
                self.fileobj = open(self.filename, self.mode)
        return self.fileobj

    def close(self):
        fileobj = self.fileobj
        if fileobj is not None:
            fileobj.close()

    def __del__(self):
        self.close()

    def write(self, text):
        fileobj = self.open()
        fileobj.write(text)
        fileobj.flush()

    def writelines(self, text):
        fileobj = self.open()
        fileobj.writelines(text)
        fileobj.flush()

    def flush(self):
        self.open().flush()

def live_pidfile(pidfile): # pragma: no cover
    """(pidfile:str) -> int | None
    Returns an int found in the named file, if there is one,
    and if there is a running process with that process id.
    Return None if no such process exists.
    """
    pid = read_pidfile(pidfile)
    if pid:
        try:
            kill(int(pid), 0)
            return pid
        except OSError as e:
            if e.errno == errno.EPERM:
                return pid
    return None

def read_pidfile(filename):
    if os.path.exists(filename):
        try:
            with open(filename) as f:
                content = f.read()
            return int(content.strip())
        except (ValueError, IOError):
            return None
    else:
        return None

def ensure_port_cleanup(
    bound_addresses, maxtries=30, sleeptime=2): # pragma: no cover
    """
    This makes sure any open ports are closed.

    Does this by connecting to them until they give connection
    refused.  Servers should call like::

        ensure_port_cleanup([80, 443])
    """
    atexit.register(_cleanup_ports, bound_addresses, maxtries=maxtries,
                    sleeptime=sleeptime)

def _cleanup_ports(
    bound_addresses, maxtries=30, sleeptime=2): # pragma: no cover
    # Wait for the server to bind to the port.
    import socket
    import errno
    for bound_address in bound_addresses:
        for attempt in range(maxtries):
            sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            try:
                sock.connect(bound_address)
            except socket.error as e:
                if e.args[0] != errno.ECONNREFUSED:
                    raise
                break
            else:
                time.sleep(sleeptime)
        else:
            raise SystemExit('Timeout waiting for port.')
        sock.close()

def _turn_sigterm_into_systemexit(): # pragma: no cover
    """
    Attempts to turn a SIGTERM exception into a SystemExit exception.
    """
    try:
        import signal
    except ImportError:
        return
    def handle_term(signo, frame):
        raise SystemExit
    signal.signal(signal.SIGTERM, handle_term)

def install_reloader(poll_interval=1, extra_files=None): # pragma: no cover
    """
    Install the reloading monitor.

    On some platforms server threads may not terminate when the main
    thread does, causing ports to remain open/locked.  The
    ``raise_keyboard_interrupt`` option creates a unignorable signal
    which causes the whole application to shut-down (rudely).
    """
    mon = Monitor(poll_interval=poll_interval)
    if extra_files is None:
        extra_files = []
    mon.extra_files.extend(extra_files)
    t = threading.Thread(target=mon.periodic_reload)
    t.setDaemon(True)
    t.start()

class classinstancemethod(object):
    """
    Acts like a class method when called from a class, like an
    instance method when called by an instance.  The method should
    take two arguments, 'self' and 'cls'; one of these will be None
    depending on how the method was called.
    """

    def __init__(self, func):
        self.func = func
        self.__doc__ = func.__doc__

    def __get__(self, obj, type=None):
        return _methodwrapper(self.func, obj=obj, type=type)

class _methodwrapper(object):

    def __init__(self, func, obj, type):
        self.func = func
        self.obj = obj
        self.type = type

    def __call__(self, *args, **kw):
        assert not 'self' in kw and not 'cls' in kw, (
            "You cannot use 'self' or 'cls' arguments to a "
            "classinstancemethod")
        return self.func(*((self.obj, self.type) + args), **kw)

class Monitor(object): # pragma: no cover
    """
    A file monitor and server restarter.

    Use this like:

    ..code-block:: Python

        install_reloader()

    Then make sure your server is installed with a shell script like::

        err=3
        while test "$err" -eq 3 ; do
            python server.py
            err="$?"
        done

    or is run from this .bat file (if you use Windows)::

        @echo off
        :repeat
            python server.py
        if %errorlevel% == 3 goto repeat

    or run a monitoring process in Python (``pserve --reload`` does
    this).  

    Use the ``watch_file(filename)`` function to cause a reload/restart for
    other non-Python files (e.g., configuration files).  If you have
    a dynamic set of files that grows over time you can use something like::

        def watch_config_files():
            return CONFIG_FILE_CACHE.keys()
        add_file_callback(watch_config_files)

    Then every time the reloader polls files it will call
    ``watch_config_files`` and check all the filenames it returns.
    """
    instances = []
    global_extra_files = []
    global_file_callbacks = []

    def __init__(self, poll_interval):
        self.module_mtimes = {}
        self.keep_running = True
        self.poll_interval = poll_interval
        self.extra_files = list(self.global_extra_files)
        self.instances.append(self)
        self.file_callbacks = list(self.global_file_callbacks)

    def _exit(self):
        # use os._exit() here and not sys.exit() since within a
        # thread sys.exit() just closes the given thread and
        # won't kill the process; note os._exit does not call
        # any atexit callbacks, nor does it do finally blocks,
        # flush open files, etc.  In otherwords, it is rude.
        os._exit(3)

    def periodic_reload(self):
        while True:
            if not self.check_reload():
                self._exit()
                break
            time.sleep(self.poll_interval)

    def check_reload(self):
        filenames = list(self.extra_files)
        for file_callback in self.file_callbacks:
            try:
                filenames.extend(file_callback())
            except:
                print(
                    "Error calling reloader callback %r:" % file_callback)
                traceback.print_exc()
        for module in sys.modules.values():
            try:
                filename = module.__file__
            except (AttributeError, ImportError):
                continue
            if filename is not None:
                filenames.append(filename)
        for filename in filenames:
            try:
                stat = os.stat(filename)
                if stat:
                    mtime = stat.st_mtime
                else:
                    mtime = 0
            except (OSError, IOError):
                continue
            if filename.endswith('.pyc') and os.path.exists(filename[:-1]):
                mtime = max(os.stat(filename[:-1]).st_mtime, mtime)
            if not filename in self.module_mtimes:
                self.module_mtimes[filename] = mtime
            elif self.module_mtimes[filename] < mtime:
                print("%s changed; reloading..." % filename)
                return False
        return True

    def watch_file(self, cls, filename):
        """Watch the named file for changes"""
        filename = os.path.abspath(filename)
        if self is None:
            for instance in cls.instances:
                instance.watch_file(filename)
            cls.global_extra_files.append(filename)
        else:
            self.extra_files.append(filename)

    watch_file = classinstancemethod(watch_file)

    def add_file_callback(self, cls, callback):
        """Add a callback -- a function that takes no parameters -- that will
        return a list of filenames to watch for changes."""
        if self is None:
            for instance in cls.instances:
                instance.add_file_callback(callback)
            cls.global_file_callbacks.append(callback)
        else:
            self.file_callbacks.append(callback)

    add_file_callback = classinstancemethod(add_file_callback)

watch_file = Monitor.watch_file
add_file_callback = Monitor.add_file_callback

# For paste.deploy server instantiation (egg:pyramid#wsgiref)
def wsgiref_server_runner(wsgi_app, global_conf, **kw): # pragma: no cover
    from wsgiref.simple_server import make_server
    host = kw.get('host', '0.0.0.0')
    port = int(kw.get('port', 8080))
    server = make_server(host, port, wsgi_app)
    print('Starting HTTP server on http://%s:%s' % (host, port))
    server.serve_forever()

# For paste.deploy server instantiation (egg:pyramid#cherrypy)
def cherrypy_server_runner(
        app, global_conf=None, host='127.0.0.1', port=None,
        ssl_pem=None, protocol_version=None, numthreads=None,
        server_name=None, max=None, request_queue_size=None,
        timeout=None
        ): # pragma: no cover
    """
    Entry point for CherryPy's WSGI server

    Serves the specified WSGI app via CherryPyWSGIServer.

    ``app``

        The WSGI 'application callable'; multiple WSGI applications
        may be passed as (script_name, callable) pairs.

    ``host``

        This is the ipaddress to bind to (or a hostname if your
        nameserver is properly configured).  This defaults to
        127.0.0.1, which is not a public interface.

    ``port``

        The port to run on, defaults to 8080 for HTTP, or 4443 for
        HTTPS. This can be a string or an integer value.

    ``ssl_pem``

        This an optional SSL certificate file (via OpenSSL) You can
        generate a self-signed test PEM certificate file as follows:

            $ openssl genrsa 1024 > host.key
            $ chmod 400 host.key
            $ openssl req -new -x509 -nodes -sha1 -days 365  \\
                          -key host.key > host.cert
            $ cat host.cert host.key > host.pem
            $ chmod 400 host.pem

    ``protocol_version``

        The protocol used by the server, by default ``HTTP/1.1``.

    ``numthreads``

        The number of worker threads to create.

    ``server_name``

        The string to set for WSGI's SERVER_NAME environ entry.

    ``max``

        The maximum number of queued requests. (defaults to -1 = no
        limit).

    ``request_queue_size``

        The 'backlog' argument to socket.listen(); specifies the
        maximum number of queued connections.

    ``timeout``

        The timeout in seconds for accepted connections.
    """
    is_ssl = False
    if ssl_pem:
        port = port or 4443
        is_ssl = True

    if not port:
        if ':' in host:
            host, port = host.split(':', 1)
        else:
            port = 8080
    bind_addr = (host, int(port))

    kwargs = {}
    for var_name in ('numthreads', 'max', 'request_queue_size', 'timeout'):
        var = locals()[var_name]
        if var is not None:
            kwargs[var_name] = int(var)

    from cherrypy import wsgiserver

    server = wsgiserver.CherryPyWSGIServer(bind_addr, app,
                                           server_name=server_name, **kwargs)
    server.ssl_certificate = server.ssl_private_key = ssl_pem
    if protocol_version:
        server.protocol = protocol_version

    try:
        protocol = is_ssl and 'https' or 'http'
        if host == '0.0.0.0':
            print('serving on 0.0.0.0:%s view at %s://127.0.0.1:%s' %
                  (port, protocol, port))
        else:
            print('serving on %s://%s:%s' % (protocol, host, port))
        server.start()
    except (KeyboardInterrupt, SystemExit):
        server.stop()

    return server

```
--- 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:** Passing `quiet` Argument to `pserve.main` Causes TypeError

**Description:**
When attempting to run the server with the `quiet` option, a `TypeError` is raised because the `main` function does not accept the `quiet` keyword argument.

**Example Buggy Code:**
```python
from pyramid.scripts.pserve import main

def test_pserve_quiet_option():
    argv = ['pserve']
    result = main(argv, quiet=True)
```

**Expected Behavior:**
The server should run with the verbose output level set to `0` when the `quiet` argument is provided, without raising any errors.

**Actual Behavior:**
A `TypeError` is raised indicating that the `main()` function received an unexpected keyword argument `quiet`:

```
TypeError: main() got an unexpected keyword argument 'quiet'
```
[/ISSUE]
{
    "TestPServeCommand.test_get_options_no_command": "PASSED",
    "TestPServeCommand.test_get_options_with_command": "PASSED",
    "TestPServeCommand.test_parse_vars_bad": "PASSED",
    "TestPServeCommand.test_parse_vars_good": "PASSED",
    "TestPServeCommand.test_record_pid_not_verbose": "PASSED",
    "TestPServeCommand.test_record_pid_verbose": "PASSED",
    "TestPServeCommand.test_remove_pid_current_pid_is_not_pid_in_file": "PASSED",
    "TestPServeCommand.test_remove_pid_current_pid_is_not_written_pid": "PASSED",
    "TestPServeCommand.test_remove_pid_file_not_verbose": "PASSED",
    "TestPServeCommand.test_remove_pid_file_stale_pid_write_exception": "PASSED",
    "TestPServeCommand.test_remove_pid_file_unlink_exception": "PASSED",
    "TestPServeCommand.test_remove_pid_file_verbose": "PASSED",
    "TestPServeCommand.test_remove_pid_no_pid_file": "PASSED",
    "TestPServeCommand.test_remove_pid_not_a_number": "PASSED",
    "TestPServeCommand.test_run_no_args": "PASSED",
    "TestPServeCommand.test_run_stop_daemon_bad_pid_file": "PASSED",
    "TestPServeCommand.test_run_stop_daemon_invalid_pid_in_file": "PASSED",
    "TestPServeCommand.test_run_stop_daemon_no_such_pid_file": "PASSED",
    "Test_read_pidfile.test_read_pidfile": "PASSED",
    "Test_read_pidfile.test_read_pidfile_no_pid_file": "PASSED",
    "Test_read_pidfile.test_read_pidfile_not_a_number": "PASSED",
    "Test_main.test_it": "PASSED",
    "TestLazyWriter.test_flush": "PASSED",
    "TestLazyWriter.test_open": "PASSED",
    "TestLazyWriter.test_write": "PASSED",
    "TestLazyWriter.test_writeline": "PASSED",
    "Test__methodwrapper.test___call__fail": "PASSED",
    "Test__methodwrapper.test___call__succeed": "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_directory": "PASSED",
    "TestAssetsConfiguratorMixin.test_override_asset_directory_with_file": "PASSED",
    "TestAssetsConfiguratorMixin.test_override_asset_directory_with_package": "PASSED",
    "TestAssetsConfiguratorMixin.test_override_asset_file_with_directory": "PASSED",
    "TestAssetsConfiguratorMixin.test_override_asset_file_with_file": "PASSED",
    "TestAssetsConfiguratorMixin.test_override_asset_file_with_package": "PASSED",
    "TestAssetsConfiguratorMixin.test_override_asset_package_with_directory": "PASSED",
    "TestAssetsConfiguratorMixin.test_override_asset_package_with_package": "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_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_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",
    "TestPackageOverrides.test_search_path": "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_unnamed_callable": "PASSED",
    "TestFactoriesMixin.test_set_multiple_request_methods_conflict": "PASSED",
    "TestFactoriesMixin.test_set_multiple_request_properties": "PASSED",
    "TestFactoriesMixin.test_set_multiple_request_properties_conflict": "PASSED",
    "TestFactoriesMixin.test_set_request_factory": "PASSED",
    "TestFactoriesMixin.test_set_request_factory_dottedname": "PASSED",
    "TestFactoriesMixin.test_set_request_property_with_callable": "PASSED",
    "TestFactoriesMixin.test_set_request_property_with_property": "PASSED",
    "TestFactoriesMixin.test_set_request_property_with_unnamed_callable": "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",
    "TestI18NConfiguratorMixin.test_add_translation_dirs_missing_dir": "PASSED",
    "TestI18NConfiguratorMixin.test_add_translation_dirs_no_specs": "PASSED",
    "TestI18NConfiguratorMixin.test_add_translation_dirs_registers_chameleon_translate": "PASSED",
    "TestI18NConfiguratorMixin.test_set_locale_negotiator": "PASSED",
    "TestI18NConfiguratorMixin.test_set_locale_negotiator_dottedname": "PASSED",
    "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_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_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_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_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_scan_integration_with_onerror": "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_renderer_globals_factory": "PASSED",
    "ConfiguratorTests.test_setup_registry_renderer_globals_factory_dottedname": "PASSED",
    "ConfiguratorTests.test_setup_registry_request_factory": "PASSED",
    "ConfiguratorTests.test_setup_registry_request_factory_dottedname": "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",
    "TestConfiguratorDeprecatedFeatures.test_add_route_with_for_": "PASSED",
    "TestConfiguratorDeprecatedFeatures.test_add_route_with_view": "PASSED",
    "TestConfiguratorDeprecatedFeatures.test_add_route_with_view_attr": "PASSED",
    "TestConfiguratorDeprecatedFeatures.test_add_route_with_view_context": "PASSED",
    "TestConfiguratorDeprecatedFeatures.test_add_route_with_view_exception": "PASSED",
    "TestConfiguratorDeprecatedFeatures.test_add_route_with_view_for": "PASSED",
    "TestConfiguratorDeprecatedFeatures.test_add_route_with_view_permission": "PASSED",
    "TestConfiguratorDeprecatedFeatures.test_add_route_with_view_permission_alias": "PASSED",
    "TestConfiguratorDeprecatedFeatures.test_add_route_with_view_renderer": "PASSED",
    "TestConfiguratorDeprecatedFeatures.test_add_route_with_view_renderer_alias": "PASSED",
    "TestConfiguratorDeprecatedFeatures.test_conflict_route_with_view": "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",
    "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_it": "PASSED",
    "TestActionState.test_processSpec": "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",
    "TestGlobalRegistriesIntegration.test_global_registries": "PASSED",
    "TestGlobalRegistriesIntegration.test_global_registries_empty": "PASSED",
    "TestXHRPredicate.test___call___false": "PASSED",
    "TestXHRPredicate.test___call___true": "PASSED",
    "TestXHRPredicate.test_phash": "PASSED",
    "TestXHRPredicate.test_text": "PASSED",
    "TestRequestMethodPredicate.test___call___false": "PASSED",
    "TestRequestMethodPredicate.test___call___true_multi": "PASSED",
    "TestRequestMethodPredicate.test___call___true_single": "PASSED",
    "TestRequestMethodPredicate.test_ctor_get_but_no_head": "PASSED",
    "TestRequestMethodPredicate.test_phash": "PASSED",
    "TestRequestMethodPredicate.test_text": "PASSED",
    "TestPathInfoPredicate.test___call___false": "PASSED",
    "TestPathInfoPredicate.test___call___true": "PASSED",
    "TestPathInfoPredicate.test_ctor_compilefail": "PASSED",
    "TestPathInfoPredicate.test_phash": "PASSED",
    "TestPathInfoPredicate.test_text": "PASSED",
    "TestRequestParamPredicate.test___call___false": "PASSED",
    "TestRequestParamPredicate.test___call___false_multi": "PASSED",
    "TestRequestParamPredicate.test___call___true_exists": "PASSED",
    "TestRequestParamPredicate.test___call___true_multi": "PASSED",
    "TestRequestParamPredicate.test___call___true_withval": "PASSED",
    "TestRequestParamPredicate.test_phash_exists": "PASSED",
    "TestRequestParamPredicate.test_phash_withval": "PASSED",
    "TestRequestParamPredicate.test_text_exists": "PASSED",
    "TestRequestParamPredicate.test_text_multi": "PASSED",
    "TestRequestParamPredicate.test_text_withval": "PASSED",
    "TestMatchParamPredicate.test___call___false": "PASSED",
    "TestMatchParamPredicate.test___call___matchdict_is_None": "PASSED",
    "TestMatchParamPredicate.test___call___true_multi": "PASSED",
    "TestMatchParamPredicate.test___call___true_single": "PASSED",
    "TestMatchParamPredicate.test_phash": "PASSED",
    "TestMatchParamPredicate.test_text": "PASSED",
    "TestCustomPredicate.test___call___false": "PASSED",
    "TestCustomPredicate.test___call___true": "PASSED",
    "TestCustomPredicate.test_phash": "PASSED",
    "TestCustomPredicate.test_text_func_has___text__": "PASSED",
    "TestCustomPredicate.test_text_func_repr": "PASSED",
    "TestTraversePredicate.test___call__traverse_has_remainder_already": "PASSED",
    "TestTraversePredicate.test___call__traverse_matches": "PASSED",
    "TestTraversePredicate.test___call__traverse_matches_with_highorder_chars": "PASSED",
    "TestTraversePredicate.test_phash": "PASSED",
    "TestTraversePredicate.test_text": "PASSED",
    "Test_CheckCSRFTokenPredicate.test_it_call_val_False": "PASSED",
    "Test_CheckCSRFTokenPredicate.test_it_call_val_True": "PASSED",
    "Test_CheckCSRFTokenPredicate.test_it_call_val_str": "PASSED",
    "Test_CheckCSRFTokenPredicate.test_phash": "PASSED",
    "Test_CheckCSRFTokenPredicate.test_text": "PASSED",
    "TestHeaderPredicate.test___call___false": "PASSED",
    "TestHeaderPredicate.test___call___false_withregex": "PASSED",
    "TestHeaderPredicate.test___call___true_exists": "PASSED",
    "TestHeaderPredicate.test___call___true_withregex": "PASSED",
    "TestHeaderPredicate.test___call___true_withval": "PASSED",
    "TestHeaderPredicate.test_phash_exists": "PASSED",
    "TestHeaderPredicate.test_phash_withregex": "PASSED",
    "TestHeaderPredicate.test_phash_withval": "PASSED",
    "TestHeaderPredicate.test_text_exists": "PASSED",
    "TestHeaderPredicate.test_text_withregex": "PASSED",
    "TestHeaderPredicate.test_text_withval": "PASSED",
    "Test_PhysicalPathPredicate.test_it_call_False": "PASSED",
    "Test_PhysicalPathPredicate.test_it_call_context_has_no_name": "PASSED",
    "Test_PhysicalPathPredicate.test_it_call_val_list_True": "PASSED",
    "Test_PhysicalPathPredicate.test_it_call_val_str_True": "PASSED",
    "Test_PhysicalPathPredicate.test_it_call_val_tuple_True": "PASSED",
    "Test_PhysicalPathPredicate.test_phash": "PASSED",
    "Test_PhysicalPathPredicate.test_text": "PASSED",
    "Test_EffectivePrincipalsPredicate.test_it_call_authentication_policy_doesnt_provide_superset": "PASSED",
    "Test_EffectivePrincipalsPredicate.test_it_call_authentication_policy_provides_superset": "PASSED",
    "Test_EffectivePrincipalsPredicate.test_it_call_authentication_policy_provides_superset_implicit": "PASSED",
    "Test_EffectivePrincipalsPredicate.test_it_call_no_authentication_policy": "PASSED",
    "Test_EffectivePrincipalsPredicate.test_phash": "PASSED",
    "Test_EffectivePrincipalsPredicate.test_text": "PASSED",
    "Test_EffectivePrincipalsPredicate.test_text_noniter": "PASSED",
    "TestRenderingConfiguratorMixin.test_add_renderer": "PASSED",
    "TestRenderingConfiguratorMixin.test_add_renderer_dottedname_factory": "PASSED",
    "TestRenderingConfiguratorMixin.test_set_renderer_globals_factory": "PASSED",
    "TestRenderingConfiguratorMixin.test_set_renderer_globals_factory_dottedname": "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_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_permission": "PASSED",
    "TestSettingsConfiguratorMixin.test__set_settings_as_None": "PASSED",
    "TestSettingsConfiguratorMixin.test__set_settings_as_dictwithvalues": "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",
    "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_getattr_fail": "PASSED",
    "TestSettings.test_getattr_raises_attribute_error": "PASSED",
    "TestSettings.test_getattr_success": "PASSED",
    "TestSettings.test_noargs": "PASSED",
    "TestSettings.test_originals_kept": "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_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",
    "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_http_cache": "PASSED",
    "TestViewsConfigurationMixin.test_add_forbidden_view_disallows_name": "PASSED",
    "TestViewsConfigurationMixin.test_add_forbidden_view_disallows_permission": "PASSED",
    "TestViewsConfigurationMixin.test_add_forbidden_view_with_renderer": "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_disallows_context": "PASSED",
    "TestViewsConfigurationMixin.test_add_notfound_view_disallows_for_": "PASSED",
    "TestViewsConfigurationMixin.test_add_notfound_view_disallows_http_cache": "PASSED",
    "TestViewsConfigurationMixin.test_add_notfound_view_disallows_name": "PASSED",
    "TestViewsConfigurationMixin.test_add_notfound_view_disallows_permission": "PASSED",
    "TestViewsConfigurationMixin.test_add_notfound_view_with_renderer": "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_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_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_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_containment_dottedname": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_containment_false": "PASSED",
    "TestViewsConfigurationMixin.test_add_view_with_containment_true": "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_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_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",
    "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",
    "TestViewDeriver.test_as_function_context_and_request": "PASSED",
    "TestViewDeriver.test_as_function_requestonly": "PASSED",
    "TestViewDeriver.test_as_instance_context_and_request": "PASSED",
    "TestViewDeriver.test_as_instance_context_and_request_attr_and_renderer": "PASSED",
    "TestViewDeriver.test_as_instance_requestonly": "PASSED",
    "TestViewDeriver.test_as_instance_requestonly_attr_and_renderer": "PASSED",
    "TestViewDeriver.test_as_newstyle_class_context_and_request": "PASSED",
    "TestViewDeriver.test_as_newstyle_class_context_and_request_attr_and_renderer": "PASSED",
    "TestViewDeriver.test_as_newstyle_class_requestonly": "PASSED",
    "TestViewDeriver.test_as_newstyle_class_requestonly_attr_and_renderer": "PASSED",
    "TestViewDeriver.test_as_oldstyle_class_context_and_request": "PASSED",
    "TestViewDeriver.test_as_oldstyle_class_requestonly": "PASSED",
    "TestViewDeriver.test_as_oldstyle_cls_context_request_attr_and_renderer": "PASSED",
    "TestViewDeriver.test_as_oldstyle_cls_requestonly_attr_and_renderer": "PASSED",
    "TestViewDeriver.test_attr_wrapped_view_branching_default_phash": "PASSED",
    "TestViewDeriver.test_attr_wrapped_view_branching_nondefault_phash": "PASSED",
    "TestViewDeriver.test_class_with_attr": "PASSED",
    "TestViewDeriver.test_class_without_attr": "PASSED",
    "TestViewDeriver.test_debug_auth_permission_authpol_denied": "PASSED",
    "TestViewDeriver.test_debug_auth_permission_authpol_denied2": "PASSED",
    "TestViewDeriver.test_debug_auth_permission_authpol_overridden": "PASSED",
    "TestViewDeriver.test_debug_auth_permission_authpol_permitted": "PASSED",
    "TestViewDeriver.test_debug_auth_permission_authpol_permitted_no_request": "PASSED",
    "TestViewDeriver.test_function_returns_true_Response_no_renderer": "PASSED",
    "TestViewDeriver.test_function_returns_true_Response_with_renderer": "PASSED",
    "TestViewDeriver.test_http_cached_prevent_http_cache_in_settings": "PASSED",
    "TestViewDeriver.test_http_cached_view_bad_tuple": "PASSED",
    "TestViewDeriver.test_http_cached_view_integer": "PASSED",
    "TestViewDeriver.test_http_cached_view_prevent_auto_set": "PASSED",
    "TestViewDeriver.test_http_cached_view_timedelta": "PASSED",
    "TestViewDeriver.test_http_cached_view_tuple": "PASSED",
    "TestViewDeriver.test_http_cached_view_tuple_seconds_None": "PASSED",
    "TestViewDeriver.test_predicate_mismatch_exception_has_text_in_detail": "PASSED",
    "TestViewDeriver.test_predicate_mismatch_view_has_name": "PASSED",
    "TestViewDeriver.test_predicate_mismatch_view_has_no_name": "PASSED",
    "TestViewDeriver.test_requestonly_function": "PASSED",
    "TestViewDeriver.test_requestonly_function_with_renderer": "PASSED",
    "TestViewDeriver.test_requestonly_function_with_renderer_request_has_view": "PASSED",
    "TestViewDeriver.test_requestonly_function_with_renderer_request_override": "PASSED",
    "TestViewDeriver.test_secured_view_authn_policy_no_authz_policy": "PASSED",
    "TestViewDeriver.test_secured_view_authz_policy_no_authn_policy": "PASSED",
    "TestViewDeriver.test_secured_view_raises_forbidden_no_name": "PASSED",
    "TestViewDeriver.test_secured_view_raises_forbidden_with_name": "PASSED",
    "TestViewDeriver.test_with_debug_authorization_authn_policy_no_authz_policy": "PASSED",
    "TestViewDeriver.test_with_debug_authorization_authz_policy_no_authn_policy": "PASSED",
    "TestViewDeriver.test_with_debug_authorization_no_authpol": "PASSED",
    "TestViewDeriver.test_with_debug_authorization_no_permission": "PASSED",
    "TestViewDeriver.test_with_predicates_all": "PASSED",
    "TestViewDeriver.test_with_predicates_checker": "PASSED",
    "TestViewDeriver.test_with_predicates_notall": "PASSED",
    "TestViewDeriver.test_with_view_mapper_config_specified": "PASSED",
    "TestViewDeriver.test_with_view_mapper_default_mapper_specified": "PASSED",
    "TestViewDeriver.test_with_view_mapper_view_specified": "PASSED",
    "TestViewDeriver.test_with_wrapper_viewname": "PASSED",
    "TestViewDeriver.test_with_wrapper_viewname_notfound": "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_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_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_add_viewname_with_view_attr": "PASSED",
    "TestStaticURLInfo.test_add_viewname_with_view_context": "PASSED",
    "TestStaticURLInfo.test_add_viewname_with_view_for": "PASSED",
    "TestStaticURLInfo.test_add_viewname_with_view_permission": "PASSED",
    "TestStaticURLInfo.test_add_viewname_with_view_renderer": "PASSED",
    "TestStaticURLInfo.test_generate_missing": "PASSED",
    "TestStaticURLInfo.test_generate_quoting": "PASSED",
    "TestStaticURLInfo.test_generate_registration_miss": "PASSED",
    "TestStaticURLInfo.test_generate_registration_no_registry_on_request": "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_quoted_remote": "PASSED",
    "TestStaticURLInfo.test_generate_url_unquoted_local": "PASSED",
    "TestStaticURLInfo.test_verifyClass": "PASSED",
    "TestStaticURLInfo.test_verifyObject": "PASSED",
    "Test_view_description.test_with_text": "PASSED",
    "Test_logging_file_config.test_it": "PASSED",
    "TestParseVars.test_parse_vars_bad": "PASSED",
    "TestParseVars.test_parse_vars_good": "PASSED",
    "TestPCreateCommand.test_known_scaffold_absolute_path": "PASSED",
    "TestPCreateCommand.test_known_scaffold_multiple_rendered": "PASSED",
    "TestPCreateCommand.test_known_scaffold_single_rendered": "PASSED",
    "TestPCreateCommand.test_no_project_name": "PASSED",
    "TestPCreateCommand.test_run_no_scaffold_name": "PASSED",
    "TestPCreateCommand.test_run_show_scaffolds_exist": "PASSED",
    "TestPCreateCommand.test_run_show_scaffolds_none_exist": "PASSED",
    "TestPCreateCommand.test_unknown_scaffold_name": "PASSED",
    "TestPRequestCommand.test_command_has_bad_config_header": "PASSED",
    "TestPRequestCommand.test_command_not_enough_args": "PASSED",
    "TestPRequestCommand.test_command_response_has_no_charset": "PASSED",
    "TestPRoutesCommand.test__get_mapper": "PASSED",
    "TestPRoutesCommand.test_bad_args": "PASSED",
    "TestPRoutesCommand.test_good_args": "PASSED",
    "TestPRoutesCommand.test_no_mapper": "PASSED",
    "TestPRoutesCommand.test_no_routes": "PASSED",
    "TestPRoutesCommand.test_route_with_no_slash_prefix": "PASSED",
    "TestPRoutesCommand.test_single_route_no_route_registered": "PASSED",
    "TestPRoutesCommand.test_single_route_no_views_registered": "PASSED",
    "TestPRoutesCommand.test_single_route_one_view_registered": "PASSED",
    "TestPRoutesCommand.test_single_route_one_view_registered_with_factory": "PASSED",
    "TestPShellCommand.test_command_custom_section_override": "PASSED",
    "TestPShellCommand.test_command_loads_bpython_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_default_shell_with_unknown_shell": "PASSED",
    "TestPShellCommand.test_command_loads_ipython_v0_10": "PASSED",
    "TestPShellCommand.test_command_loads_ipython_v0_11": "PASSED",
    "TestPShellCommand.test_command_loads_setup_from_options": "PASSED",
    "TestPShellCommand.test_command_setup": "PASSED",
    "TestPShellCommand.test_make_bpython_shell": "PASSED",
    "TestPShellCommand.test_make_default_shell": "PASSED",
    "TestPShellCommand.test_make_ipython_v0_10_shell": "PASSED",
    "TestPShellCommand.test_make_ipython_v0_11_shell": "PASSED",
    "TestPShellCommand.test_shell_ipython_ordering": "PASSED",
    "TestPShellCommand.test_shell_ordering": "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",
    "AdaptersConfiguratorMixinTests.test_add_resource_url_adapter_dotted_names": "FAILED",
    "AdaptersConfiguratorMixinTests.test_add_resource_url_adapter_introspectables": "FAILED",
    "AdaptersConfiguratorMixinTests.test_add_traverser_dotted_names": "FAILED",
    "TestOverrideProvider.test_get_resource_filename_no_overrides": "FAILED",
    "TestOverrideProvider.test_get_resource_filename_override_returns_None": "FAILED",
    "TestPackageOverrides.test_get_filename": "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_multiple_specs": "FAILED",
    "TestI18NConfiguratorMixin.test_add_translation_dirs_multiple_specs_multiple_calls": "FAILED",
    "ConfiguratorTests.test_ctor_no_registry": "FAILED",
    "ConfiguratorTests.test_ctor_noreg_debug_logger_None_default": "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",
    "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",
    "TestViewDeriver.test_function_returns_non_adaptable": "FAILED",
    "TestViewDeriver.test_function_returns_non_adaptable_dict": "FAILED",
    "TestViewDeriver.test_instance_returns_non_adaptable": "FAILED",
    "TestViewDeriver.test_requestonly_default_method_returns_non_adaptable": "FAILED",
    "TestViewDeriver.test_requestonly_nondefault_method_returns_non_adaptable": "FAILED",
    "Test_view_description.test_without_text": "FAILED",
    "TestPRequestCommand.test_command_display_headers": "FAILED",
    "TestPRequestCommand.test_command_has_content_type_header_var": "FAILED",
    "TestPRequestCommand.test_command_has_good_header_var": "FAILED",
    "TestPRequestCommand.test_command_has_multiple_header_vars": "FAILED",
    "TestPRequestCommand.test_command_method_get": "FAILED",
    "TestPRequestCommand.test_command_method_options": "FAILED",
    "TestPRequestCommand.test_command_method_patch": "FAILED",
    "TestPRequestCommand.test_command_method_post": "FAILED",
    "TestPRequestCommand.test_command_method_propfind": "FAILED",
    "TestPRequestCommand.test_command_method_put": "FAILED",
    "TestPRequestCommand.test_command_path_doesnt_start_with_slash": "FAILED",
    "TestPRequestCommand.test_command_two_args": "FAILED",
    "TestPRequestCommand.test_command_w_basic_auth": "FAILED",
    "TestPRequestCommand.test_command_with_query_string": "FAILED",
    "TestPViewsCommand.test_views_command_single_view_function_traversal": "FAILED"
}
diff --git a/pyramid/scripts/pserve.py b/pyramid/scripts/pserve.py
index 89bfc765f..cc368d721 100644
--- a/pyramid/scripts/pserve.py
+++ b/pyramid/scripts/pserve.py
@@ -45,8 +45,8 @@ if WIN and not hasattr(os, 'kill'): # pragma: no cover
 else:
     kill = os.kill
 
-def main(argv=sys.argv):
-    command = PServeCommand(argv)
+def main(argv=sys.argv, quiet=False):
+    command = PServeCommand(argv, quiet=quiet)
     return command.run()
 
 class DaemonizeException(Exception):
@@ -165,11 +165,14 @@ class PServeCommand(object):
 
     possible_subcommands = ('start', 'stop', 'restart', 'status')
 
-    def __init__(self, argv):
+    def __init__(self, argv, quiet=False):
         self.options, self.args = self.parser.parse_args(argv[1:])
+        if quiet:
+            self.options.verbose = 0
 
     def out(self, msg): # pragma: no cover
-        print(msg)
+        if self.options.verbose > 0:
+            print(msg)
 
     def get_options(self):
         if (len(self.args) > 1

{"pyramid/scripts/pserve.py": "# (c) 2005 Ian Bicking and contributors; written for Paste\n# (http://pythonpaste.org) Licensed under the MIT license:\n# http://www.opensource.org/licenses/mit-license.php\n#\n# For discussion of daemonizing:\n# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/278731\n#\n# Code taken also from QP: http://www.mems-exchange.org/software/qp/ From\n# lib/site.py\n\nimport atexit\nimport ctypes\nimport errno\nimport logging\nimport optparse\nimport os\nimport re\nimport subprocess\nimport sys\nimport textwrap\nimport threading\nimport time\nimport traceback\n\nfrom paste.deploy import loadserver\nfrom paste.deploy import loadapp\n\nfrom pyramid.compat import WIN\n\nfrom pyramid.paster import setup_logging\n\nfrom pyramid.scripts.common import parse_vars\n\nMAXFD = 1024\n\nif WIN and not hasattr(os, 'kill'): # pragma: no cover\n    # py 2.6 on windows\n    def kill(pid, sig=None):\n        \"\"\"kill function for Win32\"\"\"\n        # signal is ignored, semibogus raise message\n        kernel32 = ctypes.windll.kernel32\n        handle = kernel32.OpenProcess(1, 0, pid)\n        if (0 == kernel32.TerminateProcess(handle, 0)):\n            raise OSError('No such process %s' % pid)\nelse:\n    kill = os.kill\n\ndef main(argv=sys.argv):\n    command = PServeCommand(argv)\n    return command.run()\n\nclass DaemonizeException(Exception):\n    pass\n\nclass PServeCommand(object):\n\n    usage = '%prog config_uri [start|stop|restart|status] [var=value]'\n    description = \"\"\"\\\n    This command serves a web application that uses a PasteDeploy\n    configuration file for the server and application.\n\n    If start/stop/restart is given, then --daemon is implied, and it will\n    start (normal operation), stop (--stop-daemon), or do both.\n\n    You can also include variable assignments like 'http_port=8080'\n    and then use %(http_port)s in your config files.\n    \"\"\"\n    default_verbosity = 1\n\n    parser = optparse.OptionParser(\n        usage,\n        description=textwrap.dedent(description)\n        )\n    parser.add_option(\n        '-n', '--app-name',\n        dest='app_name',\n        metavar='NAME',\n        help=\"Load the named application (default main)\")\n    parser.add_option(\n        '-s', '--server',\n        dest='server',\n        metavar='SERVER_TYPE',\n        help=\"Use the named server.\")\n    parser.add_option(\n        '--server-name',\n        dest='server_name',\n        metavar='SECTION_NAME',\n        help=(\"Use the named server as defined in the configuration file \"\n              \"(default: main)\"))\n    if hasattr(os, 'fork'):\n        parser.add_option(\n            '--daemon',\n            dest=\"daemon\",\n            action=\"store_true\",\n            help=\"Run in daemon (background) mode\")\n    parser.add_option(\n        '--pid-file',\n        dest='pid_file',\n        metavar='FILENAME',\n        help=(\"Save PID to file (default to pyramid.pid if running in \"\n              \"daemon mode)\"))\n    parser.add_option(\n        '--log-file',\n        dest='log_file',\n        metavar='LOG_FILE',\n        help=\"Save output to the given log file (redirects stdout)\")\n    parser.add_option(\n        '--reload',\n        dest='reload',\n        action='store_true',\n        help=\"Use auto-restart file monitor\")\n    parser.add_option(\n        '--reload-interval',\n        dest='reload_interval',\n        default=1,\n        help=(\"Seconds between checking files (low number can cause \"\n              \"significant CPU usage)\"))\n    parser.add_option(\n        '--monitor-restart',\n        dest='monitor_restart',\n        action='store_true',\n        help=\"Auto-restart server if it dies\")\n    parser.add_option(\n        '--status',\n        action='store_true',\n        dest='show_status',\n        help=\"Show the status of the (presumably daemonized) server\")\n    parser.add_option(\n        '-v', '--verbose',\n        default=default_verbosity,\n        dest='verbose',\n        action='count',\n        help=\"Set verbose level (default \"+str(default_verbosity)+\")\")\n    parser.add_option(\n        '-q', '--quiet',\n        action='store_const',\n        const=0,\n        dest='verbose',\n        help=\"Suppress verbose output\")\n\n    if hasattr(os, 'setuid'):\n        # I don't think these are available on Windows\n        parser.add_option(\n            '--user',\n            dest='set_user',\n            metavar=\"USERNAME\",\n            help=\"Set the user (usually only possible when run as root)\")\n        parser.add_option(\n            '--group',\n            dest='set_group',\n            metavar=\"GROUP\",\n            help=\"Set the group (usually only possible when run as root)\")\n\n    parser.add_option(\n        '--stop-daemon',\n        dest='stop_daemon',\n        action='store_true',\n        help=('Stop a daemonized server (given a PID file, or default '\n              'pyramid.pid file)'))\n\n    _scheme_re = re.compile(r'^[a-z][a-z]+:', re.I)\n\n    _reloader_environ_key = 'PYTHON_RELOADER_SHOULD_RUN'\n    _monitor_environ_key = 'PASTE_MONITOR_SHOULD_RUN'\n\n    possible_subcommands = ('start', 'stop', 'restart', 'status')\n\n    def __init__(self, argv):\n        self.options, self.args = self.parser.parse_args(argv[1:])\n\n    def out(self, msg): # pragma: no cover\n        print(msg)\n\n    def get_options(self):\n        if (len(self.args) > 1\n            and self.args[1] in self.possible_subcommands):\n            restvars = self.args[2:]\n        else:\n            restvars = self.args[1:]\n\n        return parse_vars(restvars)\n\n    def run(self): # pragma: no cover\n        if self.options.stop_daemon:\n            return self.stop_daemon()\n\n        if not hasattr(self.options, 'set_user'):\n            # Windows case:\n            self.options.set_user = self.options.set_group = None\n\n        # @@: Is this the right stage to set the user at?\n        self.change_user_group(\n            self.options.set_user, self.options.set_group)\n\n        if not self.args:\n            self.out('You must give a config file')\n            return 2\n        app_spec = self.args[0]\n\n        if (len(self.args) > 1\n            and self.args[1] in self.possible_subcommands):\n            cmd = self.args[1]\n        else:\n            cmd = None\n\n        if self.options.reload:\n            if os.environ.get(self._reloader_environ_key):\n                if self.options.verbose > 1:\n                    self.out('Running reloading file monitor')\n                install_reloader(int(self.options.reload_interval), [app_spec])\n                # if self.requires_config_file:\n                #     watch_file(self.args[0])\n            else:\n                return self.restart_with_reloader()\n\n        if cmd not in (None, 'start', 'stop', 'restart', 'status'):\n            self.out(\n                'Error: must give start|stop|restart (not %s)' % cmd)\n            return 2\n\n        if cmd == 'status' or self.options.show_status:\n            return self.show_status()\n\n        if cmd == 'restart' or cmd == 'stop':\n            result = self.stop_daemon()\n            if result:\n                if cmd == 'restart':\n                    self.out(\"Could not stop daemon; aborting\")\n                else:\n                    self.out(\"Could not stop daemon\")\n                return result\n            if cmd == 'stop':\n                return result\n            self.options.daemon = True\n\n        if cmd == 'start':\n            self.options.daemon = True\n\n        app_name = self.options.app_name\n\n        vars = self.get_options()\n\n        if not self._scheme_re.search(app_spec):\n            app_spec = 'config:' + app_spec\n        server_name = self.options.server_name\n        if self.options.server:\n            server_spec = 'egg:pyramid'\n            assert server_name is None\n            server_name = self.options.server\n        else:\n            server_spec = app_spec\n        base = os.getcwd()\n\n        if getattr(self.options, 'daemon', False):\n            if not self.options.pid_file:\n                self.options.pid_file = 'pyramid.pid'\n            if not self.options.log_file:\n                self.options.log_file = 'pyramid.log'\n\n        # Ensure the log file is writeable\n        if self.options.log_file:\n            try:\n                writeable_log_file = open(self.options.log_file, 'a')\n            except IOError as ioe:\n                msg = 'Error: Unable to write to log file: %s' % ioe\n                raise ValueError(msg)\n            writeable_log_file.close()\n\n        # Ensure the pid file is writeable\n        if self.options.pid_file:\n            try:\n                writeable_pid_file = open(self.options.pid_file, 'a')\n            except IOError as ioe:\n                msg = 'Error: Unable to write to pid file: %s' % ioe\n                raise ValueError(msg)\n            writeable_pid_file.close()\n\n        if getattr(self.options, 'daemon', False):\n            try:\n                self.daemonize()\n            except DaemonizeException as ex:\n                if self.options.verbose > 0:\n                    self.out(str(ex))\n                return 2\n\n        if (self.options.monitor_restart\n            and not os.environ.get(self._monitor_environ_key)):\n            return self.restart_with_monitor()\n\n        if self.options.pid_file:\n            self.record_pid(self.options.pid_file)\n\n        if self.options.log_file:\n            stdout_log = LazyWriter(self.options.log_file, 'a')\n            sys.stdout = stdout_log\n            sys.stderr = stdout_log\n            logging.basicConfig(stream=stdout_log)\n\n        log_fn = app_spec\n        if log_fn.startswith('config:'):\n            log_fn = app_spec[len('config:'):]\n        elif log_fn.startswith('egg:'):\n            log_fn = None\n        if log_fn:\n            log_fn = os.path.join(base, log_fn)\n            setup_logging(log_fn)\n\n        server = self.loadserver(server_spec, name=server_name,\n                                 relative_to=base, global_conf=vars)\n\n        app = self.loadapp(app_spec, name=app_name, relative_to=base,\n                global_conf=vars)\n\n        if self.options.verbose > 0:\n            if hasattr(os, 'getpid'):\n                msg = 'Starting server in PID %i.' % os.getpid()\n            else:\n                msg = 'Starting server.'\n            self.out(msg)\n\n        def serve():\n            try:\n                server(app)\n            except (SystemExit, KeyboardInterrupt) as e:\n                if self.options.verbose > 1:\n                    raise\n                if str(e):\n                    msg = ' ' + str(e)\n                else:\n                    msg = ''\n                self.out('Exiting%s (-v to see traceback)' % msg)\n\n        serve()\n\n    def loadapp(self, app_spec, name, relative_to, **kw): # pragma: no cover\n        return loadapp(app_spec, name=name, relative_to=relative_to, **kw)\n\n    def loadserver(self, server_spec, name, relative_to, **kw):# pragma:no cover\n        return loadserver(\n            server_spec, name=name, relative_to=relative_to, **kw)\n\n    def quote_first_command_arg(self, arg): # pragma: no cover\n        \"\"\"\n        There's a bug in Windows when running an executable that's\n        located inside a path with a space in it.  This method handles\n        that case, or on non-Windows systems or an executable with no\n        spaces, it just leaves well enough alone.\n        \"\"\"\n        if (sys.platform != 'win32' or ' ' not in arg):\n            # Problem does not apply:\n            return arg\n        try:\n            import win32api\n        except ImportError:\n            raise ValueError(\n                \"The executable %r contains a space, and in order to \"\n                \"handle this issue you must have the win32api module \"\n                \"installed\" % arg)\n        arg = win32api.GetShortPathName(arg)\n        return arg\n\n    def daemonize(self): # pragma: no cover\n        pid = live_pidfile(self.options.pid_file)\n        if pid:\n            raise DaemonizeException(\n                \"Daemon is already running (PID: %s from PID file %s)\"\n                % (pid, self.options.pid_file))\n\n        if self.options.verbose > 0:\n            self.out('Entering daemon mode')\n        pid = os.fork()\n        if pid:\n            # The forked process also has a handle on resources, so we\n            # *don't* want proper termination of the process, we just\n            # want to exit quick (which os._exit() does)\n            os._exit(0)\n        # Make this the session leader\n        os.setsid()\n        # Fork again for good measure!\n        pid = os.fork()\n        if pid:\n            os._exit(0)\n\n        # @@: Should we set the umask and cwd now?\n\n        import resource  # Resource usage information.\n        maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]\n        if (maxfd == resource.RLIM_INFINITY):\n            maxfd = MAXFD\n        # Iterate through and close all file descriptors.\n        for fd in range(0, maxfd):\n            try:\n                os.close(fd)\n            except OSError:  # ERROR, fd wasn't open to begin with (ignored)\n                pass\n\n        if (hasattr(os, \"devnull\")):\n            REDIRECT_TO = os.devnull\n        else:\n            REDIRECT_TO = \"/dev/null\"\n        os.open(REDIRECT_TO, os.O_RDWR)  # standard input (0)\n        # Duplicate standard input to standard output and standard error.\n        os.dup2(0, 1)  # standard output (1)\n        os.dup2(0, 2)  # standard error (2)\n\n    def _remove_pid_file(self, written_pid, filename, verbosity):\n        current_pid = os.getpid()\n        if written_pid != current_pid:\n            # A forked process must be exiting, not the process that\n            # wrote the PID file\n            return\n        if not os.path.exists(filename):\n            return\n        with open(filename) as f:\n            content = f.read().strip()\n        try:\n            pid_in_file = int(content)\n        except ValueError:\n            pass\n        else:\n            if pid_in_file != current_pid:\n                msg = \"PID file %s contains %s, not expected PID %s\"\n                self.out(msg % (filename, pid_in_file, current_pid))\n                return\n        if verbosity > 0:\n            self.out(\"Removing PID file %s\" % filename)\n        try:\n            os.unlink(filename)\n            return\n        except OSError as e:\n            # Record, but don't give traceback\n            self.out(\"Cannot remove PID file: (%s)\" % e)\n        # well, at least lets not leave the invalid PID around...\n        try:\n            with open(filename, 'w') as f:\n                f.write('')\n        except OSError as e:\n            self.out('Stale PID left in file: %s (%s)' % (filename, e))\n        else:\n            self.out('Stale PID removed')\n\n    def record_pid(self, pid_file):\n        pid = os.getpid()\n        if self.options.verbose > 1:\n            self.out('Writing PID %s to %s' % (pid, pid_file))\n        with open(pid_file, 'w') as f:\n            f.write(str(pid))\n        atexit.register(self._remove_pid_file, pid, pid_file, self.options.verbose)\n\n    def stop_daemon(self): # pragma: no cover\n        pid_file = self.options.pid_file or 'pyramid.pid'\n        if not os.path.exists(pid_file):\n            self.out('No PID file exists in %s' % pid_file)\n            return 1\n        pid = read_pidfile(pid_file)\n        if not pid:\n            self.out(\"Not a valid PID file in %s\" % pid_file)\n            return 1\n        pid = live_pidfile(pid_file)\n        if not pid:\n            self.out(\"PID in %s is not valid (deleting)\" % pid_file)\n            try:\n                os.unlink(pid_file)\n            except (OSError, IOError) as e:\n                self.out(\"Could not delete: %s\" % e)\n                return 2\n            return 1\n        for j in range(10):\n            if not live_pidfile(pid_file):\n                break\n            import signal\n            kill(pid, signal.SIGTERM)\n            time.sleep(1)\n        else:\n            self.out(\"failed to kill web process %s\" % pid)\n            return 3\n        if os.path.exists(pid_file):\n            os.unlink(pid_file)\n        return 0\n\n    def show_status(self): # pragma: no cover\n        pid_file = self.options.pid_file or 'pyramid.pid'\n        if not os.path.exists(pid_file):\n            self.out('No PID file %s' % pid_file)\n            return 1\n        pid = read_pidfile(pid_file)\n        if not pid:\n            self.out('No PID in file %s' % pid_file)\n            return 1\n        pid = live_pidfile(pid_file)\n        if not pid:\n            self.out('PID %s in %s is not running' % (pid, pid_file))\n            return 1\n        self.out('Server running in PID %s' % pid)\n        return 0\n\n    def restart_with_reloader(self): # pragma: no cover\n        self.restart_with_monitor(reloader=True)\n\n    def restart_with_monitor(self, reloader=False): # pragma: no cover\n        if self.options.verbose > 0:\n            if reloader:\n                self.out('Starting subprocess with file monitor')\n            else:\n                self.out('Starting subprocess with monitor parent')\n        while 1:\n            args = [self.quote_first_command_arg(sys.executable)] + sys.argv\n            new_environ = os.environ.copy()\n            if reloader:\n                new_environ[self._reloader_environ_key] = 'true'\n            else:\n                new_environ[self._monitor_environ_key] = 'true'\n            proc = None\n            try:\n                try:\n                    _turn_sigterm_into_systemexit()\n                    proc = subprocess.Popen(args, env=new_environ)\n                    exit_code = proc.wait()\n                    proc = None\n                except KeyboardInterrupt:\n                    self.out('^C caught in monitor process')\n                    if self.options.verbose > 1:\n                        raise\n                    return 1\n            finally:\n                if proc is not None:\n                    import signal\n                    try:\n                        kill(proc.pid, signal.SIGTERM)\n                    except (OSError, IOError):\n                        pass\n\n            if reloader:\n                # Reloader always exits with code 3; but if we are\n                # a monitor, any exit code will restart\n                if exit_code != 3:\n                    return exit_code\n            if self.options.verbose > 0:\n                self.out('%s %s %s' % ('-' * 20, 'Restarting', '-' * 20))\n\n    def change_user_group(self, user, group): # pragma: no cover\n        if not user and not group:\n            return\n        import pwd, grp\n        uid = gid = None\n        if group:\n            try:\n                gid = int(group)\n                group = grp.getgrgid(gid).gr_name\n            except ValueError:\n                import grp\n                try:\n                    entry = grp.getgrnam(group)\n                except KeyError:\n                    raise ValueError(\n                        \"Bad group: %r; no such group exists\" % group)\n                gid = entry.gr_gid\n        try:\n            uid = int(user)\n            user = pwd.getpwuid(uid).pw_name\n        except ValueError:\n            try:\n                entry = pwd.getpwnam(user)\n            except KeyError:\n                raise ValueError(\n                    \"Bad username: %r; no such user exists\" % user)\n            if not gid:\n                gid = entry.pw_gid\n            uid = entry.pw_uid\n        if self.options.verbose > 0:\n            self.out('Changing user to %s:%s (%s:%s)' % (\n                user, group or '(unknown)', uid, gid))\n        if gid:\n            os.setgid(gid)\n        if uid:\n            os.setuid(uid)\n\nclass LazyWriter(object):\n\n    \"\"\"\n    File-like object that opens a file lazily when it is first written\n    to.\n    \"\"\"\n\n    def __init__(self, filename, mode='w'):\n        self.filename = filename\n        self.fileobj = None\n        self.lock = threading.Lock()\n        self.mode = mode\n\n    def open(self):\n        if self.fileobj is None:\n            with self.lock:\n                self.fileobj = open(self.filename, self.mode)\n        return self.fileobj\n\n    def close(self):\n        fileobj = self.fileobj\n        if fileobj is not None:\n            fileobj.close()\n\n    def __del__(self):\n        self.close()\n\n    def write(self, text):\n        fileobj = self.open()\n        fileobj.write(text)\n        fileobj.flush()\n\n    def writelines(self, text):\n        fileobj = self.open()\n        fileobj.writelines(text)\n        fileobj.flush()\n\n    def flush(self):\n        self.open().flush()\n\ndef live_pidfile(pidfile): # pragma: no cover\n    \"\"\"(pidfile:str) -> int | None\n    Returns an int found in the named file, if there is one,\n    and if there is a running process with that process id.\n    Return None if no such process exists.\n    \"\"\"\n    pid = read_pidfile(pidfile)\n    if pid:\n        try:\n            kill(int(pid), 0)\n            return pid\n        except OSError as e:\n            if e.errno == errno.EPERM:\n                return pid\n    return None\n\ndef read_pidfile(filename):\n    if os.path.exists(filename):\n        try:\n            with open(filename) as f:\n                content = f.read()\n            return int(content.strip())\n        except (ValueError, IOError):\n            return None\n    else:\n        return None\n\ndef ensure_port_cleanup(\n    bound_addresses, maxtries=30, sleeptime=2): # pragma: no cover\n    \"\"\"\n    This makes sure any open ports are closed.\n\n    Does this by connecting to them until they give connection\n    refused.  Servers should call like::\n\n        ensure_port_cleanup([80, 443])\n    \"\"\"\n    atexit.register(_cleanup_ports, bound_addresses, maxtries=maxtries,\n                    sleeptime=sleeptime)\n\ndef _cleanup_ports(\n    bound_addresses, maxtries=30, sleeptime=2): # pragma: no cover\n    # Wait for the server to bind to the port.\n    import socket\n    import errno\n    for bound_address in bound_addresses:\n        for attempt in range(maxtries):\n            sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n            try:\n                sock.connect(bound_address)\n            except socket.error as e:\n                if e.args[0] != errno.ECONNREFUSED:\n                    raise\n                break\n            else:\n                time.sleep(sleeptime)\n        else:\n            raise SystemExit('Timeout waiting for port.')\n        sock.close()\n\ndef _turn_sigterm_into_systemexit(): # pragma: no cover\n    \"\"\"\n    Attempts to turn a SIGTERM exception into a SystemExit exception.\n    \"\"\"\n    try:\n        import signal\n    except ImportError:\n        return\n    def handle_term(signo, frame):\n        raise SystemExit\n    signal.signal(signal.SIGTERM, handle_term)\n\ndef install_reloader(poll_interval=1, extra_files=None): # pragma: no cover\n    \"\"\"\n    Install the reloading monitor.\n\n    On some platforms server threads may not terminate when the main\n    thread does, causing ports to remain open/locked.  The\n    ``raise_keyboard_interrupt`` option creates a unignorable signal\n    which causes the whole application to shut-down (rudely).\n    \"\"\"\n    mon = Monitor(poll_interval=poll_interval)\n    if extra_files is None:\n        extra_files = []\n    mon.extra_files.extend(extra_files)\n    t = threading.Thread(target=mon.periodic_reload)\n    t.setDaemon(True)\n    t.start()\n\nclass classinstancemethod(object):\n    \"\"\"\n    Acts like a class method when called from a class, like an\n    instance method when called by an instance.  The method should\n    take two arguments, 'self' and 'cls'; one of these will be None\n    depending on how the method was called.\n    \"\"\"\n\n    def __init__(self, func):\n        self.func = func\n        self.__doc__ = func.__doc__\n\n    def __get__(self, obj, type=None):\n        return _methodwrapper(self.func, obj=obj, type=type)\n\nclass _methodwrapper(object):\n\n    def __init__(self, func, obj, type):\n        self.func = func\n        self.obj = obj\n        self.type = type\n\n    def __call__(self, *args, **kw):\n        assert not 'self' in kw and not 'cls' in kw, (\n            \"You cannot use 'self' or 'cls' arguments to a \"\n            \"classinstancemethod\")\n        return self.func(*((self.obj, self.type) + args), **kw)\n\nclass Monitor(object): # pragma: no cover\n    \"\"\"\n    A file monitor and server restarter.\n\n    Use this like:\n\n    ..code-block:: Python\n\n        install_reloader()\n\n    Then make sure your server is installed with a shell script like::\n\n        err=3\n        while test \"$err\" -eq 3 ; do\n            python server.py\n            err=\"$?\"\n        done\n\n    or is run from this .bat file (if you use Windows)::\n\n        @echo off\n        :repeat\n            python server.py\n        if %errorlevel% == 3 goto repeat\n\n    or run a monitoring process in Python (``pserve --reload`` does\n    this).  \n\n    Use the ``watch_file(filename)`` function to cause a reload/restart for\n    other non-Python files (e.g., configuration files).  If you have\n    a dynamic set of files that grows over time you can use something like::\n\n        def watch_config_files():\n            return CONFIG_FILE_CACHE.keys()\n        add_file_callback(watch_config_files)\n\n    Then every time the reloader polls files it will call\n    ``watch_config_files`` and check all the filenames it returns.\n    \"\"\"\n    instances = []\n    global_extra_files = []\n    global_file_callbacks = []\n\n    def __init__(self, poll_interval):\n        self.module_mtimes = {}\n        self.keep_running = True\n        self.poll_interval = poll_interval\n        self.extra_files = list(self.global_extra_files)\n        self.instances.append(self)\n        self.file_callbacks = list(self.global_file_callbacks)\n\n    def _exit(self):\n        # use os._exit() here and not sys.exit() since within a\n        # thread sys.exit() just closes the given thread and\n        # won't kill the process; note os._exit does not call\n        # any atexit callbacks, nor does it do finally blocks,\n        # flush open files, etc.  In otherwords, it is rude.\n        os._exit(3)\n\n    def periodic_reload(self):\n        while True:\n            if not self.check_reload():\n                self._exit()\n                break\n            time.sleep(self.poll_interval)\n\n    def check_reload(self):\n        filenames = list(self.extra_files)\n        for file_callback in self.file_callbacks:\n            try:\n                filenames.extend(file_callback())\n            except:\n                print(\n                    \"Error calling reloader callback %r:\" % file_callback)\n                traceback.print_exc()\n        for module in sys.modules.values():\n            try:\n                filename = module.__file__\n            except (AttributeError, ImportError):\n                continue\n            if filename is not None:\n                filenames.append(filename)\n        for filename in filenames:\n            try:\n                stat = os.stat(filename)\n                if stat:\n                    mtime = stat.st_mtime\n                else:\n                    mtime = 0\n            except (OSError, IOError):\n                continue\n            if filename.endswith('.pyc') and os.path.exists(filename[:-1]):\n                mtime = max(os.stat(filename[:-1]).st_mtime, mtime)\n            if not filename in self.module_mtimes:\n                self.module_mtimes[filename] = mtime\n            elif self.module_mtimes[filename] < mtime:\n                print(\"%s changed; reloading...\" % filename)\n                return False\n        return True\n\n    def watch_file(self, cls, filename):\n        \"\"\"Watch the named file for changes\"\"\"\n        filename = os.path.abspath(filename)\n        if self is None:\n            for instance in cls.instances:\n                instance.watch_file(filename)\n            cls.global_extra_files.append(filename)\n        else:\n            self.extra_files.append(filename)\n\n    watch_file = classinstancemethod(watch_file)\n\n    def add_file_callback(self, cls, callback):\n        \"\"\"Add a callback -- a function that takes no parameters -- that will\n        return a list of filenames to watch for changes.\"\"\"\n        if self is None:\n            for instance in cls.instances:\n                instance.add_file_callback(callback)\n            cls.global_file_callbacks.append(callback)\n        else:\n            self.file_callbacks.append(callback)\n\n    add_file_callback = classinstancemethod(add_file_callback)\n\nwatch_file = Monitor.watch_file\nadd_file_callback = Monitor.add_file_callback\n\n# For paste.deploy server instantiation (egg:pyramid#wsgiref)\ndef wsgiref_server_runner(wsgi_app, global_conf, **kw): # pragma: no cover\n    from wsgiref.simple_server import make_server\n    host = kw.get('host', '0.0.0.0')\n    port = int(kw.get('port', 8080))\n    server = make_server(host, port, wsgi_app)\n    print('Starting HTTP server on http://%s:%s' % (host, port))\n    server.serve_forever()\n\n# For paste.deploy server instantiation (egg:pyramid#cherrypy)\ndef cherrypy_server_runner(\n        app, global_conf=None, host='127.0.0.1', port=None,\n        ssl_pem=None, protocol_version=None, numthreads=None,\n        server_name=None, max=None, request_queue_size=None,\n        timeout=None\n        ): # pragma: no cover\n    \"\"\"\n    Entry point for CherryPy's WSGI server\n\n    Serves the specified WSGI app via CherryPyWSGIServer.\n\n    ``app``\n\n        The WSGI 'application callable'; multiple WSGI applications\n        may be passed as (script_name, callable) pairs.\n\n    ``host``\n\n        This is the ipaddress to bind to (or a hostname if your\n        nameserver is properly configured).  This defaults to\n        127.0.0.1, which is not a public interface.\n\n    ``port``\n\n        The port to run on, defaults to 8080 for HTTP, or 4443 for\n        HTTPS. This can be a string or an integer value.\n\n    ``ssl_pem``\n\n        This an optional SSL certificate file (via OpenSSL) You can\n        generate a self-signed test PEM certificate file as follows:\n\n            $ openssl genrsa 1024 > host.key\n            $ chmod 400 host.key\n            $ openssl req -new -x509 -nodes -sha1 -days 365  \\\\\n                          -key host.key > host.cert\n            $ cat host.cert host.key > host.pem\n            $ chmod 400 host.pem\n\n    ``protocol_version``\n\n        The protocol used by the server, by default ``HTTP/1.1``.\n\n    ``numthreads``\n\n        The number of worker threads to create.\n\n    ``server_name``\n\n        The string to set for WSGI's SERVER_NAME environ entry.\n\n    ``max``\n\n        The maximum number of queued requests. (defaults to -1 = no\n        limit).\n\n    ``request_queue_size``\n\n        The 'backlog' argument to socket.listen(); specifies the\n        maximum number of queued connections.\n\n    ``timeout``\n\n        The timeout in seconds for accepted connections.\n    \"\"\"\n    is_ssl = False\n    if ssl_pem:\n        port = port or 4443\n        is_ssl = True\n\n    if not port:\n        if ':' in host:\n            host, port = host.split(':', 1)\n        else:\n            port = 8080\n    bind_addr = (host, int(port))\n\n    kwargs = {}\n    for var_name in ('numthreads', 'max', 'request_queue_size', 'timeout'):\n        var = locals()[var_name]\n        if var is not None:\n            kwargs[var_name] = int(var)\n\n    from cherrypy import wsgiserver\n\n    server = wsgiserver.CherryPyWSGIServer(bind_addr, app,\n                                           server_name=server_name, **kwargs)\n    server.ssl_certificate = server.ssl_private_key = ssl_pem\n    if protocol_version:\n        server.protocol = protocol_version\n\n    try:\n        protocol = is_ssl and 'https' or 'http'\n        if host == '0.0.0.0':\n            print('serving on 0.0.0.0:%s view at %s://127.0.0.1:%s' %\n                  (port, protocol, port))\n        else:\n            print('serving on %s://%s:%s' % (protocol, host, port))\n        server.start()\n    except (KeyboardInterrupt, SystemExit):\n        server.stop()\n\n    return server\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:** Passing `quiet` Argument to `pserve.main` Causes TypeError

**Description:**
When attempting to run the server with the `quiet` option, a `TypeError` is raised because the `main` function does not accept the `quiet` keyword argument.

**Example Buggy Code:**
```python
from pyramid.scripts.pserve import main

def test_pserve_quiet_option():
    argv = ['pserve']
    result = main(argv, quiet=True)
```

**Expected Behavior:**
The server should run with the verbose output level set to `0` when the `quiet` argument is provided, without raising any errors.

**Actual Behavior:**
A `TypeError` is raised indicating that the `main()` function received an unexpected keyword argument `quiet`:

```
TypeError: main() got an unexpected keyword argument 'quiet'
```
[/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/scripts/pserve.py
# (c) 2005 Ian Bicking and contributors; written for Paste
# (http://pythonpaste.org) Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license.php
#
# For discussion of daemonizing:
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/278731
#
# Code taken also from QP: http://www.mems-exchange.org/software/qp/ From
# lib/site.py

import atexit
import ctypes
import errno
import logging
import optparse
import os
import re
import subprocess
import sys
import textwrap
import threading
import time
import traceback

from paste.deploy import loadserver
from paste.deploy import loadapp

from pyramid.compat import WIN

from pyramid.paster import setup_logging

from pyramid.scripts.common import parse_vars

MAXFD = 1024

if WIN and not hasattr(os, 'kill'): # pragma: no cover
    # py 2.6 on windows
    def kill(pid, sig=None):
        """kill function for Win32"""
        # signal is ignored, semibogus raise message
        kernel32 = ctypes.windll.kernel32
        handle = kernel32.OpenProcess(1, 0, pid)
        if (0 == kernel32.TerminateProcess(handle, 0)):
            raise OSError('No such process %s' % pid)
else:
    kill = os.kill

def main(argv=sys.argv):
    command = PServeCommand(argv)
    return command.run()

class DaemonizeException(Exception):
    pass

class PServeCommand(object):

    usage = '%prog config_uri [start|stop|restart|status] [var=value]'
    description = """\
    This command serves a web application that uses a PasteDeploy
    configuration file for the server and application.

    If start/stop/restart is given, then --daemon is implied, and it will
    start (normal operation), stop (--stop-daemon), or do both.

    You can also include variable assignments like 'http_port=8080'
    and then use %(http_port)s in your config files.
    """
    default_verbosity = 1

    parser = optparse.OptionParser(
        usage,
        description=textwrap.dedent(description)
        )
    parser.add_option(
        '-n', '--app-name',
        dest='app_name',
        metavar='NAME',
        help="Load the named application (default main)")
    parser.add_option(
        '-s', '--server',
        dest='server',
        metavar='SERVER_TYPE',
        help="Use the named server.")
    parser.add_option(
        '--server-name',
        dest='server_name',
        metavar='SECTION_NAME',
        help=("Use the named server as defined in the configuration file "
              "(default: main)"))
    if hasattr(os, 'fork'):
        parser.add_option(
            '--daemon',
            dest="daemon",
            action="store_true",
            help="Run in daemon (background) mode")
    parser.add_option(
        '--pid-file',
        dest='pid_file',
        metavar='FILENAME',
        help=("Save PID to file (default to pyramid.pid if running in "
              "daemon mode)"))
    parser.add_option(
        '--log-file',
        dest='log_file',
        metavar='LOG_FILE',
        help="Save output to the given log file (redirects stdout)")
    parser.add_option(
        '--reload',
        dest='reload',
        action='store_true',
        help="Use auto-restart file monitor")
    parser.add_option(
        '--reload-interval',
        dest='reload_interval',
        default=1,
        help=("Seconds between checking files (low number can cause "
              "significant CPU usage)"))
    parser.add_option(
        '--monitor-restart',
        dest='monitor_restart',
        action='store_true',
        help="Auto-restart server if it dies")
    parser.add_option(
        '--status',
        action='store_true',
        dest='show_status',
        help="Show the status of the (presumably daemonized) server")
    parser.add_option(
        '-v', '--verbose',
        default=default_verbosity,
        dest='verbose',
        action='count',
        help="Set verbose level (default "+str(default_verbosity)+")")
    parser.add_option(
        '-q', '--quiet',
        action='store_const',
        const=0,
        dest='verbose',
        help="Suppress verbose output")

    if hasattr(os, 'setuid'):
        # I don't think these are available on Windows
        parser.add_option(
            '--user',
            dest='set_user',
            metavar="USERNAME",
            help="Set the user (usually only possible when run as root)")
        parser.add_option(
            '--group',
            dest='set_group',
            metavar="GROUP",
            help="Set the group (usually only possible when run as root)")

    parser.add_option(
        '--stop-daemon',
        dest='stop_daemon',
        action='store_true',
        help=('Stop a daemonized server (given a PID file, or default '
              'pyramid.pid file)'))

    _scheme_re = re.compile(r'^[a-z][a-z]+:', re.I)

    _reloader_environ_key = 'PYTHON_RELOADER_SHOULD_RUN'
    _monitor_environ_key = 'PASTE_MONITOR_SHOULD_RUN'

    possible_subcommands = ('start', 'stop', 'restart', 'status')

    def __init__(self, argv):
        self.options, self.args = self.parser.parse_args(argv[1:])

    def out(self, msg): # pragma: no cover
        print(msg)

    def get_options(self):
        if (len(self.args) > 1
            and self.args[1] in self.possible_subcommands):
            restvars = self.args[2:]
        else:
            restvars = self.args[1:]

        return parse_vars(restvars)

    def run(self): # pragma: no cover
        if self.options.stop_daemon:
            return self.stop_daemon()

        if not hasattr(self.options, 'set_user'):
            # Windows case:
            self.options.set_user = self.options.set_group = None

        # @@: Is this the right stage to set the user at?
        self.change_user_group(
            self.options.set_user, self.options.set_group)

        if not self.args:
            self.out('You must give a config file')
            return 2
        app_spec = self.args[0]

        if (len(self.args) > 1
            and self.args[1] in self.possible_subcommands):
            cmd = self.args[1]
        else:
            cmd = None

        if self.options.reload:
            if os.environ.get(self._reloader_environ_key):
                if self.options.verbose > 1:
                    self.out('Running reloading file monitor')
                install_reloader(int(self.options.reload_interval), [app_spec])
                # if self.requires_config_file:
                #     watch_file(self.args[0])
            else:
                return self.restart_with_reloader()

        if cmd not in (None, 'start', 'stop', 'restart', 'status'):
            self.out(
                'Error: must give start|stop|restart (not %s)' % cmd)
            return 2

        if cmd == 'status' or self.options.show_status:
            return self.show_status()

        if cmd == 'restart' or cmd == 'stop':
            result = self.stop_daemon()
            if result:
                if cmd == 'restart':
                    self.out("Could not stop daemon; aborting")
                else:
                    self.out("Could not stop daemon")
                return result
            if cmd == 'stop':
                return result
            self.options.daemon = True

        if cmd == 'start':
            self.options.daemon = True

        app_name = self.options.app_name

        vars = self.get_options()

        if not self._scheme_re.search(app_spec):
            app_spec = 'config:' + app_spec
        server_name = self.options.server_name
        if self.options.server:
            server_spec = 'egg:pyramid'
            assert server_name is None
            server_name = self.options.server
        else:
            server_spec = app_spec
        base = os.getcwd()

        if getattr(self.options, 'daemon', False):
            if not self.options.pid_file:
                self.options.pid_file = 'pyramid.pid'
            if not self.options.log_file:
                self.options.log_file = 'pyramid.log'

        # Ensure the log file is writeable
        if self.options.log_file:
            try:
                writeable_log_file = open(self.options.log_file, 'a')
            except IOError as ioe:
                msg = 'Error: Unable to write to log file: %s' % ioe
                raise ValueError(msg)
            writeable_log_file.close()

        # Ensure the pid file is writeable
        if self.options.pid_file:
            try:
                writeable_pid_file = open(self.options.pid_file, 'a')
            except IOError as ioe:
                msg = 'Error: Unable to write to pid file: %s' % ioe
                raise ValueError(msg)
            writeable_pid_file.close()

        if getattr(self.options, 'daemon', False):
            try:
                self.daemonize()
            except DaemonizeException as ex:
                if self.options.verbose > 0:
                    self.out(str(ex))
                return 2

        if (self.options.monitor_restart
            and not os.environ.get(self._monitor_environ_key)):
            return self.restart_with_monitor()

        if self.options.pid_file:
            self.record_pid(self.options.pid_file)

        if self.options.log_file:
            stdout_log = LazyWriter(self.options.log_file, 'a')
            sys.stdout = stdout_log
            sys.stderr = stdout_log
            logging.basicConfig(stream=stdout_log)

        log_fn = app_spec
        if log_fn.startswith('config:'):
            log_fn = app_spec[len('config:'):]
        elif log_fn.startswith('egg:'):
            log_fn = None
        if log_fn:
            log_fn = os.path.join(base, log_fn)
            setup_logging(log_fn)

        server = self.loadserver(server_spec, name=server_name,
                                 relative_to=base, global_conf=vars)

        app = self.loadapp(app_spec, name=app_name, relative_to=base,
                global_conf=vars)

        if self.options.verbose > 0:
            if hasattr(os, 'getpid'):
                msg = 'Starting server in PID %i.' % os.getpid()
            else:
                msg = 'Starting server.'
            self.out(msg)

        def serve():
            try:
                server(app)
            except (SystemExit, KeyboardInterrupt) as e:
                if self.options.verbose > 1:
                    raise
                if str(e):
                    msg = ' ' + str(e)
                else:
                    msg = ''
                self.out('Exiting%s (-v to see traceback)' % msg)

        serve()

    def loadapp(self, app_spec, name, relative_to, **kw): # pragma: no cover
        return loadapp(app_spec, name=name, relative_to=relative_to, **kw)

    def loadserver(self, server_spec, name, relative_to, **kw):# pragma:no cover
        return loadserver(
            server_spec, name=name, relative_to=relative_to, **kw)

    def quote_first_command_arg(self, arg): # pragma: no cover
        """
        There's a bug in Windows when running an executable that's
        located inside a path with a space in it.  This method handles
        that case, or on non-Windows systems or an executable with no
        spaces, it just leaves well enough alone.
        """
        if (sys.platform != 'win32' or ' ' not in arg):
            # Problem does not apply:
            return arg
        try:
            import win32api
        except ImportError:
            raise ValueError(
                "The executable %r contains a space, and in order to "
                "handle this issue you must have the win32api module "
                "installed" % arg)
        arg = win32api.GetShortPathName(arg)
        return arg

    def daemonize(self): # pragma: no cover
        pid = live_pidfile(self.options.pid_file)
        if pid:
            raise DaemonizeException(
                "Daemon is already running (PID: %s from PID file %s)"
                % (pid, self.options.pid_file))

        if self.options.verbose > 0:
            self.out('Entering daemon mode')
        pid = os.fork()
        if pid:
            # The forked process also has a handle on resources, so we
            # *don't* want proper termination of the process, we just
            # want to exit quick (which os._exit() does)
            os._exit(0)
        # Make this the session leader
        os.setsid()
        # Fork again for good measure!
        pid = os.fork()
        if pid:
            os._exit(0)

        # @@: Should we set the umask and cwd now?

        import resource  # Resource usage information.
        maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]
        if (maxfd == resource.RLIM_INFINITY):
            maxfd = MAXFD
        # Iterate through and close all file descriptors.
        for fd in range(0, maxfd):
            try:
                os.close(fd)
            except OSError:  # ERROR, fd wasn't open to begin with (ignored)
                pass

        if (hasattr(os, "devnull")):
            REDIRECT_TO = os.devnull
        else:
            REDIRECT_TO = "/dev/null"
        os.open(REDIRECT_TO, os.O_RDWR)  # standard input (0)
        # Duplicate standard input to standard output and standard error.
        os.dup2(0, 1)  # standard output (1)
        os.dup2(0, 2)  # standard error (2)

    def _remove_pid_file(self, written_pid, filename, verbosity):
        current_pid = os.getpid()
        if written_pid != current_pid:
            # A forked process must be exiting, not the process that
            # wrote the PID file
            return
        if not os.path.exists(filename):
            return
        with open(filename) as f:
            content = f.read().strip()
        try:
            pid_in_file = int(content)
        except ValueError:
            pass
        else:
            if pid_in_file != current_pid:
                msg = "PID file %s contains %s, not expected PID %s"
                self.out(msg % (filename, pid_in_file, current_pid))
                return
        if verbosity > 0:
            self.out("Removing PID file %s" % filename)
        try:
            os.unlink(filename)
            return
        except OSError as e:
            # Record, but don't give traceback
            self.out("Cannot remove PID file: (%s)" % e)
        # well, at least lets not leave the invalid PID around...
        try:
            with open(filename, 'w') as f:
                f.write('')
        except OSError as e:
            self.out('Stale PID left in file: %s (%s)' % (filename, e))
        else:
            self.out('Stale PID removed')

    def record_pid(self, pid_file):
        pid = os.getpid()
        if self.options.verbose > 1:
            self.out('Writing PID %s to %s' % (pid, pid_file))
        with open(pid_file, 'w') as f:
            f.write(str(pid))
        atexit.register(self._remove_pid_file, pid, pid_file, self.options.verbose)

    def stop_daemon(self): # pragma: no cover
        pid_file = self.options.pid_file or 'pyramid.pid'
        if not os.path.exists(pid_file):
            self.out('No PID file exists in %s' % pid_file)
            return 1
        pid = read_pidfile(pid_file)
        if not pid:
            self.out("Not a valid PID file in %s" % pid_file)
            return 1
        pid = live_pidfile(pid_file)
        if not pid:
            self.out("PID in %s is not valid (deleting)" % pid_file)
            try:
                os.unlink(pid_file)
            except (OSError, IOError) as e:
                self.out("Could not delete: %s" % e)
                return 2
            return 1
        for j in range(10):
            if not live_pidfile(pid_file):
                break
            import signal
            kill(pid, signal.SIGTERM)
            time.sleep(1)
        else:
            self.out("failed to kill web process %s" % pid)
            return 3
        if os.path.exists(pid_file):
            os.unlink(pid_file)
        return 0

    def show_status(self): # pragma: no cover
        pid_file = self.options.pid_file or 'pyramid.pid'
        if not os.path.exists(pid_file):
            self.out('No PID file %s' % pid_file)
            return 1
        pid = read_pidfile(pid_file)
        if not pid:
            self.out('No PID in file %s' % pid_file)
            return 1
        pid = live_pidfile(pid_file)
        if not pid:
            self.out('PID %s in %s is not running' % (pid, pid_file))
            return 1
        self.out('Server running in PID %s' % pid)
        return 0

    def restart_with_reloader(self): # pragma: no cover
        self.restart_with_monitor(reloader=True)

    def restart_with_monitor(self, reloader=False): # pragma: no cover
        if self.options.verbose > 0:
            if reloader:
                self.out('Starting subprocess with file monitor')
            else:
                self.out('Starting subprocess with monitor parent')
        while 1:
            args = [self.quote_first_command_arg(sys.executable)] + sys.argv
            new_environ = os.environ.copy()
            if reloader:
                new_environ[self._reloader_environ_key] = 'true'
            else:
                new_environ[self._monitor_environ_key] = 'true'
            proc = None
            try:
                try:
                    _turn_sigterm_into_systemexit()
                    proc = subprocess.Popen(args, env=new_environ)
                    exit_code = proc.wait()
                    proc = None
                except KeyboardInterrupt:
                    self.out('^C caught in monitor process')
                    if self.options.verbose > 1:
                        raise
                    return 1
            finally:
                if proc is not None:
                    import signal
                    try:
                        kill(proc.pid, signal.SIGTERM)
                    except (OSError, IOError):
                        pass

            if reloader:
                # Reloader always exits with code 3; but if we are
                # a monitor, any exit code will restart
                if exit_code != 3:
                    return exit_code
            if self.options.verbose > 0:
                self.out('%s %s %s' % ('-' * 20, 'Restarting', '-' * 20))

    def change_user_group(self, user, group): # pragma: no cover
        if not user and not group:
            return
        import pwd, grp
        uid = gid = None
        if group:
            try:
                gid = int(group)
                group = grp.getgrgid(gid).gr_name
            except ValueError:
                import grp
                try:
                    entry = grp.getgrnam(group)
                except KeyError:
                    raise ValueError(
                        "Bad group: %r; no such group exists" % group)
                gid = entry.gr_gid
        try:
            uid = int(user)
            user = pwd.getpwuid(uid).pw_name
        except ValueError:
            try:
                entry = pwd.getpwnam(user)
            except KeyError:
                raise ValueError(
                    "Bad username: %r; no such user exists" % user)
            if not gid:
                gid = entry.pw_gid
            uid = entry.pw_uid
        if self.options.verbose > 0:
            self.out('Changing user to %s:%s (%s:%s)' % (
                user, group or '(unknown)', uid, gid))
        if gid:
            os.setgid(gid)
        if uid:
            os.setuid(uid)

class LazyWriter(object):

    """
    File-like object that opens a file lazily when it is first written
    to.
    """

    def __init__(self, filename, mode='w'):
        self.filename = filename
        self.fileobj = None
        self.lock = threading.Lock()
        self.mode = mode

    def open(self):
        if self.fileobj is None:
            with self.lock:
                self.fileobj = open(self.filename, self.mode)
        return self.fileobj

    def close(self):
        fileobj = self.fileobj
        if fileobj is not None:
            fileobj.close()

    def __del__(self):
        self.close()

    def write(self, text):
        fileobj = self.open()
        fileobj.write(text)
        fileobj.flush()

    def writelines(self, text):
        fileobj = self.open()
        fileobj.writelines(text)
        fileobj.flush()

    def flush(self):
        self.open().flush()

def live_pidfile(pidfile): # pragma: no cover
    """(pidfile:str) -> int | None
    Returns an int found in the named file, if there is one,
    and if there is a running process with that process id.
    Return None if no such process exists.
    """
    pid = read_pidfile(pidfile)
    if pid:
        try:
            kill(int(pid), 0)
            return pid
        except OSError as e:
            if e.errno == errno.EPERM:
                return pid
    return None

def read_pidfile(filename):
    if os.path.exists(filename):
        try:
            with open(filename) as f:
                content = f.read()
            return int(content.strip())
        except (ValueError, IOError):
            return None
    else:
        return None

def ensure_port_cleanup(
    bound_addresses, maxtries=30, sleeptime=2): # pragma: no cover
    """
    This makes sure any open ports are closed.

    Does this by connecting to them until they give connection
    refused.  Servers should call like::

        ensure_port_cleanup([80, 443])
    """
    atexit.register(_cleanup_ports, bound_addresses, maxtries=maxtries,
                    sleeptime=sleeptime)

def _cleanup_ports(
    bound_addresses, maxtries=30, sleeptime=2): # pragma: no cover
    # Wait for the server to bind to the port.
    import socket
    import errno
    for bound_address in bound_addresses:
        for attempt in range(maxtries):
            sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            try:
                sock.connect(bound_address)
            except socket.error as e:
                if e.args[0] != errno.ECONNREFUSED:
                    raise
                break
            else:
                time.sleep(sleeptime)
        else:
            raise SystemExit('Timeout waiting for port.')
        sock.close()

def _turn_sigterm_into_systemexit(): # pragma: no cover
    """
    Attempts to turn a SIGTERM exception into a SystemExit exception.
    """
    try:
        import signal
    except ImportError:
        return
    def handle_term(signo, frame):
        raise SystemExit
    signal.signal(signal.SIGTERM, handle_term)

def install_reloader(poll_interval=1, extra_files=None): # pragma: no cover
    """
    Install the reloading monitor.

    On some platforms server threads may not terminate when the main
    thread does, causing ports to remain open/locked.  The
    ``raise_keyboard_interrupt`` option creates a unignorable signal
    which causes the whole application to shut-down (rudely).
    """
    mon = Monitor(poll_interval=poll_interval)
    if extra_files is None:
        extra_files = []
    mon.extra_files.extend(extra_files)
    t = threading.Thread(target=mon.periodic_reload)
    t.setDaemon(True)
    t.start()

class classinstancemethod(object):
    """
    Acts like a class method when called from a class, like an
    instance method when called by an instance.  The method should
    take two arguments, 'self' and 'cls'; one of these will be None
    depending on how the method was called.
    """

    def __init__(self, func):
        self.func = func
        self.__doc__ = func.__doc__

    def __get__(self, obj, type=None):
        return _methodwrapper(self.func, obj=obj, type=type)

class _methodwrapper(object):

    def __init__(self, func, obj, type):
        self.func = func
        self.obj = obj
        self.type = type

    def __call__(self, *args, **kw):
        assert not 'self' in kw and not 'cls' in kw, (
            "You cannot use 'self' or 'cls' arguments to a "
            "classinstancemethod")
        return self.func(*((self.obj, self.type) + args), **kw)

class Monitor(object): # pragma: no cover
    """
    A file monitor and server restarter.

    Use this like:

    ..code-block:: Python

        install_reloader()

    Then make sure your server is installed with a shell script like::

        err=3
        while test "$err" -eq 3 ; do
            python server.py
            err="$?"
        done

    or is run from this .bat file (if you use Windows)::

        @echo off
        :repeat
            python server.py
        if %errorlevel% == 3 goto repeat

    or run a monitoring process in Python (``pserve --reload`` does
    this).  

    Use the ``watch_file(filename)`` function to cause a reload/restart for
    other non-Python files (e.g., configuration files).  If you have
    a dynamic set of files that grows over time you can use something like::

        def watch_config_files():
            return CONFIG_FILE_CACHE.keys()
        add_file_callback(watch_config_files)

    Then every time the reloader polls files it will call
    ``watch_config_files`` and check all the filenames it returns.
    """
    instances = []
    global_extra_files = []
    global_file_callbacks = []

    def __init__(self, poll_interval):
        self.module_mtimes = {}
        self.keep_running = True
        self.poll_interval = poll_interval
        self.extra_files = list(self.global_extra_files)
        self.instances.append(self)
        self.file_callbacks = list(self.global_file_callbacks)

    def _exit(self):
        # use os._exit() here and not sys.exit() since within a
        # thread sys.exit() just closes the given thread and
        # won't kill the process; note os._exit does not call
        # any atexit callbacks, nor does it do finally blocks,
        # flush open files, etc.  In otherwords, it is rude.
        os._exit(3)

    def periodic_reload(self):
        while True:
            if not self.check_reload():
                self._exit()
                break
            time.sleep(self.poll_interval)

    def check_reload(self):
        filenames = list(self.extra_files)
        for file_callback in self.file_callbacks:
            try:
                filenames.extend(file_callback())
            except:
                print(
                    "Error calling reloader callback %r:" % file_callback)
                traceback.print_exc()
        for module in sys.modules.values():
            try:
                filename = module.__file__
            except (AttributeError, ImportError):
                continue
            if filename is not None:
                filenames.append(filename)
        for filename in filenames:
            try:
                stat = os.stat(filename)
                if stat:
                    mtime = stat.st_mtime
                else:
                    mtime = 0
            except (OSError, IOError):
                continue
            if filename.endswith('.pyc') and os.path.exists(filename[:-1]):
                mtime = max(os.stat(filename[:-1]).st_mtime, mtime)
            if not filename in self.module_mtimes:
                self.module_mtimes[filename] = mtime
            elif self.module_mtimes[filename] < mtime:
                print("%s changed; reloading..." % filename)
                return False
        return True

    def watch_file(self, cls, filename):
        """Watch the named file for changes"""
        filename = os.path.abspath(filename)
        if self is None:
            for instance in cls.instances:
                instance.watch_file(filename)
            cls.global_extra_files.append(filename)
        else:
            self.extra_files.append(filename)

    watch_file = classinstancemethod(watch_file)

    def add_file_callback(self, cls, callback):
        """Add a callback -- a function that takes no parameters -- that will
        return a list of filenames to watch for changes."""
        if self is None:
            for instance in cls.instances:
                instance.add_file_callback(callback)
            cls.global_file_callbacks.append(callback)
        else:
            self.file_callbacks.append(callback)

    add_file_callback = classinstancemethod(add_file_callback)

watch_file = Monitor.watch_file
add_file_callback = Monitor.add_file_callback

# For paste.deploy server instantiation (egg:pyramid#wsgiref)
def wsgiref_server_runner(wsgi_app, global_conf, **kw): # pragma: no cover
    from wsgiref.simple_server import make_server
    host = kw.get('host', '0.0.0.0')
    port = int(kw.get('port', 8080))
    server = make_server(host, port, wsgi_app)
    print('Starting HTTP server on http://%s:%s' % (host, port))
    server.serve_forever()

# For paste.deploy server instantiation (egg:pyramid#cherrypy)
def cherrypy_server_runner(
        app, global_conf=None, host='127.0.0.1', port=None,
        ssl_pem=None, protocol_version=None, numthreads=None,
        server_name=None, max=None, request_queue_size=None,
        timeout=None
        ): # pragma: no cover
    """
    Entry point for CherryPy's WSGI server

    Serves the specified WSGI app via CherryPyWSGIServer.

    ``app``

        The WSGI 'application callable'; multiple WSGI applications
        may be passed as (script_name, callable) pairs.

    ``host``

        This is the ipaddress to bind to (or a hostname if your
        nameserver is properly configured).  This defaults to
        127.0.0.1, which is not a public interface.

    ``port``

        The port to run on, defaults to 8080 for HTTP, or 4443 for
        HTTPS. This can be a string or an integer value.

    ``ssl_pem``

        This an optional SSL certificate file (via OpenSSL) You can
        generate a self-signed test PEM certificate file as follows:

            $ openssl genrsa 1024 > host.key
            $ chmod 400 host.key
            $ openssl req -new -x509 -nodes -sha1 -days 365  \\
                          -key host.key > host.cert
            $ cat host.cert host.key > host.pem
            $ chmod 400 host.pem

    ``protocol_version``

        The protocol used by the server, by default ``HTTP/1.1``.

    ``numthreads``

        The number of worker threads to create.

    ``server_name``

        The string to set for WSGI's SERVER_NAME environ entry.

    ``max``

        The maximum number of queued requests. (defaults to -1 = no
        limit).

    ``request_queue_size``

        The 'backlog' argument to socket.listen(); specifies the
        maximum number of queued connections.

    ``timeout``

        The timeout in seconds for accepted connections.
    """
    is_ssl = False
    if ssl_pem:
        port = port or 4443
        is_ssl = True

    if not port:
        if ':' in host:
            host, port = host.split(':', 1)
        else:
            port = 8080
    bind_addr = (host, int(port))

    kwargs = {}
    for var_name in ('numthreads', 'max', 'request_queue_size', 'timeout'):
        var = locals()[var_name]
        if var is not None:
            kwargs[var_name] = int(var)

    from cherrypy import wsgiserver

    server = wsgiserver.CherryPyWSGIServer(bind_addr, app,
                                           server_name=server_name, **kwargs)
    server.ssl_certificate = server.ssl_private_key = ssl_pem
    if protocol_version:
        server.protocol = protocol_version

    try:
        protocol = is_ssl and 'https' or 'http'
        if host == '0.0.0.0':
            print('serving on 0.0.0.0:%s view at %s://127.0.0.1:%s' %
                  (port, protocol, port))
        else:
            print('serving on %s://%s:%s' % (protocol, host, port))
        server.start()
    except (KeyboardInterrupt, SystemExit):
        server.stop()

    return server

```
--- 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