title: Testing Python Scripts
body: <p>How do I test the STDOUT output of a Python script with a testing framework like doctest, unittest, nose, etc? For example, say running my script &quot;todo.py --list&quot; should return &quot;take out the garbage&quot;.</p>
  <p>I've read someone who separates out the STDOUT printing part of the script from the part that generates the output to be printed. I'm used to sprinkling print statements all around my shell scripts. Is this simply a TDD unfriendly habit I should break or is there a way to easily test for correct print output?</p>