ingydotnet/yaml-pm — pull request #15 by kentfredric (2013-12-06 05:00:30+00:00)
Title: Various Patches to make tests safe under parallel testing

I finally got enough tuits to review and work out exactly where it was failing under parallel testing:

Basically, `dump-file.t` and `dump-file-utf8.t` were writing to the same file `dump.yaml`, which meant under parallel tests, one wrote over the other, so both tests saw the same file, despite having different requirements of that file.

Patch resolves this by simply using a unique file name for each relevant test, in addition to further hardening the test by incorporating `PID` in the temporary file name, so in the event somebody later naively duplicates one of the tests, the resulting combination of tests will still be unlikely to collide under parallel testing.

It also should be safe to run the same test with several hundred clones before ever seeing a problem with a file being unlinked from under the test expecting to find it.

I also walked over the whole test code base and looked for any other places an obvious collision could occur, with equally obvious solutions, and found only one place which could be improved upon, the `bugs-rt.t` test, which creates a filehandle object that writes to `/tmp/$$`.

Though it appears it never gets as far as actually writing that file, I further hardened the test by adding the name of the test to avoid potential weirdness if a `/tmp` directory for some mysterious reason had a file for every possible PID assignable on the system, also in the hope that if this test ever did emit a file, the file would be obvious where it came from, and would be easier for a user to tidy up as a result.

This patch set means the whole 2 people on CPAN who use parallel test harnesses will no longer have to disable parallel testing just so YAML doesn't fail.