Mimic actual temp dir detection during tests

This fixes a bug where upon second run of the tests, the temp files would always
be used instead of cleared as desired.
Merge pull request #11 from jesstelford/fix/test-temp-dir

Mimic actual temp dir detection during tests