~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to tests/upstream_import.py

  • Committer: Aaron Bentley
  • Date: 2007-03-02 05:46:38 UTC
  • mto: (517.1.1 bzrtools-0.15)
  • mto: This revision was merged to the branch mainline in revision 519.
  • Revision ID: aaron.bentley@utoronto.ca-20070302054638-9wnd7yu0kjv6uvjv
Fix all test suite bugs w/ dirstate

Show diffs side-by-side

added added

removed removed

Lines of Context:
170
170
    def archive_test(self, builder, importer, subdir=False):
171
171
        archive_file = self.make_archive(builder, subdir)
172
172
        tree = BzrDir.create_standalone_workingtree('tree')
173
 
        importer(tree, archive_file)
174
 
        self.assertTrue(tree.path2id('README') is not None) 
175
 
        self.assertTrue(tree.path2id('FEEDME') is not None)
176
 
        self.assertTrue(os.path.isfile(tree.abspath('README')))
177
 
        self.assertEqual(tree.inventory[tree.path2id('README')].kind, 'file')
178
 
        self.assertEqual(tree.inventory[tree.path2id('FEEDME')].kind, 'file')
179
 
        
180
 
        f = file(tree.abspath('junk/food'), 'wb')
181
 
        f.write('I like food\n')
182
 
        f.close()
 
173
        tree.lock_write()
 
174
        try:
 
175
            importer(tree, archive_file)
 
176
            self.assertTrue(tree.path2id('README') is not None)
 
177
            self.assertTrue(tree.path2id('FEEDME') is not None)
 
178
            self.assertTrue(os.path.isfile(tree.abspath('README')))
 
179
            self.assertEqual(tree.inventory[tree.path2id('README')].kind,
 
180
                'file')
 
181
            self.assertEqual(tree.inventory[tree.path2id('FEEDME')].kind,
 
182
                'file')
 
183
            f = file(tree.abspath('junk/food'), 'wb')
 
184
            f.write('I like food\n')
 
185
            f.close()
183
186
 
184
 
        archive_file = self.make_archive2(builder, subdir)
185
 
        importer(tree, archive_file)
186
 
        self.assertTrue(tree.path2id('README') is not None) 
187
 
        self.assertTrue(not os.path.exists(tree.abspath('FEEDME')))
 
187
            archive_file = self.make_archive2(builder, subdir)
 
188
            importer(tree, archive_file)
 
189
            self.assertTrue(tree.path2id('README') is not None)
 
190
            self.assertTrue(not os.path.exists(tree.abspath('FEEDME')))
 
191
        finally:
 
192
            tree.unlock()
188
193
 
189
194
 
190
195
    def test_untar2(self):