Rev 2426: Fix up blackbox test_add to avoid depending on inventory not being held in memory in http://sourcefrog.net/bzr/dirstate-plus-subtree

Martin Pool mbp at sourcefrog.net
Fri Mar 2 08:56:39 GMT 2007


At http://sourcefrog.net/bzr/dirstate-plus-subtree

------------------------------------------------------------
revno: 2426
revision-id: mbp at sourcefrog.net-20070302085638-pr8pa43gffwig209
parent: mbp at sourcefrog.net-20070302085516-0yyuvauummgcycsm
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: dirstate-plus-subtree
timestamp: Fri 2007-03-02 19:56:38 +1100
message:
  Fix up blackbox test_add to avoid depending on inventory not being held in memory
modified:
  bzrlib/tests/blackbox/test_add.py test_add.py-20060518072250-857e4f86f54a30b2
=== modified file 'bzrlib/tests/blackbox/test_add.py'
--- a/bzrlib/tests/blackbox/test_add.py	2007-03-01 08:44:14 +0000
+++ b/bzrlib/tests/blackbox/test_add.py	2007-03-02 08:56:38 +0000
@@ -111,12 +111,17 @@
         
         self.build_tree(['src/foo.c'])
         
+        # add with no arguments in a subdirectory gets only files below that
+        # subdirectory
         chdir('src')
         self.run_bzr('add')
-        
         self.assertEquals(self.capture('unknowns'), 'README\n')
-        eq(len(list(t)), 3)
+        t.read_working_inventory()
+        versioned = [path for path, entry in t.iter_entries_by_dir()]
+        self.assertEquals(versioned,
+            ['', 'src', 'src/foo.c'])
                 
+        # add from the parent directory should pick up all file names
         chdir('..')
         self.run_bzr('add')
         self.assertEquals(self.capture('unknowns'), '')
@@ -143,7 +148,7 @@
                              'added b w/ file id from b\n'
                              'added b/c w/ file id from b/c\n',
                              out)
-
+        new_tree = new_tree.bzrdir.open_workingtree()
         self.assertEqual(base_tree.path2id('a'), new_tree.path2id('a'))
         self.assertEqual(base_tree.path2id('b'), new_tree.path2id('b'))
         self.assertEqual(base_tree.path2id('b/c'), new_tree.path2id('b/c'))
@@ -164,6 +169,7 @@
                              'added d w/ file id from b/d\n',
                              out)
 
+        new_tree = new_tree.bzrdir.open_workingtree()
         self.assertEqual(base_tree.path2id('b/c'), new_tree.path2id('c'))
         self.assertEqual(base_tree.path2id('b/d'), new_tree.path2id('d'))
 




More information about the bazaar-commits mailing list