fixed the distutils tests that were not writing in temp

This commit is contained in:
Tarek Ziadé 2009-10-02 22:37:51 +00:00
parent d3c87657ba
commit 641b1de2af
2 changed files with 24 additions and 28 deletions

View file

@ -49,13 +49,14 @@ class PyPIRCCommandTestCase(support.TempdirManager, unittest.TestCase):
def setUp(self):
"""Patches the environment."""
super(PyPIRCCommandTestCase, self).setUp()
if os.environ.has_key('HOME'):
self._old_home = os.environ['HOME']
else:
self._old_home = None
curdir = os.path.dirname(__file__)
os.environ['HOME'] = curdir
self.rc = os.path.join(curdir, '.pypirc')
tempdir = self.mkdtemp()
os.environ['HOME'] = tempdir
self.rc = os.path.join(tempdir, '.pypirc')
self.dist = Distribution()
class command(PyPIRCCommand):
@ -74,9 +75,8 @@ class PyPIRCCommandTestCase(support.TempdirManager, unittest.TestCase):
del os.environ['HOME']
else:
os.environ['HOME'] = self._old_home
if os.path.exists(self.rc):
os.remove(self.rc)
set_threshold(self.old_threshold)
super(PyPIRCCommandTestCase, self).tearDown()
def test_server_registration(self):
# This test makes sure PyPIRCCommand knows how to: