Rewrite tests for sanity and better error messages

Fixes mysterious errors I got when running tests under tox, that I
didn't see with buildout, or on Jenkins, or on Travis CI.