# Copyright 2024, Battelle Energy Alliance, LLC All Rights Reserved
"""
Tests by running an executable.
"""
import os
import sys
[docs]POEM_LOC = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..')) # POEM Plugin Folder
sys.path.append(POEM_LOC)
import POEM.src._utils as POEM_utils
# get RAVEN base testers
RAVEN_FRAMEWORK_LOC, _ = POEM_utils.get_raven_loc()
[docs]TESTER_LOC = os.path.join(RAVEN_FRAMEWORK_LOC, 'scripts', 'TestHarness', 'testers')
sys.path.append(TESTER_LOC)
from RavenFramework import RavenFramework as RavenTester
[docs]class PoemRun(RavenTester):
"""
A POEM stand-alone test interface.
"""
@staticmethod
[docs] def get_valid_params():
"""
Return a list of valid parameters and their descriptions for this type
of test.
@ In, None
@ Out, params, _ValidParameters, the parameters for this class.
"""
params = RavenTester.get_valid_params()
params.add_param('inputArg', '-i', 'Input argument to POEM')
# params.add_param('output', '-o', 'Output argument to POEM')
params.add_param('norun', '', 'Argument "norun" to POEM') # valid keyword "-nr"
return params
def __init__(self, name, param):
"""
Constructor.
@ In, name, str, name of test
@ In, params, dict, test parameters
@ Out, None
"""
RavenTester.__init__(self, name, param)
[docs] self.poem_driver = os.path.join(POEM_LOC, 'POEM', 'src', 'main.py')
[docs] def get_command(self):
"""
Return the command this test will run.
@ In, None
@ Out, cmd, string, command to run
"""
cmd = ''
pythonCmd = self._get_python_command()
cmd = pythonCmd + " " + self.poem_driver + " " + self.specs["inputArg"] + " " + self.specs["input"]
print('norun', self.specs['norun'])
if self.specs['norun'].lower() == '-nr':
cmd = cmd + " " + self.specs['norun']
print(cmd)
return cmd