I have a file allthetests.py
with a number of small functions defined like this:
def test1():
##do some stuff
if (everything_is_awesome):
return({"status":PASS, "data":"all the data"})
def test2():
##do some different stuff
if (everything_is_bad):
return({"status":FAIL, "data":"no data"})
Then I have another bunch of files which are descriptions of nodes and get imported as dicts like this
{"node_type":"action",
"title":"things",
"test":"test2"}
Finally I have a third file main.py
which is in charge of everything.
In this third file, I want to import allthetests.py
, load the node descriptions and then call allthetests.test1()
or allthetests.test2()
or whatever that case is. I imagine it might look something like this but I'm not really sure where to go from here...
import allthetests
cur_node = load_node()
## Doesn't work but...
return_val = allthetests.cur_node['test']()