summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorRicharda Butler <39577672+RikkiButler20@users.noreply.github.com>2021-10-26 13:11:53 -0700
committerGitHub <noreply@github.com>2021-10-26 13:11:53 -0700
commitbc616a60b7ce992e9561b2b2a5a5c74c4a5a6b43 (patch)
treeb21e9d2c8a098164f0a2a857fc829cfaa7635d54 /var
parentad039814687ef9f774d514de3592ee53dbfa996f (diff)
downloadspack-bc616a60b7ce992e9561b2b2a5a5c74c4a5a6b43.tar.gz
spack-bc616a60b7ce992e9561b2b2a5a5c74c4a5a6b43.tar.bz2
spack-bc616a60b7ce992e9561b2b2a5a5c74c4a5a6b43.tar.xz
spack-bc616a60b7ce992e9561b2b2a5a5c74c4a5a6b43.zip
Py-Libensemble: Add E4S testsuite stand alone test (#26270)
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/py-libensemble/package.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/py-libensemble/package.py b/var/spack/repos/builtin/packages/py-libensemble/package.py
index 16cc3706de..076f2e7b73 100644
--- a/var/spack/repos/builtin/packages/py-libensemble/package.py
+++ b/var/spack/repos/builtin/packages/py-libensemble/package.py
@@ -3,6 +3,7 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+import os
from spack import *
@@ -60,3 +61,28 @@ class PyLibensemble(PythonPackage):
depends_on('tasmanian+python', type=('build', 'run'), when='+tasmanian')
depends_on('py-pyyaml', type=('build', 'run'), when='+pyyaml')
conflicts('~mpi', when='@:0.4.1')
+
+ @run_after('install')
+ def cache_test_sources(self):
+ """Copy the example source files after the package is installed to an
+ 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"""
+
+ test_dir = join_path(self.test_suite.current_test_cache_dir,
+ 'examples', 'calling_scripts', 'regression_tests')
+
+ if not os.path.isfile(join_path(test_dir, exe)):
+ print('Skipping {0} test'.format(exe))
+ return
+
+ 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(self):
+ self.run_tutorial_tests('test_uniform_sampling.py')