Skip to content

Commit

Permalink
discover_and_run_tests: fix logic to match docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
berquist committed Dec 16, 2024
1 parent 731b16e commit e9aaf0f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/sst/core/testingframework/sst_test_engine_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ def startup_and_run(sst_core_bin_dir: str, test_mode: int) -> None:
sys.exit(1)

t_e = test_engine.TestEngine(sst_core_bin_dir, test_mode)
t_e.discover_and_run_tests()
sys.exit(t_e.discover_and_run_tests())

except Exception as exc_e:
# NOTE: This is a generic catchall handler for any unhandled exception
_generic_exception_handler(exc_e)

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

def _generic_exception_handler(exc_e):
def _generic_exception_handler(exc_e: Exception) -> None:

# Dump Exception info to the a log file
log_filename = "./sst_test_frameworks_crashreport.log"
Expand All @@ -91,7 +91,7 @@ def _generic_exception_handler(exc_e):
log_handler = RotatingFileHandler(log_filename, mode='a',
maxBytes=10*1024*1024,
backupCount=10,
encoding=None, delay=0)
encoding=None, delay=False)
log_handler.setFormatter(log_formatter)
crashlogger.addHandler(log_handler)
crashlogger.setLevel(logging.DEBUG)
Expand Down
10 changes: 5 additions & 5 deletions src/sst/core/testingframework/test_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def __init__(self, sst_core_bin_dir: str, test_mode: int) -> None:

####

def discover_and_run_tests(self):
def discover_and_run_tests(self) -> int:
""" Create the output directories, then discover the tests, and then
run them using pythons unittest module
Expand Down Expand Up @@ -183,17 +183,17 @@ def discover_and_run_tests(self):
sst_tests_results = test_runner.run(self._sst_full_test_suite)

if not test_runner.did_tests_pass(sst_tests_results):
exit(1)
exit(0)
return 1
return 0

# Handlers of unittest.TestRunner exceptions
except KeyboardInterrupt:
log_fatal("TESTING TERMINATED DUE TO KEYBOARD INTERRUPT...")
exit(2)
return 2

####

def _build_tests_list_helper(self, suite):
def _build_tests_list_helper(self, suite: SSTTestSuite) -> List[Any]:
"""
A helper function to split the tests for the ConcurrentTestSuite into
some number of concurrently executing sub-suites. _build_tests_list_helper
Expand Down

0 comments on commit e9aaf0f

Please sign in to comment.