'Replace the HOME environment variable until the end of the current
test, with the given new home-directory, so that L{os.path.expanduser}
will yield controllable, predictable results.
@param tempHome: the pathname to replace the HOME variable with.
@type tempHome: L{str}'

def replaceHome(self, tempHome):

    oldHome = os.environ.get('HOME')
    def cleanupHome():
        if (oldHome is None):
            del os.environ['HOME']
        else:
            os.environ['HOME'] = oldHome
    self.addCleanup(cleanupHome)
    os.environ['HOME'] = tempHome
