There are two reasons it doesn't work:
You imported
LCP_02
, so the__name__
value in that module is set to'LCP_02'
, not'__main__'
or'__testcase__'
. The name is never based on whatever imported the module.Just referencing
LCP_02
on a line won't 'invoke' that module; if the guarded code was going to run, it would have done so when importing.
Use a function in LCP_02
instead:
def run_test():
ask_costsurfacepath_path()
ask_outputpath_path()
CostSurfacefn = config.costsurfacepath
startCoord = (config.startX,config.startY)
stopCoord = (config.stopX,config.stopY)
outputPathfn = config.outputpath
main(CostSurfacefn,outputPathfn,startCoord,stopCoord)
if __name__ == "__main__":
run_test()
and call that function from your testcase.py
module:
LCP_02.run_test()