parflow: Old test method to new test method (#44933)

* parflow: Old test method to new test method
* add output checker
* made req. changes
This commit is contained in:
AcriusWinter 2024-07-16 12:43:31 -07:00 committed by GitHub
parent 6d3541c5fd
commit c2ada0f15a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,8 +3,6 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
from spack.package import * from spack.package import *
@ -65,21 +63,16 @@ def setup_run_environment(self, env):
examples_dir = "examples" examples_dir = "examples"
def test(self): def test_single_phase_flow(self):
"""Perform smoke test on installed ParFlow package.""" """Run the single phase flow test"""
# Run the single phase flow test
run_path = join_path(self.spec.prefix, self.examples_dir) run_path = join_path(self.spec.prefix, self.examples_dir)
if os.path.isdir(run_path): options = ["default_single.tcl", "1", "1" "1"]
with working_dir(run_path): with working_dir(run_path):
self.run_test( exe = which(f"{self.spec['tcl'].prefix.bin}/tclsh")
"{0}/tclsh".format(self.spec["tcl"].prefix.bin), exe(*options)
["default_single.tcl", "1", "1" "1"],
) def test_check_version(self):
else: """Test if exe executes"""
# If examples are not installed test if exe executes exe = which(join_path(self.prefix.bin, "parflow"))
exes = ["parflow"] out = exe("-v", output=str.split, error=str.split)
for exe in exes: assert str(self.spec.version) in out
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
)