Fix tests

This is a version of #25 rebased on top of #27 which introduces Tox and Travis for testing.