Esempio n. 1
0
def before_all(context):
    aiohttpretty.activate()

    logger = logging.getLogger(requests.__name__)
    logger.setLevel(logging.ERROR)
    context.base_url = 'http://localhost:{}'.format(settings.PORT)
    context.server_thread = ServerThread()
    context.server_thread.start()
    for _ in range(5):
        try:
            requests.get(context.base_url)
            break
        except requests.exceptions.ConnectionError:
            time.sleep(5)
    else:
        raise Exception('Unable to connect to testing server at {}'.format(context.base_url))
Esempio n. 2
0
def before_all(context):
    aiohttpretty.activate()

    logger = logging.getLogger(requests.__name__)
    logger.setLevel(logging.ERROR)
    context.base_url = 'http://localhost:{}'.format(settings.PORT)
    context.server_thread = ServerThread()
    context.server_thread.start()
    for _ in range(5):
        try:
            requests.get(context.base_url)
            break
        except requests.exceptions.ConnectionError:
            time.sleep(5)
    else:
        raise Exception('Unable to connect to testing server at {}'.format(
            context.base_url))
Esempio n. 3
0
def pytest_runtest_setup(item):
    if 'aiohttpretty' in item.keywords:
        aiohttpretty.clear()
        aiohttpretty.activate()
Esempio n. 4
0
def pytest_runtest_setup(item):
    marker = item.get_marker('aiohttpretty')
    if marker is not None:
        aiohttpretty.clear()
        aiohttpretty.activate()
Esempio n. 5
0
def pytest_runtest_setup(item):
    marker = item.get_marker('aiohttpretty')
    if marker is not None:
        aiohttpretty.clear()
        aiohttpretty.activate()