Commit 5d636694 authored by Mathieu Giraud's avatar Mathieu Giraud

src/should.py: refactor, include .load() in TestSuite.test()

Prepares #36
parent 9fcac418
......@@ -705,7 +705,7 @@ class TestSuite():
print(color(ANSI.MAGENTA, cmd, colorize))
return cmd
def load(self, should_lines):
def test(self, should_lines, variables=[], verbose=0, colorize=True, only=None):
name = ''
this_cmd_continues = False
for l in should_lines:
......@@ -785,14 +785,12 @@ class TestSuite():
this_cmd_continues = next_cmd_continues
def test(self, variables=[], verbose=0, colorize=True, only=None):
# Test
self.only = only
self.variables_all = self.variables + variables
if verbose > 1:
print_variables(self.variables_all)
self.status = None
if self.requires_cmd:
......@@ -979,9 +977,7 @@ class FileSet():
cd_f = os.path.dirname(f) if cd_same else cd
s = TestSuite(self.modifiers, cd_f, name = f, timeout = self.timeout)
self.sets.append(s)
s.load(open(f))
s.test(variables, verbose - 1, only=only)
s.test(open(f), variables, verbose - 1, only=only)
self.stats.up(s.status, f)
self.status = combine_status(self.status, s.status)
self.stats_tests += s.stats
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment