'Patches the environment.'

def setUp(self):

    super(PyPIRCCommandTestCase, self).setUp()
    self.tmp_dir = self.mkdtemp()
    os.environ['HOME'] = self.tmp_dir
    self.rc = os.path.join(self.tmp_dir, '.pypirc')
    self.dist = Distribution()
    class command(PyPIRCCommand, ):
        def __init__(self, dist):
            PyPIRCCommand.__init__(self, dist)
        def initialize_options(self):
            pass
        finalize_options = initialize_options
    self._cmd = command
    self.old_threshold = set_threshold(WARN)
