diff options
author | Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com> | 2023-06-30 02:52:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-30 05:52:42 -0400 |
commit | dc25da1931d3fbebb64f35d37b1498f00d17141f (patch) | |
tree | 7688b068c20e76b62a75df3db145f0b602f773ab /lib | |
parent | 067e40591ad7d6713a410d19af9e97963440e239 (diff) | |
download | spack-dc25da1931d3fbebb64f35d37b1498f00d17141f.tar.gz spack-dc25da1931d3fbebb64f35d37b1498f00d17141f.tar.bz2 spack-dc25da1931d3fbebb64f35d37b1498f00d17141f.tar.xz spack-dc25da1931d3fbebb64f35d37b1498f00d17141f.zip |
tests/pythons: convert to new stand-alone test process (#38340)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/build_systems/python.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/spack/spack/build_systems/python.py b/lib/spack/spack/build_systems/python.py index f365fefe0f..7a355490f7 100644 --- a/lib/spack/spack/build_systems/python.py +++ b/lib/spack/spack/build_systems/python.py @@ -23,6 +23,7 @@ import spack.spec import spack.store from spack.directives import build_system, depends_on, extends, maintainers from spack.error import NoHeadersError, NoLibrariesError, SpecError +from spack.install_test import test_part from spack.version import Version from ._checks import BaseBuilder, execute_install_time_tests @@ -167,18 +168,20 @@ class PythonExtension(spack.package_base.PackageBase): view.remove_files(to_remove) - 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.path for module in self.import_modules: - self.run_test( - inspect.getmodule(self).python.path, - ["-c", "import {0}".format(module)], - purpose="checking import of {0}".format(module), + with test_part( + self, + f"test_imports_{module}", + purpose=f"checking import of {module}", work_dir="spack-test", - ) + ): + python("-c", f"import {module}") def update_external_dependencies(self, extendee_spec=None): """ |