Skip to content

Commit

Permalink
tests: fix run-test-suite when phases don't exist
Browse files Browse the repository at this point in the history
see #362
  • Loading branch information
vjackson725 authored and Zilin Chen committed Apr 18, 2020
1 parent 337e916 commit 91ffb33
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions cogent/tests/run-test-suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def check_import(name):
importlib.import_module(name)
return True
except ImportError as exc:
print("Dependancy module '{}' not installed - please install via pip3".format(name))
print("Dependency module '{}' not installed - please install via pip3".format(name))
return False


Expand Down Expand Up @@ -330,7 +330,11 @@ def run_tests(self, context, tests):
try:
results.append( self.run_phase(context, f, context.phases[phasename], test) )
except KeyError:
raise PreconditionViolation("bad phase: {}".format(phasename))
results.append( TestResult(
("error", "phase not found: {}\n".format(phasename), test['expected_result']),
f,
test['test_name']
))
print()
return results

Expand Down Expand Up @@ -418,8 +422,11 @@ def main():
print("error: could not find the cogent compiler at '{}'".format(cogent))
sys.exit(1)

files = Path(args.phase_dir).glob("*.sh")
phases = dict(map(lambda p: (p.stem,Phase(p)), files))
if Path(args.phase_dir).exists():
files = Path(args.phase_dir).glob("*.sh")
phases = dict(map(lambda p: (p.stem,Phase(p)), files))
else:
phases = dict()

context = TestContext(repo, cogent, TEST_DIST_DIR, TEST_SCRIPT_DIR, phases)

Expand Down

0 comments on commit 91ffb33

Please sign in to comment.