Read pending bytes before proceeding with test
authorJeremy Stanley <fungi@yuggoth.org>
Wed, 15 Jul 2015 20:54:53 +0000 (20:54 +0000)
committerJeremy Stanley <fungi@yuggoth.org>
Wed, 15 Jul 2015 20:54:53 +0000 (20:54 +0000)
After a match in found in each step of the functional test, read in
the remaining buffer before replying. This makes the captures
slightly more readable, especially if the match in early in a block
of output.

bin/test

index 35b2a99..e9665ec 100755 (executable)
--- a/bin/test
+++ b/bin/test
@@ -85,6 +85,11 @@ for conversant, question, answer in dialogue:
     index, match, received = lusers[conversant].expect(
         [question.encode("utf-8")], 5)
     captures[conversant] += received.decode("utf-8")
+    try:
+        captures[conversant] += lusers[
+            conversant].read_very_eager().decode("utf-8")
+    except:
+        pass
     if index is not 0:
         print("ERROR: luser%s did not receive expected string:\n\n%s"
               % (conversant, question))