From 8a4b4d917472818590d0c28f0270ae2a965d65d0 Mon Sep 17 00:00:00 2001 From: "Justin M. LaPre" Date: Wed, 28 Aug 2024 14:50:17 +0000 Subject: [PATCH 1/2] deprecate testing_is_PIN2_used() --- src/sst/core/testingframework/sst_unittest_support.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/sst/core/testingframework/sst_unittest_support.py b/src/sst/core/testingframework/sst_unittest_support.py index f47a89c55..5cfb381f5 100644 --- a/src/sst/core/testingframework/sst_unittest_support.py +++ b/src/sst/core/testingframework/sst_unittest_support.py @@ -32,6 +32,11 @@ from test_engine_support import OSCommand from test_engine_support import check_param_type +if not sys.warnoptions: + import os, warnings + warnings.simplefilter("once") # Change the filter in this process + os.environ["PYTHONWARNINGS"] = "once" # Also affect subprocesses + ################################################################################ OS_DIST_OSX = "OSX" @@ -136,6 +141,10 @@ def testing_is_PIN_Compiled(): return rtn def testing_is_PIN2_used(): + from warnings import warn + warn("testing_is_PIN2_used() is deprecated and will be removed in future versions of SST.", + DeprecationWarning, stacklevel=2) + global pin_exec_path if testing_is_PIN_Compiled(): if "/pin.sh" in pin_exec_path: From 2d349c04b8039cef6f59cb79454192df20cd6ea0 Mon Sep 17 00:00:00 2001 From: "Justin M. LaPre" Date: Tue, 17 Sep 2024 18:36:30 +0000 Subject: [PATCH 2/2] deprecate simple host_os_get_* methods --- .../testingframework/sst_unittest_support.py | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/sst/core/testingframework/sst_unittest_support.py b/src/sst/core/testingframework/sst_unittest_support.py index 5cfb381f5..2440b2eac 100644 --- a/src/sst/core/testingframework/sst_unittest_support.py +++ b/src/sst/core/testingframework/sst_unittest_support.py @@ -32,6 +32,7 @@ from test_engine_support import OSCommand from test_engine_support import check_param_type +from warnings import warn if not sys.warnoptions: import os, warnings warnings.simplefilter("once") # Change the filter in this process @@ -141,7 +142,6 @@ def testing_is_PIN_Compiled(): return rtn def testing_is_PIN2_used(): - from warnings import warn warn("testing_is_PIN2_used() is deprecated and will be removed in future versions of SST.", DeprecationWarning, stacklevel=2) @@ -188,6 +188,8 @@ def host_os_get_system_node_name(): Returns: (str) Returns the system node name """ + warn("host_os_get_system_node_name() is deprecated and will be removed in future versions of SST.", + DeprecationWarning, stacklevel=2) return platform.node() ### @@ -198,6 +200,8 @@ def host_os_get_kernel_type(): Returns: (str) 'Linux' or 'Darwin' as the Kernel Type """ + warn("host_os_get_kernel_type() is deprecated and will be removed in future versions of SST.", + DeprecationWarning, stacklevel=2) return platform.system() def host_os_get_kernel_release(): @@ -206,6 +210,8 @@ def host_os_get_kernel_release(): Returns: (str) Kernel Release Number. Note: This is not the same as OS version """ + warn("host_os_get_kernel_release() is deprecated and will be removed in future versions of SST.", + DeprecationWarning, stacklevel=2) return platform.release() def host_os_get_kernel_arch(): @@ -214,6 +220,8 @@ def host_os_get_kernel_arch(): Returns: (str) 'x86_64' on Linux; 'i386' on OSX as the Kernel Architecture """ + warn("host_os_get_kernel_arch() is deprecated and will be removed in future versions of SST.", + DeprecationWarning, stacklevel=2) return platform.machine() def host_os_get_distribution_type(): @@ -270,6 +278,8 @@ def host_os_is_osx(): Returns: (bool) True if OS Distribution is OSX """ + warn("host_os_is_osx() is deprecated and will be removed in future versions of SST.", + DeprecationWarning, stacklevel=2) return host_os_get_distribution_type() == OS_DIST_OSX def host_os_is_linux(): @@ -278,6 +288,8 @@ def host_os_is_linux(): Returns: (bool) True if OS Distribution is Linux """ + warn("host_os_is_linux() is deprecated and will be removed in future versions of SST.", + DeprecationWarning, stacklevel=2) return not host_os_get_distribution_type() == OS_DIST_OSX def host_os_is_centos(): @@ -286,6 +298,8 @@ def host_os_is_centos(): Returns: (bool) True if OS Distribution is CentOS """ + warn("host_os_is_centos() is deprecated and will be removed in future versions of SST.", + DeprecationWarning, stacklevel=2) return host_os_get_distribution_type() == OS_DIST_CENTOS def host_os_is_rhel(): @@ -294,6 +308,8 @@ def host_os_is_rhel(): Returns: (bool) True if OS Distribution is RHEL """ + warn("host_os_is_rhel() is deprecated and will be removed in future versions of SST.", + DeprecationWarning, stacklevel=2) return host_os_get_distribution_type() == OS_DIST_RHEL def host_os_is_toss(): @@ -302,6 +318,8 @@ def host_os_is_toss(): Returns: (bool) True if OS Distribution is Toss """ + warn("host_os_is_toss() is deprecated and will be removed in future versions of SST.", + DeprecationWarning, stacklevel=2) return host_os_get_distribution_type() == OS_DIST_TOSS def host_os_is_ubuntu(): @@ -310,6 +328,8 @@ def host_os_is_ubuntu(): Returns: (bool) True if OS Distribution is Ubuntu """ + warn("host_os_is_ubuntu() is deprecated and will be removed in future versions of SST.", + DeprecationWarning, stacklevel=2) return host_os_get_distribution_type() == OS_DIST_UBUNTU def host_os_is_rocky(): @@ -318,6 +338,8 @@ def host_os_is_rocky(): Returns: (bool) True if OS Distribution is Rocky """ + warn("host_os_is_rocky() is deprecated and will be removed in future versions of SST.", + DeprecationWarning, stacklevel=2) return host_os_get_distribution_type() == OS_DIST_ROCKY @@ -329,6 +351,8 @@ def host_os_get_num_cores_on_system(): Returns: (int) Number of cores on the system """ + warn("host_os_get_num_cores_on_system() is deprecated and will be removed in future versions of SST.", + DeprecationWarning, stacklevel=2) num_cores = multiprocessing.cpu_count() return num_cores