Rev 5606: (jameinel) Transform.rename test shouldn't assume the str form of the in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Jan 13 01:29:47 UTC 2011


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5606 [merge]
revision-id: pqm at pqm.ubuntu.com-20110113012941-v9j2hrptxaaxvi7l
parent: pqm at pqm.ubuntu.com-20110112233716-ll3papi4704tefjg
parent: gzlist at googlemail.com-20110112224027-lswaatv9ea4mm2r9
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2011-01-13 01:29:41 +0000
message:
  (jameinel) Transform.rename test shouldn't assume the str form of the
   exception because of locale issues. (Martin [gz])
modified:
  bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
=== modified file 'bzrlib/tests/test_transform.py'
--- a/bzrlib/tests/test_transform.py	2011-01-12 01:01:53 +0000
+++ b/bzrlib/tests/test_transform.py	2011-01-13 01:29:41 +0000
@@ -14,6 +14,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
+import errno
 import os
 from StringIO import StringIO
 import sys
@@ -897,9 +898,14 @@
         # On windows looks like:
         # "Failed to rename .../work/myfile to 
         # .../work/.bzr/checkout/limbo/new-1: [Errno 13] Permission denied"
-        # The strerror will vary per OS and language so it's not checked here
-        self.assertContainsRe(str(e),
-            "Failed to rename .*(first-dir.newname:|myfile)")
+        # This test isn't concerned with exactly what the error looks like,
+        # and the strerror will vary across OS and locales, but the assert
+        # that the exeception attributes are what we expect
+        self.assertEqual(e.errno, errno.EACCES)
+        if os.name == "posix":
+            self.assertEndsWith(e.to_path, "/first-dir/newname")
+        else:
+            self.assertEqual(os.path.basename(e.from_path), "myfile")
 
     def test_set_executability_order(self):
         """Ensure that executability behaves the same, no matter what order.




More information about the bazaar-commits mailing list