Python doctest for shell scripts that test argument parsing without polluting docstring with os.popen() Just found something looking like the answer you want: shell-doctest.