At http://bzr.arbash-meinel.com/branches/bzr/1.8-dev/trivial_276436
------------------------------------------------------------
revno: 3754
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: John Arbash Meinel <[EMAIL PROTECTED]>
branch nick: trivial_276436
timestamp: Tue 2008-09-30 15:30:04 -0500
message:
Add some simple direct tests for WT.open and WT.open_containing.
Fixes bug #276436.
=== modified file 'bzrlib/tests/test_workingtree.py'
--- a/bzrlib/tests/test_workingtree.py 2008-05-12 04:07:49 +0000
+++ b/bzrlib/tests/test_workingtree.py 2008-09-30 20:30:04 +0000
@@ -81,6 +81,25 @@
workingtree.WorkingTreeFormat.set_default_format(old_format)
self.assertEqual(old_format,
workingtree.WorkingTreeFormat.get_default_format())
+ def test_open(self):
+ tree = self.make_branch_and_tree('.')
+ open_direct = tree.open('.')
+ self.assertEqual(tree.basedir, open_direct.basedir)
+ open_no_args = tree.open()
+ self.assertEqual(tree.basedir, open_no_args.basedir)
+
+ def test_open_containing(self):
+ tree = self.make_branch_and_tree('.')
+ open_direct, relpath = tree.open_containing('.')
+ self.assertEqual(tree.basedir, open_direct.basedir)
+ self.assertEqual('', relpath)
+ open_no_args, relpath = tree.open_containing()
+ self.assertEqual(tree.basedir, open_no_args.basedir)
+ self.assertEqual('', relpath)
+ open_subdir, relpath = tree.open_containing('subdir')
+ self.assertEqual(tree.basedir, open_subdir.basedir)
+ self.assertEqual('subdir', relpath)
+
class SampleTreeFormat(workingtree.WorkingTreeFormat):
"""A sample format
=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py 2008-09-25 01:11:30 +0000
+++ b/bzrlib/workingtree.py 2008-09-30 20:30:04 +0000
@@ -303,14 +303,14 @@
"""
if path is None:
- path = os.path.getcwdu()
+ path = osutils.getcwd()
control = bzrdir.BzrDir.open(path, _unsupported)
return control.open_workingtree(_unsupported)
-
+
@staticmethod
def open_containing(path=None):
"""Open an existing working tree which has its root about path.
-
+
This probes for a working tree at path and searches upwards from there.
Basically we keep looking up until we find the control directory or
--
bazaar-commits mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/bazaar-commits