Mercurial > bitten > bitten-test
changeset 222:206711a0b276
Fix test failure on windows, where a temporary directory could not be deleted due to insufficient permissions.
author | cmlenz |
---|---|
date | Mon, 26 Sep 2005 17:57:42 +0000 |
parents | 17e4b8d01db6 |
children | 067bde207c23 |
files | bitten/util/tests/archive.py |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/bitten/util/tests/archive.py +++ b/bitten/util/tests/archive.py @@ -93,9 +93,14 @@ self.assertRaises(archive.Error, archive.pack, self.env, repos) def test_pack_insufficient_perms(self): - os.chmod(os.path.join(self.env.path, 'snapshots'), 0500) - repos = Mock(get_node=lambda path, rev: Mock(isdir=True)) - self.assertRaises(archive.Error, archive.pack, self.env, repos) + try: + os.chmod(os.path.join(self.env.path, 'snapshots'), 0500) + repos = Mock(get_node=lambda path, rev: Mock(isdir=True)) + self.assertRaises(archive.Error, archive.pack, self.env, repos) + finally: + # Revert permissions, otherwise the environment directory can't be + # deleted on windows + os.chmod(os.path.join(self.env.path, 'snapshots'), 0700) class UnpackTestCase(unittest.TestCase):