Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove calls to deprecated Python test framework functions #2427

Merged
merged 5 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/sst/elements/ariel/tests/testsuite_default_Ariel.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ def test_Ariel_memH_test(self):
self.ariel_Template("memHstream")

@unittest.skipIf(not pin_loaded, "Ariel: Requires PIN, but Env Var 'INTEL_PIN_DIRECTORY' is not found or path does not exist.")
@unittest.skipIf(host_os_is_osx(), "Ariel: Open MP is not supported on OSX.")
@unittest.skipIf(host_os_get_distribution_type() == OS_DIST_OSX, "Ariel: Open MP is not supported on OSX.")
def test_Ariel_test_ivb(self):
self.ariel_Template("ariel_ivb")

@unittest.skipIf(not pin_loaded, "Ariel: Requires PIN, but Env Var 'INTEL_PIN_DIRECTORY' is not found or path does not exist.")
@unittest.skipIf(host_os_is_osx(), "Ariel: Open MP is not supported on OSX.")
@unittest.skipIf(host_os_get_distribution_type() == OS_DIST_OSX, "Ariel: Open MP is not supported on OSX.")
@unittest.skipIf(testing_check_get_num_ranks() > 1, "Ariel: test_Ariel_test_snb skipped if ranks > 1 - Sandy Bridge test is incompatible with Multi-Rank.")
def test_Ariel_test_snb(self):
self.ariel_Template("ariel_snb")
Expand Down Expand Up @@ -152,7 +152,7 @@ def _setup_ariel_test_files(self):
# It is set in the Makefile but we set it here as well
# to support out-of-source builds
#ArielApiDir = "{0}/api".format(self.ArielElementDir)
ElementsBuildDir = sstsimulator_conf_get_value_str("SST_ELEMENT_LIBRARY", "SST_ELEMENT_LIBRARY_BUILDDIR")
ElementsBuildDir = sstsimulator_conf_get_value("SST_ELEMENT_LIBRARY", "SST_ELEMENT_LIBRARY_BUILDDIR", str)
ArielApiDir = "{0}/src/sst/elements/ariel/api".format(ElementsBuildDir)
current_ld_library_path = os.environ.get("LD_LIBRARY_PATH", "")

Expand Down
2 changes: 1 addition & 1 deletion src/sst/elements/ariel/tests/testsuite_mpi_Ariel.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def assert_nonzero_stat(self, filename, stat):
multi_rank = testing_check_get_num_ranks() > 1
multi_rank_error_msg = "Ariel: Ariel MPI tests are not compatible with multi-rank sst runs."

using_osx = host_os_is_osx()
using_osx = host_os_get_distribution_type() == OS_DIST_OSX
osx_error_msg = "Ariel: OpenMP is not supported on macOS"

# TODO: This is hacky. What is the correct way to get the test script location?
Expand Down
9 changes: 4 additions & 5 deletions src/sst/elements/cramSim/tests/test_txntrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ def read_arguments():
def setup_config_params(config_file_list, override_list):
l_params = {}
for l_configFileEntry in config_file_list:
l_configFile = open(l_configFileEntry, 'r')
for l_line in l_configFile:
l_tokens = l_line.split()
#print (l_tokens[0], ": ", l_tokens[1])
l_params[l_tokens[0]] = l_tokens[1]
with open(l_configFileEntry) as l_configFile:
for l_line in l_configFile:
l_tokens = l_line.split()
l_params[l_tokens[0]] = l_tokens[1]

for override in override_list:
l_tokens = override.split("=")
Expand Down
6 changes: 3 additions & 3 deletions src/sst/elements/ember/test/generateNidListQOS.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def _random( args ):
global _nids
size = int(args[0])

if len(args) is 2 :
if len(args) == 2:
random.seed(int(args[1]))

random.shuffle(_nids)
Expand All @@ -30,7 +30,7 @@ def _random_linear( args ):
global _nids
size = int(args[0])

if len(args) is 2 :
if len(args) == 2:
random.seed(int(args[1]))

random.shuffle(_nids)
Expand Down Expand Up @@ -150,7 +150,7 @@ def generate( args ):
global _apps
_apps.append(app)

if len(_nids) is 0 :
if not len(_nids):
_finalize_qos_config(total_nodes)

return ','.join(str(num) for num in nid_list)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class testcase_EmberOTF2(SSTTestCase):

otf2_support = sst_elements_config_include_file_get_value_int("HAVE_OTF2", 0, True) > 0
otf2_support = sst_elements_config_include_file_get_value("HAVE_OTF2", int, 0, True) > 0

