tests/py-libensemble: convert to new stand-alone test process (#38344)
This commit is contained in:
parent
ef42fd7a2f
commit
9a047eb95f
@ -69,28 +69,24 @@ def cache_test_sources(self):
|
|||||||
install test subdirectory for use during `spack test run`."""
|
install test subdirectory for use during `spack test run`."""
|
||||||
self.cache_extra_test_sources(join_path("examples", "calling_scripts", "regression_tests"))
|
self.cache_extra_test_sources(join_path("examples", "calling_scripts", "regression_tests"))
|
||||||
|
|
||||||
def run_tutorial_tests(self, exe):
|
def run_tutorial_script(self, script):
|
||||||
"""Run example stand alone test"""
|
"""run the tutorial example regression test"""
|
||||||
|
|
||||||
test_dir = join_path(
|
exe = (
|
||||||
self.test_suite.current_test_cache_dir,
|
self.test_suite.current_test_cache_dir.examples.calling_scripts.regression_tests.join(
|
||||||
"examples",
|
script
|
||||||
"calling_scripts",
|
)
|
||||||
"regression_tests",
|
|
||||||
)
|
)
|
||||||
|
if not os.path.isfile(exe):
|
||||||
|
raise SkipTest(f"{script} is missing")
|
||||||
|
|
||||||
if not os.path.isfile(join_path(test_dir, exe)):
|
python = self.spec["python"].command
|
||||||
print("SKIPPED: {0} test does not exist".format(exe))
|
python(exe, "--comms", "local", "--nworkers", "2")
|
||||||
return
|
|
||||||
|
|
||||||
self.run_test(
|
def test_uniform_sampling(self):
|
||||||
self.spec["python"].command.path,
|
"""run test_uniform_sampling.py"""
|
||||||
options=[exe, "--comms", "local", "--nworkers", "2"],
|
self.run_tutorial_script("test_uniform_sampling.py")
|
||||||
purpose="test: run {0} example".format(exe),
|
|
||||||
work_dir=test_dir,
|
|
||||||
)
|
|
||||||
|
|
||||||
def test(self):
|
def test_1d_sampling(self):
|
||||||
super(__class__, self).test()
|
"""run test_1d_sampling.py"""
|
||||||
for tutorial in ["test_uniform_sampling.py", "test_1d_sampling.py"]:
|
self.run_tutorial_script("test_1d_sampling.py")
|
||||||
self.run_tutorial_tests(tutorial)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user