help needed in fixing test failure (#138600)
Parth Malwankar
parth.malwankar at gmail.com
Tue Feb 16 09:38:26 GMT 2010
So I was trying to come up with a fix for #138600 [1]
i.e. `bzr mkdir` create new dir before it checks if dir is a valid branch.
This seemed like a simple enough fix[2] so I created the patch and the
test case (diff below). Note that for the test case there is no run_bzr("init")
so I expect mkdir to fail (retcode=3).
Interesting, if I try the patch from the command prompt everything
works as expected (the dir is not created). However, the test case
fails with the debug prints:
isdir foo returns: False
isdir abc returns: True
The output of the manual run seems to work:
[138600]% bzr version-info
bzr: ERROR: Not a branch: "/home/parthm/tmp/b/138600/".
[138600]% ~/src/bzr.dev/138600/bzr --no-plugins mkdir foo baz baz
bzr: ERROR: Not a branch: "/home/parthm/tmp/b/138600/foo/".
bzr: warning: some compiled extensions could not be loaded; see
<https://answers.launchpad.net/bzr/+faq/703>
[138600]% ls
[138600]%
What I am doing wrong here?
Thanks,
Parth
[1] https://bugs.launchpad.net/bzr/+bug/138600
[2] https://code.launchpad.net/~parthm/bzr/138600
[blackbox]% bzr cdiff -r -3
=== modified file 'bzrlib/builtins.py'
--- bzrlib/builtins.py 2010-02-12 04:33:05 +0000
+++ bzrlib/builtins.py 2010-02-16 08:28:57 +0000
@@ -682,8 +682,8 @@
def run(self, dir_list):
for d in dir_list:
+ wt, dd = WorkingTree.open_containing(d)
os.mkdir(d)
- wt, dd = WorkingTree.open_containing(d)
wt.add([dd])
self.outf.write('added %s\n' % d)
=== modified file 'bzrlib/tests/blackbox/test_versioning.py'
--- bzrlib/tests/blackbox/test_versioning.py 2009-08-28 05:00:33 +0000
+++ bzrlib/tests/blackbox/test_versioning.py 2010-02-16 09:24:13 +0000
@@ -23,7 +23,7 @@
import os
from bzrlib.branch import Branch
-from bzrlib.osutils import pathjoin
+from bzrlib.osutils import pathjoin, isdir
from bzrlib.tests import TestCaseInTempDir, TestCaseWithTransport
from bzrlib.trace import mutter
from bzrlib.workingtree import WorkingTree
@@ -121,6 +121,14 @@
from bzrlib.check import check
check(b, False)
+ def test_mkdir_invalid(self):
+ """Basic 'bzr mkdir' operation should fail if !branch. Fix #138600"""
+
+ self.run_bzr('mkdir abc', retcode=3)
+ print "isdir foo returns: ", isdir('foo')
+ print "isdir abc returns: ", isdir('abc')
+ self.assertFalse(isdir('foo'))
+ self.assertFalse(isdir('abc'))
class SubdirCommit(TestCaseWithTransport):
More information about the bazaar
mailing list