Browse Source

[1290] allow examination of past b10 output

Jelte Jansen 13 years ago
parent
commit
dd7fb442ed
2 changed files with 17 additions and 2 deletions
  1. 13 1
      tests/lettuce/features/bind10_control.py
  2. 4 1
      tests/lettuce/features/steps.py

+ 13 - 1
tests/lettuce/features/bind10_control.py

@@ -8,12 +8,24 @@ def shutdown_server():
         world.bind10.wait()
         world.bind10 = None
 
+def check_lines(output, lines):
+    for line in lines:
+        if output.find(line) != -1:
+            return line
+
 @world.absorb
-def wait_for_output_lines(lines):
+def wait_for_output_lines(lines, examine_past = True):
     assert world.bind10 is not None
+    if examine_past:
+        for output in world.bind10_output:
+            for line in lines:
+                if output.find(line) != -1:
+                    return line
     found = False
     while not found:
         output = world.bind10.stderr.readline()
+        # store any line, for examine_skipped
+        world.bind10_output.append(output)
         for line in lines:
             if output.find(line) != -1:
                 return line

+ 4 - 1
tests/lettuce/features/steps.py

@@ -7,14 +7,17 @@ def initialize(feature):
     # just make sure our cleanup won't fail if we never did
     # run the bind10 instance
     world.bind10 = None
+    world.bind10_output = []
 
 @after.each_scenario
 def cleanup(feature):
     world.shutdown_server()
+    world.bind10_output = []
 
 @step(u'Given I have no database')
 def given_i_have_no_database(step):
-    assert not os.path.exists("test.db")
+    if os.path.exists("test.db"):
+        os.remove("test.db")
 
 @step(u'I should see a database file')
 def i_should_see_a_database_file(step):