From 83e4f9d20d4db4a5d65cce97358d746c82db4f52 Mon Sep 17 00:00:00 2001 From: "Justin M. LaPre" Date: Wed, 31 Jul 2024 22:53:19 +0000 Subject: [PATCH] prep sst_unittest for refactor We're pulling initializeTestModule_SingleInstance() up to SSTTestCase so we don't need to repeat it for every subclass. --- src/sst/core/testingframework/sst_unittest.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/sst/core/testingframework/sst_unittest.py b/src/sst/core/testingframework/sst_unittest.py index 43e809807..89ce21d04 100644 --- a/src/sst/core/testingframework/sst_unittest.py +++ b/src/sst/core/testingframework/sst_unittest.py @@ -48,6 +48,15 @@ class SSTTestCase(unittest.TestCase): This class is derived from Python's unittest.TestCase which provides an basic resource for how to develop tests for this frameworks. """ + module_init = 0 + module_sema = threading.Semaphore() + + @classmethod + def initializeTestModule_SingleInstance(cls): + with cls.module_sema: + if cls.module_init != 1: + # Put your single instance Init Code Here + cls.module_init = 1 def __init__(self, methodName): # NOTE: __init__ is called at startup for all tests before any