diff options
-rw-r--r-- | lib/spack/spack/build_systems/sip.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/spack/spack/build_systems/sip.py b/lib/spack/spack/build_systems/sip.py index c45254ebb0..3ec43f5f82 100644 --- a/lib/spack/spack/build_systems/sip.py +++ b/lib/spack/spack/build_systems/sip.py @@ -10,6 +10,7 @@ import llnl.util.tty as tty from llnl.util.filesystem import find, join_path, working_dir import spack.builder +import spack.install_test import spack.package_base from spack.directives import build_system, depends_on, extends from spack.multimethod import when @@ -30,8 +31,8 @@ class SIPPackage(spack.package_base.PackageBase): #: Name of private sip module to install alongside package sip_module = "sip" - #: Callback names for install-time test - install_time_test_callbacks = ["test"] + #: Callback names for install-time testing + install_time_test_callbacks = ["test_imports"] #: Legacy buildsystem attribute used to deserialize and install old specs legacy_buildsystem = "sip" @@ -87,18 +88,20 @@ class SIPPackage(spack.package_base.PackageBase): """The python ``Executable``.""" inspect.getmodule(self).python(*args, **kwargs) - def test(self): + def test_imports(self): """Attempts to import modules of the installed package.""" # Make sure we are importing the installed modules, # not the ones in the source directory + python = inspect.getmodule(self).python for module in self.import_modules: - self.run_test( - inspect.getmodule(self).python.path, - ["-c", "import {0}".format(module)], + with spack.install_test.test_part( + self, + "test_imports_{0}".format(module), purpose="checking import of {0}".format(module), work_dir="spack-test", - ) + ): + python("-c", "import {0}".format(module)) @spack.builder.builder("sip") |