# Path: tests/connectors/utils.py
# def force_import_module(name):
#     if name in sys.modules:
#         return reload_module(sys.modules[name])
# 
#     else:
#         return import_module(name)


import bottle
import wsgi_intercept
from wsgi_intercept.httplib2_intercept import install
from .utils import force_import_module
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals, division


def http_setup(connectors, host, port, callback):
    # Install the WSGI interception layer.
    install()

    # Bottle is pretty straightforward.
    # We just need to push an application context.
    application = bottle.Bottle(__name__)
    application.catchall = False

    # Ensure we're debugging.
    bottle.debug(True)

    # Invoke the callback if we got one.
    if callback:
        callback()

    # Then import the resources; iterate and mount each one.

# Path: tests/connectors/utils.py
# def force_import_module(name):
#     if name in sys.modules:
#         return reload_module(sys.modules[name])
# 
#     else:
#         return import_module(name)


# Path: tests/connectors/bottle.py
import bottle
import wsgi_intercept
from wsgi_intercept.httplib2_intercept import install
from .utils import force_import_module

# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals, division


def http_setup(connectors, host, port, callback):
    # Install the WSGI interception layer.
    install()

    # Bottle is pretty straightforward.
    # We just need to push an application context.
    application = bottle.Bottle(__name__)
    application.catchall = False

    # Ensure we're debugging.
    bottle.debug(True)

    # Invoke the callback if we got one.
    if callback:
        callback()

    # Then import the resources; iterate and mount each one.

    module = force_import_module('tests.connectors.resources')