Fix warnings when building tests

Also fixes an issue where one of the tests was creating files in the test data directory.