def setUp(self):
super(type(self), self).setUp()
Expand Down
7 changes: 5 additions & 2 deletions src/sst/elements/gensa/tests/OutputParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ def open(self, fileName):
self.rows = 0

def close(self):
if self.inFile: self.inFile.close()
if self.inFile is not None:
self.inFile.close()
self.inFile = None
self.columns = []

Expand Down Expand Up @@ -175,7 +176,9 @@ def parse(self, fileName, defaultValue = 0.0):
if c < count: column.values.append(column.value)
else: column.values.append(defaultValue) # Because the structure is not sparse, we must fill out every row.
c += 1
if len(self.columns) == 0: return # failed to read any input, not even a header row
if len(self.columns) == 0:
self.close()
return # failed to read any input, not even a header row

# If there is a separate columns file, open and parse it.
columnFileName = fileName + ".columns"
Expand Down
1 change: 1 addition & 0 deletions src/sst/elements/gensa/tests/testsuite_default_gensa.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def gensa_test_template(self, testcase):
if not self.checkColumn(o, "13", [1,1,1,0]): cmp_result = False
if not self.checkColumn(o, "14", [1,1,0,0]): cmp_result = False
self.assertTrue(cmp_result, "Output file {0}/out does not contain expected spike pattern".format(outdir))
o.close()

def checkColumn(self, o, index, pattern):
c = o.getColumn(index)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def tearDown(self):

#####
pin_compiled = testing_is_PIN_Compiled()
pin_version_valid = testing_is_PIN2_used() | testing_is_PIN3_used()
pin_version_valid = testing_is_PIN3_used()
pin_loaded = testing_is_PIN_loaded()

@unittest.skipIf(not pin_compiled, "memHSieve: Requires PIN, but PinTool is not compiled with Elements. In sst_element_config.h PINTOOL_EXECUTABLE={0}".format(pin_exec_path))
Expand All @@ -34,7 +34,6 @@ def test_memHSieve(self):

def memHSieve_Template(self, testcase, testtimeout=360):

pin2defined = testing_is_PIN2_used()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The else branch for a if pin3defined: conditional later on states code exists for Pin 2, but it isn't obvious to me what it does, so I didn't remove it. If someone (@gvoskuilen ?) could tell me if it's safe to remove, that would be good.

pin3defined = testing_is_PIN3_used()

# Get the path to the test files
Expand Down
2 changes: 1 addition & 1 deletion src/sst/elements/mercury/tests/testsuite_default_hg.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def tearDown(self):

def test_testme(self):
testdir = self.get_testsuite_dir()
libdir = sstsimulator_conf_get_value_str("SST_ELEMENT_LIBRARY","SST_ELEMENT_LIBRARY_LIBDIR")
libdir = sstsimulator_conf_get_value("SST_ELEMENT_LIBRARY","SST_ELEMENT_LIBRARY_LIBDIR", str)
path = os.environ.get("SST_LIB_PATH")
if path is None or path == "":
os.environ["SST_LIB_PATH"] = libdir
Expand Down
4 changes: 2 additions & 2 deletions src/sst/elements/prospero/tests/testsuite_default_prospero.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def tearDown(self):
#####
pin_loaded = testing_is_PIN_loaded()
pin3_used = testing_is_PIN3_used()
libz_missing = not sst_elements_config_include_file_get_value_int("HAVE_LIBZ", default=0, disable_warning=True)
libz_missing = not sst_elements_config_include_file_get_value("HAVE_LIBZ", type=int, default=0, disable_warning=True)

@unittest.skipIf(libz_missing, "test_prospero_compressed_using_TAR_traces test: Requires LIBZ, but LIBZ is not found in build configuration.")
def test_prospero_compressed_using_TAR_traces(self):
Expand Down Expand Up @@ -225,7 +225,7 @@ def _create_prospero_PIN_trace_files(self):
self.assertTrue(rtn.result() == 0, "array.c failed to compile")

# Make sure we have access to the sst-prospero-trace binary
elem_bin_dir = sstsimulator_conf_get_value_str("SST_ELEMENT_LIBRARY", "SST_ELEMENT_LIBRARY_BINDIR", "BINDIR_UNDEFINED")
elem_bin_dir = sstsimulator_conf_get_value("SST_ELEMENT_LIBRARY", "SST_ELEMENT_LIBRARY_BINDIR", str, "BINDIR_UNDEFINED")
log_debug("Elements bin_dir = {0}".format(elem_bin_dir))
filepath_sst_prospero_trace_app = "{0}/sst-prospero-trace".format(elem_bin_dir)
if os.path.isfile(filepath_sst_prospero_trace_app):
Expand Down
Loading