diff --git a/easybuild/tools/utilities.py b/easybuild/tools/utilities.py index 91a0d90601..77c330a5e5 100644 --- a/easybuild/tools/utilities.py +++ b/easybuild/tools/utilities.py @@ -142,7 +142,7 @@ def error(*args, **kwargs): msg += " (provided by Python package %s, available from %s)" % (pkgname, url) elif url: msg += " (available from %s)" % url - raise ImportError(msg) + raise EasyBuildError("ImportError: %s", msg) return error return wrap diff --git a/test/framework/general.py b/test/framework/general.py index 8e84533226..8161dbd107 100644 --- a/test/framework/general.py +++ b/test/framework/general.py @@ -35,6 +35,7 @@ import vsc import easybuild.framework +from easybuild.tools.build_log import EasyBuildError from easybuild.tools.filetools import read_file from easybuild.tools.utilities import only_if_module_is_available @@ -84,7 +85,7 @@ def bar(): pass err_pat = "required module 'nosuchmoduleoutthere' is not available.*package nosuchpkg.*pypi/nosuchpkg" - self.assertErrorRegex(ImportError, err_pat, bar) + self.assertErrorRegex(EasyBuildError, err_pat, bar) class Foo(): @only_if_module_is_available('thisdoesnotexist', url='http://example.com') @@ -92,7 +93,7 @@ def foobar(self): pass err_pat = r"required module 'thisdoesnotexist' is not available \(available from http://example.com\)" - self.assertErrorRegex(ImportError, err_pat, Foo().foobar) + self.assertErrorRegex(EasyBuildError, err_pat, Foo().foobar) def suite():