Rev 3754: Add some simple direct tests for WT.open and WT.open_containing. in http://bzr.arbash-meinel.com/branches/bzr/1.8-dev/trivial_276436
John Arbash Meinel
john at arbash-meinel.com
Tue Sep 30 21:30:32 BST 2008
At http://bzr.arbash-meinel.com/branches/bzr/1.8-dev/trivial_276436
------------------------------------------------------------
revno: 3754
revision-id: john at arbash-meinel.com-20080930203004-sf06gl9iaovamxzl
parent: pqm at pqm.ubuntu.com-20080930002605-dfe533l96sx35va8
committer: John Arbash Meinel <john at arbash-meinel.com>
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.
-------------- next part --------------
=== 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
More information about the bazaar-commits
mailing list