[Chicago] __name__ == "__main__"

Kumar McMillan kumar.mcmillan at gmail.com
Fri Oct 26 18:57:40 CEST 2007

On 10/26/07, Ian Bicking <ianb at colorstudy.com> wrote:
> Or you can use ScriptTest: http://pythonpaste.org/scripttest/ :
> from scripttest import TestFileEnvironment
> def test_mymodule_command():
>      env = TestFileEnvironment('./test-output')
>      res = env.run('myscript', '--some-option=foo')
>      assert 'sucess' in res.stdout

ah, nice!  this might even defeat my argument for creating main since
testing the script itself like above would reveal any micro bugs, like
putting the wrong main() under your __name__ == '__main__' block.  Not
that I've *ever* done anything dumb like that, of course ;)

More information about the Chicago mailing list