unittest.py

changeset 126
16dae12ac0f0
parent 123
0557709c25ec
child 127
97de6058109e
--- a/unittest.py	Fri Sep 18 20:41:33 2020 +0300
+++ b/unittest.py	Fri Sep 18 20:46:26 2020 +0300
@@ -25,7 +25,7 @@
     with open(unit_test_path, 'rb') as device:
         import re
         problem_types = set()
-        expecting = set()
+        expecting = None
         while True:
             pos = device.tell()
             line = bytes.decode(device.readline())
@@ -34,14 +34,18 @@
             match = re.match('^0 Testing: (.+)', line)
             if match:
                 set.update(problem_types, match.group(1).split())
+            elif str.strip(line) == '0 Expecting: none':
+                expecting = set()
             else:
                 match = re.match('^0 Expecting: (.+)', line)
                 if match:
+                    if not expecting:
+                        expecting = set()
                     set.update(expecting, map(parse_expectation, match.group(1).split()))
                 else:
                     device.seek(pos)
                     break
-        if not problem_types or not expecting:
+        if not problem_types or expecting is None:
             raise ValueError(str.format(
                 'Unit test {name} does not have a proper manifest',
                 name = name,

mercurial