tests/pythons: convert to new stand-alone test process (#38340)

This commit is contained in:
Tamara Dahlgren
2023-06-30 02:52:42 -07:00
committed by GitHub
parent 067e40591a
commit dc25da1931
2 changed files with 20 additions and 18 deletions

View File

@@ -23,6 +23,7 @@
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 @@ def remove_files_from_view(self, view, merge_map):
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):
"""