bdd: Make it possible to wait for messages.

This commit is contained in:
Florian Bruhin 2015-11-05 08:02:55 +01:00
parent 547fc9f40e
commit b0430ca3e7

View File

@ -64,6 +64,14 @@ def wait_until_loaded(quteproc, path):
quteproc.wait_for_load_finished(path) quteproc.wait_for_load_finished(path)
@bdd.when(bdd.parsers.re(r'I wait for (?P<is_regex>regex )?"'
r'(?P<pattern>[^"]+)" in the log'))
def wait_in_log(quteproc, is_regex, pattern):
if is_regex:
pattern = re.compile(pattern)
quteproc.wait_for(message=pattern)
@bdd.then(bdd.parsers.parse("{path} should be loaded")) @bdd.then(bdd.parsers.parse("{path} should be loaded"))
def path_should_be_loaded(httpbin, path): def path_should_be_loaded(httpbin, path):
requests = httpbin.get_requests() requests = httpbin.get_requests()