Rev 5013: Fix imports in blackbox/test_add.py. in file:///home/vila/src/bzr/bugs/322767-dont-add-conflict-related-files/

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Feb 8 08:17:50 GMT 2010


At file:///home/vila/src/bzr/bugs/322767-dont-add-conflict-related-files/

------------------------------------------------------------
revno: 5013
revision-id: v.ladeuil+lp at free.fr-20100208081750-7gw5vyzijehmtuys
parent: pqm at pqm.ubuntu.com-20100207105126-fgu710q48to6z77q
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 322767-dont-add-conflict-related-files
timestamp: Mon 2010-02-08 09:17:50 +0100
message:
  Fix imports in blackbox/test_add.py.
-------------- next part --------------
=== modified file 'bzrlib/tests/blackbox/test_add.py'
--- a/bzrlib/tests/blackbox/test_add.py	2009-11-08 00:05:26 +0000
+++ b/bzrlib/tests/blackbox/test_add.py	2010-02-08 08:17:50 +0000
@@ -19,32 +19,28 @@
 
 import os
 
-from bzrlib import osutils
-from bzrlib.tests import (
-    condition_isinstance,
-    split_suite_by_condition,
-    multiply_tests,
-    SymlinkFeature
+from bzrlib import (
+    osutils,
+    tests,
     )
-from bzrlib.tests.blackbox import ExternalBase
 
 
 def load_tests(standard_tests, module, loader):
     """Parameterize tests for view-aware vs not."""
-    to_adapt, result = split_suite_by_condition(
-        standard_tests, condition_isinstance(TestAdd))
+    to_adapt, result = tests.split_suite_by_condition(
+        standard_tests, tests.condition_isinstance(TestAdd))
     scenarios = [
         ('pre-views', {'branch_tree_format': 'pack-0.92'}),
         ('view-aware', {'branch_tree_format': 'development6-rich-root'}),
         ]
-    return multiply_tests(to_adapt, scenarios, result)
-
-
-class TestAdd(ExternalBase):
+    return tests.multiply_tests(to_adapt, scenarios, result)
+
+
+class TestAdd(tests.TestCaseWithTransport):
 
     def make_branch_and_tree(self, dir):
-        return ExternalBase.make_branch_and_tree(self, dir,
-            format=self.branch_tree_format)
+        return super(TestAdd, self).make_branch_and_tree(
+            dir, format=self.branch_tree_format)
 
     def test_add_reports(self):
         """add command prints the names of added files."""
@@ -115,7 +111,6 @@
 
         eq = self.assertEqual
         ass = self.assertTrue
-        chdir = os.chdir
 
         t = self.make_branch_and_tree('.')
         b = t.branch
@@ -130,17 +125,15 @@
 
         # add with no arguments in a subdirectory gets only files below that
         # subdirectory
-        chdir('src')
-        self.run_bzr('add')
-        self.assertEquals(self.run_bzr('unknowns')[0], 'README\n')
+        self.run_bzr('add', working_dir='src')
+        self.assertEquals('README\n',
+                          self.run_bzr('unknowns', working_dir='src')[0])
         # reopen to see the new changes
-        t = t.bzrdir.open_workingtree()
+        t = t.bzrdir.open_workingtree('src')
         versioned = [path for path, entry in t.iter_entries_by_dir()]
-        self.assertEquals(versioned,
-            ['', 'src', 'src/foo.c'])
+        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.run_bzr('unknowns')[0], '')
         self.run_bzr('check')
@@ -211,7 +204,7 @@
         self.assertContainsRe(err, r'ERROR:.*\.bzr.*control file')
 
     def test_add_via_symlink(self):
-        self.requireFeature(SymlinkFeature)
+        self.requireFeature(tests.SymlinkFeature)
         self.make_branch_and_tree('source')
         self.build_tree(['source/top.txt'])
         os.symlink('source', 'link')
@@ -219,7 +212,7 @@
         self.assertEquals(out, 'adding top.txt\n')
 
     def test_add_symlink_to_abspath(self):
-        self.requireFeature(SymlinkFeature)
+        self.requireFeature(tests.SymlinkFeature)
         self.make_branch_and_tree('tree')
         os.symlink(osutils.abspath('target'), 'tree/link')
         out = self.run_bzr(['add', 'tree/link'])[0]



More information about the bazaar-commits mailing list