'Executes the given request (``req``), with the expected
``status``.  Generally ``.get()`` and ``.post()`` are used
instead.'

def do_request(self, req, status):

    if self.pre_request_hook:
        self.pre_request_hook(self)
    __tracebackhide__ = True
    if self.cookies:
        c = BaseCookie()
        for (name, value) in self.cookies.items():
            c[name] = value
        hc = ';    '.join(['='.join([m.key, m.value]) for m in c.values()])
        req.environ['HTTP_COOKIE'] = hc
    req.environ['paste.testing'] = True
    req.environ['paste.testing_variables'] = {}
    app = lint.middleware(self.app)
    old_stdout = sys.stdout
    out = CaptureStdout(old_stdout)
    try:
        sys.stdout = out
        start_time = time.time()
        raise_on_wsgi_error = (not req.expect_errors)
        raw_res = wsgilib.raw_interactive(app, req.url, raise_on_wsgi_error=raise_on_wsgi_error, **req.environ)
        end_time = time.time()
    finally:
        sys.stdout = old_stdout
        sys.stderr.write(out.getvalue())
    res = self._make_response(raw_res, (end_time - start_time))
    res.request = req
    for (name, value) in req.environ['paste.testing_variables'].items():
        if hasattr(res, name):
            raise ValueError(('paste.testing_variables    contains    the    variable    %r,    but    the    response    object    already    has    an    attribute    by    that    name' % name))
        setattr(res, name, value)
    if (self.namespace is not None):
        self.namespace['res'] = res
    if (not req.expect_errors):
        self._check_status(status, res)
        self._check_errors(res)
    res.cookies_set = {}
    for header in res.all_headers('set-cookie'):
        c = BaseCookie(header)
        for (key, morsel) in c.items():
            self.cookies[key] = morsel.value
            res.cookies_set[key] = morsel.value
    if self.post_request_hook:
        self.post_request_hook(self)
    if (self.namespace is None):
        return res
