# Path: pypi_redirect/pypi_redirect/server_app/handler/_exception.py
# class HandlerException(Exception):
#     def __init__(self, wrapped_exception):
#         self.wrapped_exception = wrapped_exception
# 
#     def raise_wrapped(self):
#         """
#         Raises the 'wrapped' exception, preserving the original
#         traceback. This must be called from within an `except` block.
#         """
#         # The first item is a class instance, so the second item must
#         # be None. The third item is the traceback object, which is why
#         # this method must be called from within an `except` block.
#         raise (
#             self.wrapped_exception(),
#             None,
#             sys.exc_info()[2])


import os
from nose.tools import eq_
from ...server_app.handler._exception import HandlerException
        if self.dummy_exception is not None:
            raise self.dummy_exception

        return self.dummy_result

    def assert_single_kw_call(self, expected_kwargs):
        eq_(len(self.calls), 1,
            msg='{} was called more than once'.format(self.name))

        eq_(len(self.calls[0][0]), 0,
            msg='{} was called with non-named arguments'.format(self.name))

        eq_(self.calls[0][1], expected_kwargs,
            msg='{} was not called with expected arguments'.format(self.name))


class RequestStub(object):
    def __init__(self, is_index):
        self.is_index = is_index


class ResponseStub(object):
    def __init__(self):
        self.headers = {}


def assert_http_not_found(run_handler_fn, failure_description):
    try:
        run_handler_fn()


# Path: pypi_redirect/pypi_redirect/server_app/handler/_exception.py
# class HandlerException(Exception):
#     def __init__(self, wrapped_exception):
#         self.wrapped_exception = wrapped_exception
# 
#     def raise_wrapped(self):
#         """
#         Raises the 'wrapped' exception, preserving the original
#         traceback. This must be called from within an `except` block.
#         """
#         # The first item is a class instance, so the second item must
#         # be None. The third item is the traceback object, which is why
#         # this method must be called from within an `except` block.
#         raise (
#             self.wrapped_exception(),
#             None,
#             sys.exc_info()[2])


# Path: pypi_redirect/pypi_redirect/test/unit_tests/_utils.py
import os
from nose.tools import eq_
from ...server_app.handler._exception import HandlerException

        if self.dummy_exception is not None:
            raise self.dummy_exception

        return self.dummy_result

    def assert_single_kw_call(self, expected_kwargs):
        eq_(len(self.calls), 1,
            msg='{} was called more than once'.format(self.name))

        eq_(len(self.calls[0][0]), 0,
            msg='{} was called with non-named arguments'.format(self.name))

        eq_(self.calls[0][1], expected_kwargs,
            msg='{} was not called with expected arguments'.format(self.name))


class RequestStub(object):
    def __init__(self, is_index):
        self.is_index = is_index


class ResponseStub(object):
    def __init__(self):
        self.headers = {}


def assert_http_not_found(run_handler_fn, failure_description):
    try:
        run_handler_fn()


    except HandlerException as e: