blob: a46aea448b496a91398134ad25c709208442426c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
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
|