Skip to content

Commit

Permalink
Updating to work with new import structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
joshua-cogliati-inl committed Jan 22, 2024
1 parent 97e32db commit 4ef6c15
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
14 changes: 11 additions & 3 deletions src/CashFlow_ExtMod.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
"""
Expand Down Expand Up @@ -202,3 +206,7 @@ def __init__(self):
csvWrite = csv.DictWriter(out, outDict.keys())
csvWrite.writeheader()
csvWrite.writerow(outDict)


if __name__ == "__main__":
tealMain()
12 changes: 11 additions & 1 deletion tests/CashFlow_test_NPV_RunAsCode.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion tests/tests
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 4ef6c15

Please sign in to comment.