Skip to content

Commit

Permalink
test_engine.py: add type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
berquist committed Dec 18, 2024
1 parent efc8de4 commit c635903
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions src/sst/core/testingframework/test_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@
import argparse
import shutil
import configparser
from typing import Any, Dict, List
import multiprocessing
from typing import Any, Dict, List, Union

import test_engine_globals
from sst_unittest import *
from sst_unittest_support import *
from test_engine_unittest import *
from test_engine_support import OSCommand

################################################################################

Expand Down Expand Up @@ -120,10 +122,10 @@ def __init__(self, sst_core_bin_dir: str, test_mode: int) -> None:
self._fail_fast = False
self._keep_output_dir = False
self._list_discovered_testsuites_mode = False
self._list_of_searchable_testsuite_paths = []
self._list_of_specific_testnames = []
self._testsuite_types_list = []
self._testsuite_wildcards_list = []
self._list_of_searchable_testsuite_paths: List[str] = []
self._list_of_specific_testnames: List[str] = []
self._testsuite_types_list: List[str] = []
self._testsuite_wildcards_list: List[str] = []
self._sst_core_bin_dir = sst_core_bin_dir
self._test_mode = test_mode
self._sst_full_test_suite = unittest.TestSuite()
Expand Down Expand Up @@ -204,7 +206,7 @@ def _build_tests_list_helper(self, suite: SSTTestSuite) -> List[Any]:
Args:
suite (SSTTestSuite): The suites to be split up.
"""
tests = list(iterate_tests(suite))
tests = list(iterate_tests(suite)) # type: ignore [name-defined]
return tests

################################################################################
Expand Down Expand Up @@ -297,7 +299,7 @@ def _parse_arguments(self) -> None:

####

def _decode_parsed_arguments(self, args, parser):
def _decode_parsed_arguments(self, args: argparse.Namespace, parser: argparse.ArgumentParser) -> None:
""" Decode the parsed arguments into their class or global variables.
Args:
Expand Down Expand Up @@ -720,7 +722,13 @@ def _create_output_dir(self, out_dir: str) -> bool:

####

def _dump_testsuite_list(self, suite, log_normal=False, show_suites=False, iterlevel=0):
def _dump_testsuite_list(
self,
suite: Union[unittest.TestSuite, unittest.TestCase],
log_normal: bool = False,
show_suites: bool = False,
iterlevel: int = 0,
) -> None:
""" Recursively log all tests in a TestSuite.
Args:
Expand All @@ -744,7 +752,10 @@ def _dump_testsuite_list(self, suite, log_normal=False, show_suites=False, iterl

####

def _prune_unwanted_tests(self, suite):
def _prune_unwanted_tests(
self,
suite: Union[unittest.TestSuite, unittest.TestCase],
) -> unittest.TestSuite:
""" Recursively remove any tests that dont match the name
Args:
Expand Down

0 comments on commit c635903

Please sign in to comment.