Repository: easybuilders/easybuild-framework

Issue:
Default mention in help despite multi_deps_load_default=False
With `multi_deps`, even when we set `multi_deps_load_default=False`, the generated help message mentions a default version fo the module. This is a bug. 


Discussion:

Resolving patch:
diff --git a/easybuild/tools/module_generator.py b/easybuild/tools/module_generator.py
--- a/easybuild/tools/module_generator.py
+++ b/easybuild/tools/module_generator.py
@@ -568,7 +568,8 @@ def _generate_multi_deps_list(self):
                         for dep in deplist:
                             if dep['name'] == key and dep['version'] == vlist[idx]:
                                 modname = dep['short_mod_name']
-                                if idx == 0:
+                                # indicate which version is loaded by default (unless that's disabled)
+                                if idx == 0 and self.app.cfg['multi_deps_load_default']:
                                     modname += ' (default)'
                                 mod_list.append(modname)
                 txt += ', '.join(mod_list)


Test patch:
diff --git a/test/framework/toy_build.py b/test/framework/toy_build.py
--- a/test/framework/toy_build.py
+++ b/test/framework/toy_build.py
@@ -2176,8 +2176,6 @@ def check_toy_load(depends_on=False):
         toy_mod_txt = read_file(toy_mod_file)
 
         self.assertFalse(expected in toy_mod_txt, "Pattern '%s' should not be found in: %s" % (expected, toy_mod_txt))
-        self.assertTrue(expected_descr in toy_mod_txt, error_msg_descr)
-        self.assertTrue(expected_whatis in toy_mod_txt, error_msg_whatis)
 
         self.modtool.load(['toy/0.0'])
         loaded_mod_names = [x['mod_name'] for x in self.modtool.list()]
@@ -2185,6 +2183,24 @@ def check_toy_load(depends_on=False):
         self.assertFalse('GCC/4.6.3' in loaded_mod_names)
         self.assertFalse('GCC/7.3.0-2.30' in loaded_mod_names)
 
+        # also check relevant parts of "module help" and whatis bits (no '(default)' here!)
+        expected_descr_no_default = '\n'.join([
+            "Compatible modules",
+            "==================",
+            "This module is compatible with the following modules, one of each line is required:",
+            "* GCC/4.6.3, GCC/7.3.0-2.30",
+        ])
+        error_msg_descr = "Pattern '%s' should be found in: %s" % (expected_descr_no_default, toy_mod_txt)
+        self.assertTrue(expected_descr_no_default in toy_mod_txt, error_msg_descr)
+
+        if get_module_syntax() == 'Lua':
+            expected_whatis_no_default = "whatis([==[Compatible modules: GCC/4.6.3, GCC/7.3.0-2.30]==])"
+        else:
+            expected_whatis_no_default = "module-whatis {Compatible modules: GCC/4.6.3, GCC/7.3.0-2.30}"
+
+        error_msg_whatis = "Pattern '%s' should be found in: %s" % (expected_whatis_no_default, toy_mod_txt)
+        self.assertTrue(expected_whatis_no_default in toy_mod_txt, error_msg_whatis)
+
         # restore original environment to continue testing with a clean slate
         modify_env(os.environ, self.orig_environ, verbose=False)
         self.modtool.use(test_mod_path)
@@ -2218,7 +2234,9 @@ def check_toy_load(depends_on=False):
                 ])
 
             self.assertTrue(expected in toy_mod_txt, "Pattern '%s' should be found in: %s" % (expected, toy_mod_txt))
+            error_msg_descr = "Pattern '%s' should be found in: %s" % (expected_descr, toy_mod_txt)
             self.assertTrue(expected_descr in toy_mod_txt, error_msg_descr)
+            error_msg_whatis = "Pattern '%s' should be found in: %s" % (expected_whatis, toy_mod_txt)
             self.assertTrue(expected_whatis in toy_mod_txt, error_msg_whatis)
 
             check_toy_load(depends_on=True)