From 3a5864bcdb4174c8fa3c8647bfde17594ad0f925 Mon Sep 17 00:00:00 2001 From: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com> Date: Mon, 29 May 2023 01:16:35 -0700 Subject: tests/sip: convert to new stand-alone test process (#35693) --- lib/spack/spack/build_systems/sip.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'lib') 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") -- cgit v1.2.3-60-g2f50