-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d5067ec
commit d0b21c3
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
from biosimulators_test_suite.data_model import OutputMedium | ||
from biosimulators_test_suite.results.data_model import TestCaseResultType | ||
from biosimulators_utils.config import Colors | ||
import biosimulators_test_suite.exec_core | ||
import termcolor | ||
|
||
try: | ||
# execute tests | ||
validator = biosimulators_test_suite.exec_core.SimulatorValidator( | ||
"/Biosimulators/BSTS/specs/vcell.specs", | ||
case_ids=None, | ||
verbose=False, | ||
# synthetic_archives_dir=args.synthetic_archives_dir, | ||
output_medium=OutputMedium.console, | ||
log_std_out_err=True) | ||
results = validator.run() | ||
|
||
# print summary | ||
summary, failure_details, warning_details, skipped_details = validator.summarize_results(results, True) | ||
print('') | ||
print('=============== SUMMARY ===============') | ||
print('') | ||
print(summary + '\n\n') | ||
if failure_details: | ||
color = Colors.failure.value | ||
print(termcolor.colored('=============== FAILURES ===============', color)) | ||
print(termcolor.colored('', color)) | ||
print(termcolor.colored('* ' + '\n\n* '.join(failure_details), color)) | ||
print('') | ||
if warning_details: | ||
color = Colors.warning.value | ||
print(termcolor.colored('=============== WARNINGS ===============', color)) | ||
print(termcolor.colored('', color)) | ||
print(termcolor.colored('* ' + '\n\n* '.join(warning_details), color)) | ||
print('') | ||
if skipped_details: | ||
color = Colors.skipped.value | ||
print(termcolor.colored('================ SKIPS =================', color)) | ||
print(termcolor.colored('', color)) | ||
print(termcolor.colored('* ' + '\n\n* '.join(skipped_details), color)) | ||
print('') | ||
|
||
# optionally, save report of results to a JSON file | ||
# if args.report: | ||
# write_test_results(results, args.report) | ||
except Exception as exception: | ||
raise SystemExit(str(exception)) | ||
|
||
any_passed = False | ||
failed = False | ||
for result in results: | ||
if result.type == TestCaseResultType.passed: | ||
any_passed = True | ||
elif result.type == TestCaseResultType.failed: | ||
failed = True | ||
|
||
if failed: | ||
exit(1) | ||
if not any_passed: | ||
exit(3) |