summaryrefslogtreecommitdiff
path: root/testing/tests/responsiveness/conftest.py
blob: 0aaaa32b362509b213f97731c21f9cfc9264d968 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import pytest

import elastic
import watchdog as wd


def _post_results(dog, request):
    elastic.post(dog.seconds_blocked, request)


@pytest.fixture
def watchdog(request):
    dog = wd.Watchdog()
    dog_d = dog.start()
    request.addfinalizer(lambda: _post_results(dog, request))

    def _run(deferred_fun):
        deferred_fun().addCallback(lambda _: dog.stop())
        return dog_d
    return _run


def pytest_configure(config):
    option = config.getoption("elasticsearch_url", elastic.ELASTICSEARCH_URL)
    elastic.ELASTICSEARCH_URL = option