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

from watchdog import Watchdog


def _post_results(dog):
    print("\n")
    print("+" * 50)
    print(dog.seconds_blocked)
    print("+" * 50)


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

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