summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAcriusWinter <152348900+AcriusWinter@users.noreply.github.com>2024-07-16 12:43:31 -0700
committerGitHub <noreply@github.com>2024-07-16 12:43:31 -0700
commitc2ada0f15a625c4c576acf8b412b063f8f3b3f4c (patch)
treeb3ab8414c306082271c2ff85e63128c4254ecd1e
parent6d3541c5fd71e87f1eaf1f6045dbe818ea9c1a7e (diff)
downloadspack-c2ada0f15a625c4c576acf8b412b063f8f3b3f4c.tar.gz
spack-c2ada0f15a625c4c576acf8b412b063f8f3b3f4c.tar.bz2
spack-c2ada0f15a625c4c576acf8b412b063f8f3b3f4c.tar.xz
spack-c2ada0f15a625c4c576acf8b412b063f8f3b3f4c.zip
parflow: Old test method to new test method (#44933)
* parflow: Old test method to new test method * add output checker * made req. changes
-rw-r--r--var/spack/repos/builtin/packages/parflow/package.py31
1 files changed, 12 insertions, 19 deletions
diff --git a/var/spack/repos/builtin/packages/parflow/package.py b/var/spack/repos/builtin/packages/parflow/package.py
index 3906e6f8f4..dd05829fed 100644
--- a/var/spack/repos/builtin/packages/parflow/package.py
+++ b/var/spack/repos/builtin/packages/parflow/package.py
@@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
-import os
-
from spack.package import *
@@ -65,21 +63,16 @@ class Parflow(CMakePackage):
examples_dir = "examples"
- def test(self):
- """Perform smoke test on installed ParFlow package."""
- # Run the single phase flow test
+ def test_single_phase_flow(self):
+ """Run the single phase flow test"""
run_path = join_path(self.spec.prefix, self.examples_dir)
- if os.path.isdir(run_path):
- with working_dir(run_path):
- self.run_test(
- "{0}/tclsh".format(self.spec["tcl"].prefix.bin),
- ["default_single.tcl", "1", "1" "1"],
- )
- else:
- # If examples are not installed test if exe executes
- exes = ["parflow"]
- for exe in exes:
- reason = "test version of {0} is {1}".format(exe, self.spec.version)
- self.run_test(
- exe, ["-v"], [self.spec.version.string], installed=True, purpose=reason
- )
+ options = ["default_single.tcl", "1", "1" "1"]
+ with working_dir(run_path):
+ exe = which(f"{self.spec['tcl'].prefix.bin}/tclsh")
+ exe(*options)
+
+ def test_check_version(self):
+ """Test if exe executes"""
+ exe = which(join_path(self.prefix.bin, "parflow"))
+ out = exe("-v", output=str.split, error=str.split)
+ assert str(self.spec.version) in out