Use proper tempdir for temporary test files.

Writing temporary files in source tree is just wrong. Instead, use
a directory inside system tempdir.
Merge pull request #200 from mgorny/tests-tmpfiles

Use proper tempdir for temporary test files