Fix unit tests

The current test setup seem to have fallen behind and it isn't obvious to me how to fix it. So, here's an idea for a new test setup. This setup is based on SenTestingKit. There's a variation on this setup based on shell scripts in a separate pull request. See them both as requests for comments.