Added the logs to the file to ignore, nothing major

This commit is contained in:
Maximilien Rigaut 2022-06-25 21:41:49 +02:00
parent 4191b8a8af
commit 0db770ee81
No known key found for this signature in database
GPG Key ID: 4F14B23709ADA5B1
5 changed files with 27 additions and 12 deletions

View File

@ -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"

View File

@ -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.

View File

@ -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"))

View File

@ -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.

View File

@ -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"]