Skip to content

Commit a021153

Browse files
committed
fix python lint
1 parent e34cab6 commit a021153

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

scripts/run_tests.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import platform
44
from pathlib import Path
55

6+
67
def init_cmd_args():
78
import argparse
89
parser = argparse.ArgumentParser()
@@ -22,11 +23,13 @@ def init_cmd_args():
2223
_args_dict = vars(args)
2324
return _args_dict
2425

26+
2527
def get_project_path():
2628
script_path = Path(__file__).resolve() # Absolute path of the script
2729
script_dir = script_path.parent # Directory containing the script
2830
return script_dir.parent
2931

32+
3033
def source_script(script_path):
3134
command = f"source {script_path} && env"
3235
result = subprocess.run(command, shell=True, capture_output=True, text=True)
@@ -42,6 +45,7 @@ def source_script(script_path):
4245
print(f"Failed to source script: {script_path}")
4346
return {}
4447

48+
4549
def setup_env():
4650
ocv_script_path = "build/ppc_opencv/install/bin/setup_vars_opencv4.sh"
4751
if os.path.isfile(Path(get_project_path()) / ocv_script_path):
@@ -54,17 +58,25 @@ def setup_env():
5458
os.environ.update(env_vars)
5559
return _executable_path
5660

61+
5762
def run_exec_file(command):
5863
result = subprocess.run(command, shell=True, env=os.environ)
5964
if result.returncode != 0:
6065
raise Exception(f"Subprocess return {result.returncode}.")
6166

67+
6268
def get_common_gtest_settings():
63-
return "--gtest_also_run_disabled_tests --gtest_repeat=10 --gtest_recreate_environments_when_repeating --gtest_color=0"
69+
command = "--gtest_also_run_disabled_tests "
70+
command += "--gtest_repeat=10 "
71+
command += "--gtest_recreate_environments_when_repeating "
72+
command += "--gtest_color=0 "
73+
return command
74+
6475

6576
def run_threads():
6677
print(123)
6778

79+
6880
def run_common(install_bin_dir):
6981
valgrind_settings = "--error-exitcode=1 --leak-check=full --show-leak-kinds=all"
7082

@@ -75,14 +87,17 @@ def run_common(install_bin_dir):
7587
run_exec_file(f"{Path(install_bin_dir) / 'core_func_tests'} {get_common_gtest_settings()}")
7688
run_exec_file(f"{Path(install_bin_dir) / 'ref_func_tests'} {get_common_gtest_settings()}")
7789

90+
7891
def run_processes(install_bin_dir, additional_mpi_args):
7992
proc_count = os.environ.get("PROC_COUNT")
8093
if proc_count is None:
8194
raise EnvironmentError("Required environment variable 'PROC_COUNT' is not set.")
8295

96+
mpi_running = f"mpirun {additional_mpi_args} -np {proc_count}"
8397
if not os.environ.get("ASAN_RUN"):
84-
run_exec_file(f"mpirun {additional_mpi_args} -np {proc_count} {Path(install_bin_dir) / 'all_func_tests'} {get_common_gtest_settings()}")
85-
run_exec_file(f"mpirun {additional_mpi_args} -np {proc_count} {Path(install_bin_dir) / 'mpi_func_tests'} {get_common_gtest_settings()}")
98+
run_exec_file(f"{mpi_running} {Path(install_bin_dir) / 'all_func_tests'} {get_common_gtest_settings()}")
99+
run_exec_file(f"{mpi_running} {Path(install_bin_dir) / 'mpi_func_tests'} {get_common_gtest_settings()}")
100+
86101

87102
if __name__ == "__main__":
88103
args_dict = init_cmd_args()

0 commit comments

Comments
 (0)