Skip to content

Commit

Permalink
take into account --ignore-index in load_index + check for it in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
boegel committed Apr 8, 2020
1 parent f64ae2c commit b31bfa8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion easybuild/tools/filetools.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,10 @@ def load_index(path, ignore_dirs=None):
index_fp = os.path.join(path, PATH_INDEX_FILENAME)
index = set()

if os.path.exists(index_fp):
if build_option('ignore_index'):
_log.info("Ignoring index for %s...", path)

elif os.path.exists(index_fp):
lines = read_file(index_fp).splitlines()

valid_ts_regex = re.compile("^# valid until: (.*)", re.M)
Expand Down
4 changes: 4 additions & 0 deletions test/framework/filetools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1794,6 +1794,10 @@ def test_index_functions(self):
regex = re.compile(r"WARNING: Index for %s is no longer valid \(too old\), so ignoring it" % self.test_prefix)
self.assertTrue(regex.search(stderr), "Pattern '%s' found in: %s" % (regex.pattern, stderr))

# check whether load_index takes into account --ignore-index
init_config(build_options={'ignore_index': True})
self.assertEqual(ft.load_index(self.test_prefix), None)

def test_search_file(self):
"""Test search_file function."""
test_ecs = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'easyconfigs', 'test_ecs')
Expand Down

0 comments on commit b31bfa8

Please sign in to comment.