@@ -528,7 +528,7 @@ def test_validate_pass_by_value(self):
528528
529529 pass_by_value = True
530530 ids = []
531- for k , v in tc .variables .items ():
531+ for _ , v in tc .variables .items ():
532532 for x in v :
533533 idx = id (x )
534534 if idx not in ids :
@@ -908,8 +908,6 @@ def test_misc_flags_unique_fortran(self):
908908 flag = tc .COMPILER_UNIQUE_OPTION_MAP [opt ]
909909 if isinstance (flag , list ):
910910 flag = ' ' .join (flag )
911- else :
912- flag = flag
913911 for var in flag_vars :
914912 flags = tc .get_variable (var )
915913 if enable :
@@ -3389,6 +3387,42 @@ def test_get_flag(self):
33893387 tc .options .options_map ['openmp' ] = flags
33903388 self .assertEqual (tc .get_flag ('openmp' ), flagstring )
33913389
3390+ def test_nvhpc_compatibility (self ):
3391+ """Test that software using EasyBuild before 5.2.0 continues working
3392+ the compiler.nvhpc toolchain being renamed to NvidiaCompilers"""
3393+ from easybuild .toolchains .nvompi import Nvompi
3394+ from easybuild .toolchains .compiler .nvidia_compilers import NvidiaCompilers
3395+ from easybuild .toolchains .nvhpc import NvidiaCompilersToolchain , NVHPCToolchain
3396+
3397+ # test deprecation of NVHPC in v5.2.0
3398+ with self .temporarily_allow_deprecated_behaviour (), self .mocked_stdout_stderr ():
3399+ from easybuild .toolchains .compiler .nvhpc import NVHPC
3400+ self .assertIn ("nvhpc was replaced by easybuild.toolchains.compiler.nvidia_compilers" , self .get_stderr ())
3401+
3402+ # load NVidiaCompilers, deprecated NVHPC corresponds to it
3403+ tc = NvidiaCompilers (name = 'NvidiaCompilers' , version = '2024a' ) # Common usage
3404+ # Might be checked by pre-5.2.0 users
3405+ self .assertIsInstance (tc , NVHPC )
3406+
3407+ # load deprecated NVHPC, NvidiaCompilers corresponds to it
3408+ with self .temporarily_allow_deprecated_behaviour (), self .mocked_stdout_stderr ():
3409+ tc = NVHPC (name = 'NVHPC' , version = '2024a' ) # Might be used by pre-5.2.0 users
3410+ self .assertIn ("nvhpc was replaced by easybuild.toolchains.compiler.nvidia_compilers" , self .get_stderr ())
3411+ self .assertIsInstance (tc , NvidiaCompilers )
3412+
3413+ # load deprecated NVHPCToolchain, it corresponds to NvidiaCompilersToolchain
3414+ with self .temporarily_allow_deprecated_behaviour (), self .mocked_stdout_stderr ():
3415+ tc = NVHPCToolchain (name = 'NVHPC' , version = '2024a' ) # Might be used by pre-5.2.0 users
3416+ self .assertIn ("NVHPCToolchain was replaced by NvidiaCompilersToolchain" , self .get_stderr ())
3417+ self .assertIsInstance (tc , NvidiaCompilersToolchain )
3418+
3419+ tc = Nvompi (version = '2024a' ) # Common usage
3420+ self .assertIsInstance (tc , NvidiaCompilers )
3421+ self .assertIsInstance (tc , NvidiaCompilersToolchain )
3422+ self .assertIsInstance (tc , NVHPCToolchain )
3423+ # compiler toolchain NVHPC is deprecated in 5.2.0, but might still be checked by existing code
3424+ self .assertIsInstance (tc , NVHPC )
3425+
33923426
33933427def suite (loader = None ):
33943428 """ return all the tests"""
0 commit comments