diff --git a/databases/windows_base.json b/databases/windows_base.json index 7a18ea1..a6700fe 100644 --- a/databases/windows_base.json +++ b/databases/windows_base.json @@ -314,10 +314,6 @@ "size": 7851008, "adler32": "0xa44fdf49" }, - "modules\\discord_dispatch-1\\discord_dispatch\\dispatch.log": { - "size": 12789, - "adler32": "0x353c1aeb" - }, "modules\\discord_dispatch-1\\discord_dispatch\\index.js": { "size": 653, "adler32": "0x9f7fd042" diff --git a/modules/adler_test.py b/modules/adler_test.py index 52ec29f..fabeda6 100644 --- a/modules/adler_test.py +++ b/modules/adler_test.py @@ -18,7 +18,8 @@ def apply_adler(path): with open(path, "rb") as f: return hex(adler32(f.read())) -class AdlerTest(test_template.TestWalkTemplate): + +class AdlerTest(test_template.TestWalkTemplateNoLogs): def __init__(self, args, agnpath, test_data, queue, queue_lock, dict_process, dict_process_lock): """ Simple test runner, compare adler32 to known good values. diff --git a/modules/main_runner.py b/modules/main_runner.py index 3df72a9..c350166 100644 --- a/modules/main_runner.py +++ b/modules/main_runner.py @@ -7,7 +7,7 @@ import time from collections import deque from modules.internal_io import global_status -from modules import size_test, adler_test +from modules import size_test, adler_test # noqa # Used to force import of modules by pyinstaller """ All modules that can be tested @@ -423,7 +423,7 @@ def resource_path(relative_path): """ Get absolute path to resource, works for dev and for PyInstaller """ try: # PyInstaller creates a temp folder and stores path in _MEIPASS - base_path = sys._MEIPASS + base_path = sys._MEIPASS # noqa except Exception: base_path = os.path.abspath(".") return os.path.join(base_path, relative_path) @@ -447,10 +447,11 @@ def print_final_status(testrunner, start_time, args): print(colored(f" > {fill_it(SIZE,test,'SUCCESS')}", "green")) elif test_object.status_code == "failure": print(colored(f" > {fill_it(SIZE,test,'FAILURE')}", "red")) - error_message = fit_it_under(test_object.status ,SIZE-3, ' > ') + error_message = fit_it_under(test_object.status, SIZE-3, ' > ') if args.max_shown != -1: # TODO : Correct this abomination table = error_message.split("\n") - error_message = "\n".join(table[:args.max_shown] + [f" > ... {len(table) - args.max_shown} more lines"]) + extra = [f" > ... {len(table) - args.max_shown} more lines"] if len(table) > args.max_shown else [] + error_message = "\n".join(table[:args.max_shown] + extra) print(colored(f"{error_message}", "red")) else: print(colored(f" > {fill_it(SIZE,test,test_object.status_code.upper())}", "yellow")) diff --git a/modules/size_test.py b/modules/size_test.py index bd74917..349d1c3 100644 --- a/modules/size_test.py +++ b/modules/size_test.py @@ -5,7 +5,7 @@ import time from modules import test_template -class SizeTest(test_template.TestWalkTemplate): +class SizeTest(test_template.TestWalkTemplateNoLogs): def __init__(self, args, agnpath, test_data, queue, queue_lock, dict_process, dict_process_lock): """ Simple test runner, compare file size to known good values. diff --git a/modules/test_template.py b/modules/test_template.py index 4d16a04..d94e03d 100644 --- a/modules/test_template.py +++ b/modules/test_template.py @@ -165,8 +165,7 @@ class TestWalkTemplate(TestTemplate): :type test_data: str """ super().__init__(args, agnpath, test_data, queue, queue_lock, dict_process, dict_process_lock) - # if test_data is None: - # self.set_status("problem", "No test data given.") + self.to_skip = [] def add_test_result(self, path, testname, result): """ @@ -266,7 +265,11 @@ class TestWalkTemplate(TestTemplate): :type cmp_function: function """ + if self.agnostic_path.get_short_path(path) in self.to_skip: + return True + data_origin = self.add_test_result(path, entry_name, function(path, *args, **kwargs)) + expected_data = self.get_expected_result(path, entry_name) if expected_data is None and not self.args.continue_on_error: self.set_status("problem", f"No expected data found for {path}") @@ -281,3 +284,17 @@ class TestWalkTemplate(TestTemplate): return True return False + +class TestWalkTemplateNoLogs(TestWalkTemplate): + def __init__(self, args, agnpath, test_data, queue, queue_lock, dict_process, dict_process_lock): + """ + Simple test template. + :param args: List of arguments + :type args: argparse.Namespace + :param agnpath: The path to the discord folder + :type agnpath: agnostic_path.AgnosticPath + :param test_data: The data to be tested + :type test_data: str + """ + super().__init__(args, agnpath, test_data, queue, queue_lock, dict_process, dict_process_lock) + self.to_skip = [r"modules\discord_dispatch-1\discord_dispatch\dispatch.log"]