diff --git a/easybuild/framework/easyconfig/style.py b/easybuild/framework/easyconfig/style.py index c48d9eafec..87c6780e12 100644 --- a/easybuild/framework/easyconfig/style.py +++ b/easybuild/framework/easyconfig/style.py @@ -94,7 +94,7 @@ def _eb_check_trailing_whitespace(physical_line, lines, line_number, checker_sta # if the warning is about the multiline string of description # we will not issue a warning - if checker_state.get('eb_last_key') == 'description': + if checker_state.get('eb_last_key') in ['description', 'examples', 'citing']: result = None return result diff --git a/easybuild/framework/easyconfig/tools.py b/easybuild/framework/easyconfig/tools.py index f4ddd7e2b2..3d85b931ea 100644 --- a/easybuild/framework/easyconfig/tools.py +++ b/easybuild/framework/easyconfig/tools.py @@ -403,9 +403,15 @@ def parse_easyconfigs(paths, validate=True): """ easyconfigs = [] generated_ecs = False + parsed_paths = [] for (path, generated) in paths: + # Avoid processing the same file multiple times path = os.path.abspath(path) + if any(os.path.samefile(path, p) for p in parsed_paths): + continue + parsed_paths.append(path) + # keep track of whether any files were generated generated_ecs |= generated if not os.path.exists(path): diff --git a/test/framework/easyconfig.py b/test/framework/easyconfig.py index 124286dd52..ebd0e8d40e 100644 --- a/test/framework/easyconfig.py +++ b/test/framework/easyconfig.py @@ -752,6 +752,32 @@ def test_tweaking(self): # cleanup os.remove(tweaked_fn) + def test_parse_easyconfig(self): + """Test parse_easyconfig function""" + self.contents = textwrap.dedent(""" + easyblock = "ConfigureMake" + name = "PI" + version = "3.14" + homepage = "http://example.com" + description = "test easyconfig" + toolchain = SYSTEM + """) + self.prep() + ecs, gen_ecs = parse_easyconfigs([(self.eb_file, False)]) + self.assertEqual(len(ecs), 1) + self.assertEqual(ecs[0]['spec'], self.eb_file) + self.assertIsInstance(ecs[0]['ec'], EasyConfig) + self.assertFalse(gen_ecs) + # Passing the same EC multiple times is ignored + ecs, gen_ecs = parse_easyconfigs([(self.eb_file, False), (self.eb_file, False)]) + self.assertEqual(len(ecs), 1) + # Similar for symlinks + linked_ec = os.path.join(self.test_prefix, 'linked.eb') + os.symlink(self.eb_file, linked_ec) + ecs, gen_ecs = parse_easyconfigs([(self.eb_file, False), (linked_ec, False)]) + self.assertEqual(len(ecs), 1) + self.assertEqual(ecs[0]['spec'], self.eb_file) + def test_alt_easyconfig_paths(self): """Test alt_easyconfig_paths function that collects list of additional paths for easyconfig files.""" diff --git a/test/framework/style.py b/test/framework/style.py index a86f89c201..0c1d9b140a 100644 --- a/test/framework/style.py +++ b/test/framework/style.py @@ -74,6 +74,12 @@ def test_check_trailing_whitespace(self): '''description = """start of long description, ''', # trailing whitespace, but allowed in description ''' continuation of long description ''', # trailing whitespace, but allowed in continued description ''' end of long description"""''', + '''citing = """start of long citing text, ''', # trailing whitespace, but allowed in citing + ''' continuation of long citing text ''', # trailing whitespace, but allowed in continued citing + ''' end of long citing text"""''', + '''examples = """start of long examples, ''', # trailing whitespace, but allowed in examples + ''' continuation of long examples ''', # trailing whitespace, but allowed in continued examples + ''' end of long examples"""''', "moduleclass = 'tools' ", # trailing whitespace '', ] @@ -86,6 +92,12 @@ def test_check_trailing_whitespace(self): None, None, None, + None, + None, + None, + None, + None, + None, (21, "W299 trailing whitespace"), ] diff --git a/test/framework/utilities.py b/test/framework/utilities.py index de08022454..27ba444d96 100644 --- a/test/framework/utilities.py +++ b/test/framework/utilities.py @@ -440,7 +440,8 @@ def loadTestsFromTestCase(self, test_case_class, filters): retained_test_names = [] if len(filters) > 0: for test_case_name in test_case_names: - if any(filt in test_case_name for filt in filters): + full_test_case_name = '%s.%s' % (test_case_class.__name__, test_case_name) + if any(filt in full_test_case_name for filt in filters): retained_test_names.append(test_case_name) retained_tests = ', '.join(retained_test_names)