summaryrefslogtreecommitdiff
path: root/testing/tests/responsiveness/conftest.py
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2017-07-27 17:12:04 -0300
committerVictor Shyba <victor1984@riseup.net>2017-09-11 16:24:30 -0300
commit99cffc7388d53f9aaf5b8890401ba8ddc5b29178 (patch)
treef98282d0818ebe048b49ffc0112a1843305497a2 /testing/tests/responsiveness/conftest.py
parent70aa789c94b0dcced535cee86243e2dd4113b28a (diff)
[benchmarks] add responsiveness test with watchdog
Diffstat (limited to 'testing/tests/responsiveness/conftest.py')
-rw-r--r--testing/tests/responsiveness/conftest.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/testing/tests/responsiveness/conftest.py b/testing/tests/responsiveness/conftest.py
new file mode 100644
index 00000000..6b2687b1
--- /dev/null
+++ b/testing/tests/responsiveness/conftest.py
@@ -0,0 +1,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