aboutsummaryrefslogtreecommitdiffstats
path: root/pathod/test.py
diff options
context:
space:
mode:
Diffstat (limited to 'pathod/test.py')
-rw-r--r--pathod/test.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/pathod/test.py b/pathod/test.py
index 23b7a5b6..7e597a72 100644
--- a/pathod/test.py
+++ b/pathod/test.py
@@ -1,5 +1,7 @@
from six.moves import cStringIO as StringIO
import threading
+import time
+
from six.moves import queue
import requests
@@ -49,11 +51,23 @@ class Daemon:
def text_log(self):
return self.logfp.getvalue()
+ def expect_log(self, n, timeout=1):
+ l = []
+ start = time.time()
+ while True:
+ l = self.log()
+ print l
+ if time.time() - start >= timeout:
+ return None
+ if len(l) >= n:
+ break
+ return l
+
def last_log(self):
"""
Returns the last logged request, or None.
"""
- l = self.log()
+ l = self.expect_log(1)
if not l:
return None
return l[0]