While writing and testing a python method, I am currently using the following approach:
import foo as f
bar = f.bar()
bar.runMyMethodAndSeeIfItWorks()
If I change something in my method, and I need to retest it, I have to execute the following:
f = reload(foo)
bar = f.bar()
bar.runMyMethodAndSeeIfItWorks()
I was wondering if there is a simpler approach to this
Write a real unit test, and run it from the command line. I find this is one of the most compelling reasons for adopting unit testing: you’re going to need to try out your methods as you write them anyway, you might as well do it in a form that will be runnable for evermore after that.