Made most scratch funcs methods of a ScratchContainer.

ScratchContainer is a generic class for any tests that need a fixture
that generates a scratchdir, mocks the environment and maybe even some
os functions, and then cleans up when all is done.
Added environment mocking to ScratchContainers.

Creates a mock of os.environ which is dict patched into place,
makes the user's homedir, and patches a few ugo lookup funcs.