I am a newbie , hence any guidance is much appreciated I have a directory structure:
/testcases
__init__.py, testcases_int/
tc1.py,tc2.py,__init__.py,run.py
My intent is to run each of these tc1.py, tc2.py .. tc(x).py(x= new file will be added on need basis) by run.py I have existing code in run.py and tcx.py as :
#!/usr/bin/env python
import os,glob,subprocess
for name in glob.glob('tc*.py'):
cmd = 'python name'
subprocess.call(cmd)
#!/usr/bin/env python
import os,fabric,sys
class tc(object):
def __init__(self):
.....
def step1(self):
.....
def step2(self):
.....
def runner(self):
self.step1()
self.step2()
However I do not intend to run it as above, instead want to import the classes of tc(x).py into run.py and invoke 'runner' method of each tc(x).py class
I could statically import each of the tc1.py ,tc2.py into run.py, but this directory will keep growing with tc(x).py files, hence I want every time when run.py is executed: -- it will dynamically load all the tc(x).py -- instantiate the class of tc(x).py -- invoke its 'runner' method
Thanks much in advance