Make the dirutil test a proper unittest2 test.

Use unittest asserts instead of the assert keyword, use setUp/tearDown etc.

Also make sure we start with a clean slate, in case other tests use
the atexit functionality.