Integration test fixes

Started as a fix for the redundant loading of test datasets (#330), but that made the problem of intermittent failures even worse (#305). That was a big clue, and anyway the tests wouldn't pass, so I had to fix that, too.