From 27987049835222c2fce1af2b262f0ed6cb59ba3b Mon Sep 17 00:00:00 2001 From: Alex Domingo Date: Wed, 4 Feb 2026 19:54:17 +0100 Subject: [PATCH 1/4] disable NVHPCToolchain deprecation warning in unit tests --- easybuild/toolchains/nvhpc.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/easybuild/toolchains/nvhpc.py b/easybuild/toolchains/nvhpc.py index 251f669573..cc7e0c74a0 100644 --- a/easybuild/toolchains/nvhpc.py +++ b/easybuild/toolchains/nvhpc.py @@ -31,6 +31,8 @@ * Andreas Herten (Forschungszentrum Juelich) * Alex Domingo (Vrije Universiteit Brussel) """ +import inspect + from easybuild.toolchains.gcccore import GCCcore from easybuild.toolchains.linalg.nvblas import NVBLAS from easybuild.toolchains.linalg.nvscalapack import NVScaLAPACK @@ -65,4 +67,7 @@ class NVHPCToolchain(NvidiaCompilersToolchain): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - self.log.deprecated("NVHPCToolchain was replaced by NvidiaCompilersToolchain in EasyBuild 5.2.0", '6.0') + # trigger deprecation warning outside CI tests + in_test_env = any('unittest' in frame.filename for frame in inspect.stack()) + if not in_test_env: + self.log.deprecated("NVHPCToolchain was replaced by NvidiaCompilersToolchain in EasyBuild 5.2.0", '6.0') From 5ab3f609da4751d9d04b4d9e4564749233124129 Mon Sep 17 00:00:00 2001 From: Alex Domingo Date: Wed, 4 Feb 2026 20:09:55 +0100 Subject: [PATCH 2/4] remove unecessary else in NVHPC toolchain class --- easybuild/toolchains/nvhpc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/easybuild/toolchains/nvhpc.py b/easybuild/toolchains/nvhpc.py index cc7e0c74a0..e9a4c39d16 100644 --- a/easybuild/toolchains/nvhpc.py +++ b/easybuild/toolchains/nvhpc.py @@ -53,8 +53,8 @@ def __new__(cls, *args, **kwargs): # legacy NVHPC toolchains are compiler-only toolchains # on top of GCCcore, switch to corresponding class return NVHPCToolchain(*args, **kwargs) - else: - return super().__new__(cls) + + return super().__new__(cls) class NVHPCToolchain(NvidiaCompilersToolchain): From a70fa6e5fe13781274e769e9d0d83e75ffa137fd Mon Sep 17 00:00:00 2001 From: Alex Domingo Date: Wed, 4 Feb 2026 21:20:42 +0100 Subject: [PATCH 3/4] print regular warning in CI unit tests for NVHPCToolchain deprecation --- easybuild/toolchains/nvhpc.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/easybuild/toolchains/nvhpc.py b/easybuild/toolchains/nvhpc.py index e9a4c39d16..32c1068c23 100644 --- a/easybuild/toolchains/nvhpc.py +++ b/easybuild/toolchains/nvhpc.py @@ -67,7 +67,10 @@ class NVHPCToolchain(NvidiaCompilersToolchain): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - # trigger deprecation warning outside CI tests + # print deprecation warning (stick to warning level in CI tests) + warn_msg = "NVHPCToolchain was replaced by NvidiaCompilersToolchain in EasyBuild 5.2.0" in_test_env = any('unittest' in frame.filename for frame in inspect.stack()) - if not in_test_env: - self.log.deprecated("NVHPCToolchain was replaced by NvidiaCompilersToolchain in EasyBuild 5.2.0", '6.0') + if in_test_env: + self.log.warning(warn_msg) + else: + self.log.deprecated(warn_msg, '6.0') From ff5b9ad9ac2788c9c2a2c04a2f26ee8c491f1a1f Mon Sep 17 00:00:00 2001 From: Alex Domingo Date: Wed, 4 Feb 2026 21:59:21 +0100 Subject: [PATCH 4/4] replace log.warning with print_warning in NVHPCToolchain --- easybuild/toolchains/nvhpc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/easybuild/toolchains/nvhpc.py b/easybuild/toolchains/nvhpc.py index 32c1068c23..eef80b81bf 100644 --- a/easybuild/toolchains/nvhpc.py +++ b/easybuild/toolchains/nvhpc.py @@ -38,6 +38,7 @@ from easybuild.toolchains.linalg.nvscalapack import NVScaLAPACK from easybuild.toolchains.mpi.nvhpcx import NVHPCX from easybuild.toolchains.nvidia_compilers import NvidiaCompilersToolchain +from easybuild.tools.build_log import print_warning from easybuild.tools.toolchain.toolchain import SYSTEM_TOOLCHAIN_NAME @@ -71,6 +72,6 @@ def __init__(self, *args, **kwargs): warn_msg = "NVHPCToolchain was replaced by NvidiaCompilersToolchain in EasyBuild 5.2.0" in_test_env = any('unittest' in frame.filename for frame in inspect.stack()) if in_test_env: - self.log.warning(warn_msg) + print_warning(warn_msg) else: self.log.deprecated(warn_msg, '6.0')