Skip to content

Commit

Permalink
Merge pull request #1 from boegel/fix_ext_skipping
Browse files Browse the repository at this point in the history
minor fix + enhanced test for skipped extensions
  • Loading branch information
Flamefire authored Mar 25, 2020
2 parents cd49c19 + a11ea09 commit b45c5ab
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
4 changes: 2 additions & 2 deletions easybuild/framework/easyblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,7 @@ def skip_extensions(self):
self.log.debug("exit code: %s, stdout/err: %s", ec, cmdstdouterr)
res.append(ext_inst)
else:
print_msg("Skipping extension %s" % ext_inst.name, silent=self.silent, log=self.log)
print_msg("skipping extension %s" % ext_inst.name, silent=self.silent, log=self.log)

self.ext_instances = res

Expand Down Expand Up @@ -2156,7 +2156,7 @@ def extensions_step(self, fetch=False):
# always go back to original work dir to avoid running stuff from a dir that no longer exists
change_dir(self.orig_workdir)

tup = (ext.name, ext.version, idx+1, exts_cnt)
tup = (ext.name, ext.version or '', idx+1, exts_cnt)
print_msg("installing extension %s %s (%d/%d)..." % tup, silent=self.silent)

if self.dry_run:
Expand Down
17 changes: 16 additions & 1 deletion test/framework/easyblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,6 @@ def test_extensions_step(self):

def test_skip_extensions_step(self):
"""Test the skip_extensions_step"""
init_config(build_options={'silent': True})

self.contents = cleandoc("""
easyblock = "ConfigureMake"
Expand All @@ -835,6 +834,7 @@ def test_skip_extensions_step(self):
"ext1",
("EXT-2", "42", {"source_tmpl": "dummy.tgz"}),
("ext3", "1.1", {"source_tmpl": "dummy.tgz", "modulename": "real_ext"}),
"ext4",
]
exts_filter = ("\
if [ %(ext_name)s == 'ext_2' ] && [ %(ext_version)s == '42' ] && [[ %(src)s == *dummy.tgz ]];\
Expand All @@ -849,7 +849,22 @@ def test_skip_extensions_step(self):
eb.builddir = config.build_path()
eb.installdir = config.install_path()
eb.skip = True

self.mock_stdout(True)
eb.extensions_step(fetch=True)
stdout = self.get_stdout()
self.mock_stdout(False)

patterns = [
r"^== skipping extension EXT-2",
r"^== skipping extension ext3",
r"^== installing extension ext1 \(1/2\)\.\.\.",
r"^== installing extension ext4 \(2/2\)\.\.\.",
]
for pattern in patterns:
regex = re.compile(pattern, re.M)
self.assertTrue(regex.search(stdout), "Pattern '%s' found in: %s" % (regex.pattern, stdout))

# 'ext1' should be in eb.ext_instances
eb_exts = [x.name for x in eb.ext_instances]
self.assertTrue('ext1' in eb_exts)
Expand Down

0 comments on commit b45c5ab

Please sign in to comment.