make sure the cwd is restored on tearDown

This commit is contained in:
Tarek Ziade 2011-05-23 18:31:20 +02:00
parent 7870bdff5a
commit eb64b61bf5
1 changed files with 5 additions and 0 deletions

View File

@ -176,9 +176,14 @@ class ConfigTestCase(support.TempdirManager,
self.addCleanup(os.chdir, os.getcwd()) self.addCleanup(os.chdir, os.getcwd())
tempdir = self.mkdtemp() tempdir = self.mkdtemp()
self.working_dir = os.getcwd()
os.chdir(tempdir) os.chdir(tempdir)
self.tempdir = tempdir self.tempdir = tempdir
def tearDown(self):
os.chdir(self.working_dir)
super(ConfigTestCase, self).tearDown()
def write_setup(self, kwargs=None): def write_setup(self, kwargs=None):
opts = {'description-file': 'README', 'extra-files': '', opts = {'description-file': 'README', 'extra-files': '',
'setup-hook': 'packaging.tests.test_config.hook'} 'setup-hook': 'packaging.tests.test_config.hook'}