1
# Copyright (C) 2007, 2008 Canonical Ltd
1
# Copyright (C) 2007, 2008, 2009 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
1294
1294
self.assertEqual(sorted(expected), sorted(file_ids))
1296
def test_exceptions_raised(self):
1297
# This is a direct test of bug #495023, it relies on osutils.is_inside
1298
# getting called in an inner function. Which makes it a bit brittle,
1299
# but at least it does reproduce the bug.
1300
def is_inside_raises(*args, **kwargs):
1301
raise RuntimeError('stop this')
1302
tree = self.make_branch_and_tree('tree')
1303
self.build_tree(['tree/file', 'tree/dir/', 'tree/dir/sub',
1304
'tree/dir2/', 'tree/dir2/sub2'])
1305
tree.add(['file', 'dir', 'dir/sub', 'dir2', 'dir2/sub2'])
1306
tree.commit('first commit')
1308
self.addCleanup(tree.unlock)
1309
basis_tree = tree.basis_tree()
1310
orig = osutils.is_inside
1311
self.addCleanup(setattr, osutils, 'is_inside', orig)
1312
osutils.is_inside = is_inside_raises
1313
self.assertListRaises(RuntimeError, tree.iter_changes, basis_tree)
1296
1315
def test_simple_changes(self):
1297
1316
tree = self.make_branch_and_tree('tree')
1298
1317
self.build_tree(['tree/file'])