@@ -0,0 +1,2490 @@
+#!/usr/bin/env python%0Aimport os%0Aimport re%0Aimport sys%0Aimport shutil%0Aimport subprocess%0A%0A%0A__author__ = %22Christopher Choi %3Cchutsu@gmail.com%3E%22%0A%0A%0A# SETTINGS%0Akeep_unittest_logs = False%0Aunittests_bin_dir = %22tests%22%0Aunittests_log_dir = %22unittests_log%22%0Aunittests_file_pattern = %22%5E%5Ba-zA-Z0-9_%5D*_tests.*$%22%0A%0Aclass TC:%0A    HEADER = '%5C033%5B95m'%0A    OKBLUE = '%5C033%5B94m'%0A    OKGREEN = '%5C033%5B92m'%0A    WARNING = '%5C033%5B93m'%0A    FAIL = '%5C033%5B91m'%0A    ENDC = '%5C033%5B0m'%0A%0A%0Adef print_stdout(unittest_output_fp):%0A    # open unittest stdout log file%0A    unittest_output = open(unittest_output_fp, 'r')%0A    output_content = unittest_output.read()%0A    unittest_output.close()%0A%0A    # print unittest stdout%0A    print(%22-%22 * 79)%0A    print(output_content)%0A    print(%22-%22 * 79)%0A%0A%0Adef get_files(path, pattern):%0A    file_list = %5B%5D%0A%0A    for root, directory, files in os.walk(path):%0A        for f in files:%0A            if re.match(pattern, f):%0A                file_list.append(os.path.join(root, f))%0A%0A    return file_list%0A%0A%0Aif __name__ == %22__main__%22:%0A    orig_cwd = os.getcwd()%0A%0A    # make log dir if not already exist%0A    if not os.path.exists(unittests_log_dir):%0A        os.mkdir(unittests_log_dir)%0A%0A    # gather all unittests%0A    file_list = os.listdir(unittests_bin_dir)%0A    unittests = get_files(unittests_bin_dir, unittests_file_pattern)%0A%0A    # execute all unittests%0A    error = False%0A    return_val = 0%0A    for unittest in unittests:%0A        # execute unittest%0A        try:%0A            print %22UNITTEST %5B%7B0%7D%5D %7B1%7DStarting%7B2%7D%22.format(unittest, TC.OKBLUE, TC.ENDC)%0A            print(%22UNITTEST %5B%7B0%7D%5D %22.format(unittest)),%0A            unittest_output_fp = os.path.join(%0A                orig_cwd,%0A                unittests_log_dir,%0A                os.path.basename(unittest) + %22.log%22%0A            )%0A            unittest_output = open(unittest_output_fp, 'w')%0A%0A            return_val = subprocess.check_call(%0A                %5B%22./%7B0%7D%22.format(unittest)%5D,%0A                stdout=unittest_output,%0A                stderr=unittest_output%0A            )%0A            unittest_output.close()%0A            print(%22%7B0%7DPASSED!%7B1%7D%22.format(TC.OKGREEN, TC.ENDC))%0A%0A        except:%0A            unittest_output.close()%0A            print(%22%7B0%7DFAILED!%7B1%7D%22.format(TC.FAIL, TC.ENDC))%0A            print_stdout(unittest_output_fp)%0A            error = True%0A%0A    os.chdir(orig_cwd)%0A    # keep unittest stdout dir?%0A    if keep_unittest_logs is False:%0A        shutil.rmtree(unittests_log_dir)%0A%0A    if error is True:%0A        sys.exit(-1)%0A    else:%0A        sys.exit(0)%0A

Add test folder for python