Apply suggestions from code review

Co-authored-by: Andrey Kashchikhin <andrey.kashchikhin@intel.com>
This commit is contained in:
Mikhail Ryzhov 2023-08-22 18:16:07 +02:00 committed by GitHub
parent 7a6c48cb1a
commit b537b9cdf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -338,11 +338,11 @@ class TestParallelRunner:
test_suite = test_name[:test_name.find(".")]
if (self._split_unit == "test"):
if not constants.DISABLED_PREFIX in test_name:
if constants.DISABLED_PREFIX not in test_name:
if (time != -1):
tests_dict_cache[test_name] = tests_dict_cache.get(test_name, 0) + time
elif (self._split_unit == "suite"):
if not constants.DISABLED_PREFIX in test_suite:
if constants.DISABLED_PREFIX not in test_suite:
if (time == -1):
tests_dict_cache[test_suite] = tests_dict_cache.get(test_suite, -1)
else:
@ -360,7 +360,7 @@ class TestParallelRunner:
cached_test_dict[test] = test_dict_cache[test] if test_dict_cache[test] != -1 else test_dict_runtime.get(test, -1)
for test in test_dict_runtime:
if not test in cached_test_dict:
if test not in cached_test_dict:
runtime_test_dict[test] = test_dict_runtime[test]
if len(runtime_test_dict) > 0:
@ -397,7 +397,8 @@ class TestParallelRunner:
else:
while (len(tasks) > 0):
t_time, t_pattern = tasks[0]
if len(t_pattern) + def_length + len(test_pattern.replace(self._device, longest_device)) < MAX_LENGHT :
length = len(t_pattern) + def_length + len(test_pattern.replace(self._device, longest_device))
if length < MAX_LENGHT:
break
else:
tasks_full.append(tasks.pop())
@ -659,7 +660,7 @@ class TestParallelRunner:
if self._is_save_cache:
test_times.sort(reverse=True)
with open(self._cache_path, "w") as cache_file:
cache_file.writelines([f"{time}:" + test_name + "\n" for time, test_name in test_times])
cache_file.writelines([f"{time}:{test_name}\n" for time, test_name in test_names])
cache_file.close()
logger.info(f"Test cache test is saved to: {self._cache_path}")
hash_table_path = os.path.join(logs_dir, "hash_table.csv")
@ -767,7 +768,7 @@ class TestParallelRunner:
logger.info(f"disabled test counter is: {len(self._disabled_tests)}")
diff_set = set(saved_tests).difference(set(test_list_runtime))
if (diff_set) :
if diff_set:
logger.error(f"Total test count is {test_cnt} is different with expected {self._total_test_cnt} tests")
[logger.error(f'Missed test: {test}') for test in diff_set]
is_successfull_run = False