A bunch of changes, the biggest of which is a py.test-based test suite w/ travis & coveralls integration

it would be better to use pytest "capfd" or "capsys" builtin fixture for this. For stdin, you can use a fixture that builds upon builtin fixture "monkeypatch", so that mock is not required anymore.