summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>2023-06-15 10:09:57 -0700
committerGitHub <noreply@github.com>2023-06-15 12:09:57 -0500
commit9a047eb95f82c1559ee74ce1c4438e326b85844b (patch)
tree23c39a23bb0398bf368a63fe2c58d773fa8f0754
parentef42fd7a2f69b75de5e845f8a278a78f6cf9f6fc (diff)
downloadspack-9a047eb95f82c1559ee74ce1c4438e326b85844b.tar.gz
spack-9a047eb95f82c1559ee74ce1c4438e326b85844b.tar.bz2
spack-9a047eb95f82c1559ee74ce1c4438e326b85844b.tar.xz
spack-9a047eb95f82c1559ee74ce1c4438e326b85844b.zip
tests/py-libensemble: convert to new stand-alone test process (#38344)
-rw-r--r--var/spack/repos/builtin/packages/py-libensemble/package.py36
1 files changed, 16 insertions, 20 deletions
diff --git a/var/spack/repos/builtin/packages/py-libensemble/package.py b/var/spack/repos/builtin/packages/py-libensemble/package.py
index 3d7d3fc8e4..79f88b6c16 100644
--- a/var/spack/repos/builtin/packages/py-libensemble/package.py
+++ b/var/spack/repos/builtin/packages/py-libensemble/package.py
@@ -69,28 +69,24 @@ class PyLibensemble(PythonPackage):
install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources(join_path("examples", "calling_scripts", "regression_tests"))
- def run_tutorial_tests(self, exe):
- """Run example stand alone test"""
+ def run_tutorial_script(self, script):
+ """run the tutorial example regression test"""
- test_dir = join_path(
- self.test_suite.current_test_cache_dir,
- "examples",
- "calling_scripts",
- "regression_tests",
+ exe = (
+ self.test_suite.current_test_cache_dir.examples.calling_scripts.regression_tests.join(
+ script
+ )
)
+ if not os.path.isfile(exe):
+ raise SkipTest(f"{script} is missing")
- if not os.path.isfile(join_path(test_dir, exe)):
- print("SKIPPED: {0} test does not exist".format(exe))
- return
+ python = self.spec["python"].command
+ python(exe, "--comms", "local", "--nworkers", "2")
- self.run_test(
- self.spec["python"].command.path,
- options=[exe, "--comms", "local", "--nworkers", "2"],
- purpose="test: run {0} example".format(exe),
- work_dir=test_dir,
- )
+ def test_uniform_sampling(self):
+ """run test_uniform_sampling.py"""
+ self.run_tutorial_script("test_uniform_sampling.py")
- def test(self):
- super(__class__, self).test()
- for tutorial in ["test_uniform_sampling.py", "test_1d_sampling.py"]:
- self.run_tutorial_tests(tutorial)
+ def test_1d_sampling(self):
+ """run test_1d_sampling.py"""
+ self.run_tutorial_script("test_1d_sampling.py")