selftest: Remove python2.4-isms
authorJelmer Vernooij <jelmer@samba.org>
Tue, 6 Apr 2010 01:55:10 +0000 (03:55 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Tue, 6 Apr 2010 02:01:54 +0000 (04:01 +0200)
selftest/filter-subunit
selftest/subunithelper.py

index 605a898..923d5cf 100755 (executable)
@@ -26,9 +26,9 @@ parser.add_option("--prefix", type="string",
 opts, args = parser.parse_args()
 
 if opts.expected_failures:
-       expected_failures = list(subunithelper.read_test_regexes(opts.expected_failures))
+       expected_failures = subunithelper.read_test_regexes(opts.expected_failures)
 else:
-       expected_failures = []
+       expected_failures = {}
 
 statistics = {
        'TESTS_UNEXPECTED_OK': 0,
index 8659f98..2c5fa31 100644 (file)
@@ -190,6 +190,7 @@ class SubunitOps(object):
 
 
 def read_test_regexes(name):
+    ret = {}
     f = open(name, 'r')
     try:
         for l in f:
@@ -198,15 +199,16 @@ def read_test_regexes(name):
                 continue
             if "#" in l:
                 (regex, reason) = l.split("#", 1)
-                yield (regex.strip(), reason.strip())
+                ret[regex.strip()] = reason.strip()
             else:
-                yield l, None
+                ret[l] = None
     finally:
         f.close()
+    return ret
 
 
 def find_in_list(regexes, fullname):
-    for regex, reason in regexes:
+    for regex, reason in regexes.iteritems():
         if re.match(regex, fullname):
             if reason is None:
                 return ""