Fix integration_test_check.py typing

This commit is contained in:
Mikhail f. Shiryaev 2022-11-16 10:08:53 +01:00
parent 1e5fec1157
commit d0d23af63e
No known key found for this signature in database
GPG Key ID: 4B02ED204C7D93F4

View File

@ -7,6 +7,7 @@ import logging
import os
import subprocess
import sys
from typing import List, Tuple
from github import Github
@ -87,8 +88,10 @@ def get_env_for_runner(build_path, repo_path, result_path, work_path):
return my_env
def process_results(result_folder):
test_results = []
def process_results(
result_folder: str,
) -> Tuple[str, str, List[Tuple[str, str]], List[str]]:
test_results = [] # type: List[Tuple[str, str]]
additional_files = []
# Just upload all files from result_folder.
# If task provides processed results, then it's responsible for content of result_folder.
@ -115,7 +118,7 @@ def process_results(result_folder):
results_path = os.path.join(result_folder, "test_results.tsv")
if os.path.exists(results_path):
with open(results_path, "r", encoding="utf-8") as results_file:
test_results = list(csv.reader(results_file, delimiter="\t"))
test_results = list(csv.reader(results_file, delimiter="\t")) # type: ignore
if len(test_results) == 0:
return "error", "Empty test_results.tsv", test_results, additional_files
@ -153,8 +156,8 @@ if __name__ == "__main__":
validate_bugix_check = args.validate_bugfix
if "RUN_BY_HASH_NUM" in os.environ:
run_by_hash_num = int(os.getenv("RUN_BY_HASH_NUM"))
run_by_hash_total = int(os.getenv("RUN_BY_HASH_TOTAL"))
run_by_hash_num = int(os.getenv("RUN_BY_HASH_NUM", "0"))
run_by_hash_total = int(os.getenv("RUN_BY_HASH_TOTAL", "0"))
check_name_with_group = (
check_name + f" [{run_by_hash_num + 1}/{run_by_hash_total}]"
)