diff --git a/src/CashFlow_ExtMod.py b/src/CashFlow_ExtMod.py index e25fa4e25..7eb795d88 100644 --- a/src/CashFlow_ExtMod.py +++ b/src/CashFlow_ExtMod.py @@ -116,11 +116,15 @@ def run(self, container, Inputs): # ===================================================================================================================== - ################################# -# Run the plugin in stand alone # +# Function to Run the plugin in stand alone # ################################# -if __name__ == "__main__": +def tealMain(): + """ + function to run as main + @ In, None + @ Out, None + """ # emulate RAVEN container class FakeSelf: """ @@ -202,3 +206,7 @@ def __init__(self): csvWrite = csv.DictWriter(out, outDict.keys()) csvWrite.writeheader() csvWrite.writerow(outDict) + + +if __name__ == "__main__": + tealMain() diff --git a/tests/CashFlow_test_NPV_RunAsCode.py b/tests/CashFlow_test_NPV_RunAsCode.py index 5df9dc070..df1cce938 100644 --- a/tests/CashFlow_test_NPV_RunAsCode.py +++ b/tests/CashFlow_test_NPV_RunAsCode.py @@ -1,8 +1,18 @@ import os import sys + +#Check if path needed to be setup +try: + import TEAL +except ModuleNotFoundError: + sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..")) + import TEAL + # run the Cash Flow plugin as stand alone code -os.system('python ../src/CashFlow_ExtMod.py -iXML Cash_Flow_input_NPV.xml -iINP VarInp.txt -o out.out') +from TEAL.src import CashFlow_ExtMod +sys.argv = [sys.argv[0],"-iXML","Cash_Flow_input_NPV.xml","-iINP","VarInp.txt","-o","out.out"] +CashFlow_ExtMod.tealMain() # read out.out and compare with gold last = None diff --git a/tests/tests b/tests/tests index c97470450..962465c17 100644 --- a/tests/tests +++ b/tests/tests @@ -58,7 +58,6 @@ [./CashFlow_NPV_RunAsCode] type = 'RavenPython' input = 'CashFlow_test_NPV_RunAsCode.py' - skip = 'Need to create driver to make this work' [../] [./CashFlow_NPV_customTime]