From 2ee4f923bd93319e9dd951d55481690e934d5829 Mon Sep 17 00:00:00 2001 From: Daniel Brown <ddb@star.sr.bham.ac.uk> Date: Thu, 28 Apr 2016 17:42:52 -0700 Subject: [PATCH] updating test script --- test/run_tests.py | 44 +++++++++++++++++++ .../structural/test_properties.py | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/test/run_tests.py b/test/run_tests.py index ae9e432..f5cd4fa 100644 --- a/test/run_tests.py +++ b/test/run_tests.py @@ -1,2 +1,46 @@ import pykat +import traceback +import os +class bcolors: + HEADER = '\033[95m' + OKBLUE = '\033[94m' + OKGREEN = '\033[92m' + WARNING = '\033[93m' + FAIL = '\033[91m' + ENDC = '\033[0m' + BOLD = '\033[1m' + UNDERLINE = '\033[4m' + +errors = [] + +print("----------------------------------------------------------------------------------------") + +for path, folders, files in os.walk("./test_scripts"): + + for filename in files: + if filename.endswith(".py"): + filename = os.path.join(path, filename) + + with open(filename) as f: + print("RUNNING: " + filename) + try: + code = compile(f.read(), filename, 'exec') + exec(code) + except Exception as ex: + print(bcolors.FAIL) + print("EXCEPTION: " + repr(ex)) + traceback.print_exc() + errors.append(filename) + print(bcolors.ENDC) + + print("----------------------------------------------------------------------------------------") + + +if len(errors) > 0: + print("\nFAILED !!!\n") + print("The following files failed: ") + for e in errors: + print(" - " + e) +else: + print("\nPASSED\n") \ No newline at end of file diff --git a/test/test_scripts/structural/test_properties.py b/test/test_scripts/structural/test_properties.py index 2bacda3..a388a6d 100644 --- a/test/test_scripts/structural/test_properties.py +++ b/test/test_scripts/structural/test_properties.py @@ -14,7 +14,7 @@ kat.pdr.f1 = "0.1k" assert(kat.pdr.f1 == 100) assert(type(kat.pdr.f1) is pykat.param.Param) -kat.pdr.phi1 = "10u" +kat.pdr.phase1 = "10u" assert(kat.pdr.phase1 == 1e-5) assert(type(kat.pdr.phase1) is pykat.param.Param) -- GitLab