Skip to content

Commit

Permalink
run_wml_tests: Fix the batch-disable argument
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel committed Mar 3, 2021
1 parent 7d7e367 commit e730ee3
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions run_wml_tests
Expand Up @@ -44,7 +44,7 @@ class TestListParser:
self.verbose = options.verbose
self.filename = options.list

def get(self):
def get(self, batcher):
status_name_re = re.compile(r"^(\d+) ([\w-]+)$")
test_list = []
for line in open(self.filename, mode="rt"):
Expand All @@ -60,7 +60,7 @@ class TestListParser:
if self.verbose > 1:
print(t)
test_list.append(t)
return test_list
return batcher(test_list)

def get_output_filename(args):
for i,arg in enumerate(args):
Expand Down Expand Up @@ -186,6 +186,12 @@ def test_batcher(test_list):
if len(expected_to_pass) > 0:
yield expected_to_pass

def test_nobatcher(test_list):
"""A generator function that provides the same API as test_batcher but
emits the tests one at a time."""
for test in test_list:
yield [test]

if __name__ == '__main__':
ap = argparse.ArgumentParser()
# The options that are mandatory to support (because they're used in the Travis script)
Expand Down Expand Up @@ -232,11 +238,12 @@ if __name__ == '__main__':
if options.verbose > 1:
print(repr(options))

test_list = TestListParser(options).get()
batcher = test_nobatcher if options.batch_disable else test_batcher
test_list = TestListParser(options).get(batcher)
runner = WesnothRunner(options)

a_test_failed = False
for batch in [test_list] if options.batch_disable else test_batcher(test_list):
for batch in test_list:
try:
runner.run_tests(batch)
except UnexpectedTestStatusException:
Expand Down

0 comments on commit e730ee3

Please sign in to comment.