Rev 3643: John's review feebdack: don't call chown unconditionally. in http://bazaar.launchpad.net/%7Ebzr/bzr/osx_tests_fix

Vincent Ladeuil v.ladeuil+lp at free.fr
Sun Aug 31 20:06:36 BST 2008


At http://bazaar.launchpad.net/%7Ebzr/bzr/osx_tests_fix

------------------------------------------------------------
revno: 3643
revision-id: v.ladeuil+lp at free.fr-20080831190607-m5kmikqnn4ssyt0f
parent: v.ladeuil+lp at free.fr-20080826164412-glyk2qaoyzb8zql5
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: osx_tests_fix
timestamp: Sun 2008-08-31 21:06:07 +0200
message:
  	John's review feebdack: don't call chown unconditionally.
  
  	* bzrlib/tests/__init__.py:
  	(_CaseInsensitiveFilesystemFeature): Drive-py typo fix.
  
  	* bzrlib/osutils.py:
  	(_mac_mkdtemp): Deleted, we don't to call chown for every temp dir
  	creation.
  
  	* bzrlib/tests/test_permissions.py:
  	(TestPermissions.test_new_files): Only this test needs a chown to
  	pass on darwin.
  
  	* bzrlib/tests/branch_implementations/test_permissions.py:
  	(TestPermissions.test_new_branch): Only this test needs a chown to
  	pass on darwin.
modified:
  bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/branch_implementations/test_permissions.py test_permissions.py-20060210110243-245c01403bf0fde6
  bzrlib/tests/test_permissions.py test_permissions.py-20051215004520-ccf475789c80e80c
-------------- next part --------------
=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py	2008-08-26 08:25:27 +0000
+++ b/bzrlib/osutils.py	2008-08-31 19:06:07 +0000
@@ -363,16 +363,6 @@
     return unicodedata.normalize('NFC', os.getcwdu())
 
 
-def _mac_mkdtemp(*args, **kwargs):
-    """Override default mkdtemp to set write group.
-
-    OSX set the group to 'wheel', we want the group to be the user's one
-    instead, so that we can set the group sticky bit if needed."""
-    tmp_dir = tempfile.mkdtemp(*args, **kwargs)
-    os.chown(tmp_dir, os.getuid(), os.getgid())
-    return tmp_dir
-
-
 # Default is to just use the python builtins, but these can be rebound on
 # particular platforms.
 abspath = _posix_abspath
@@ -421,7 +411,6 @@
         return shutil.rmtree(path, ignore_errors, onerror)
 elif sys.platform == 'darwin':
     getcwd = _mac_getcwd
-    mkdtemp = _mac_mkdtemp
 
 
 def get_terminal_encoding():

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2008-08-19 23:12:01 +0000
+++ b/bzrlib/tests/__init__.py	2008-08-31 19:06:07 +0000
@@ -3234,7 +3234,7 @@
 
 
 class _CaseInsensitiveFilesystemFeature(Feature):
-    """Check if underlined filesystem is case-insensitive
+    """Check if underlying filesystem is case-insensitive
     (e.g. on Windows, Cygwin, MacOS)
     """
 

=== modified file 'bzrlib/tests/branch_implementations/test_permissions.py'
--- a/bzrlib/tests/branch_implementations/test_permissions.py	2008-08-21 16:12:57 +0000
+++ b/bzrlib/tests/branch_implementations/test_permissions.py	2008-08-31 19:06:07 +0000
@@ -64,6 +64,11 @@
                                           ' permission logic')
         if sys.platform == 'win32':
             raise tests.TestNotApplicable('chmod has no effect on win32')
+        elif sys.platform == 'darwin':
+            # OS X creates temp dirs with the 'wheel' group, which users are
+            # not likely to be in, and this prevents us from setting the sgid
+            # bit
+            os.chown(self.test_dir, os.getuid(), os.getgid())
         # also, these are BzrBranch format specific things..
         os.mkdir('a')
         mode = stat.S_IMODE(os.stat('a').st_mode)

=== modified file 'bzrlib/tests/test_permissions.py'
--- a/bzrlib/tests/test_permissions.py	2008-05-21 03:05:59 +0000
+++ b/bzrlib/tests/test_permissions.py	2008-08-31 19:06:07 +0000
@@ -84,6 +84,11 @@
     def test_new_files(self):
         if sys.platform == 'win32':
             raise TestSkipped('chmod has no effect on win32')
+        elif sys.platform == 'darwin':
+            # OS X creates temp dirs with the 'wheel' group, which users are
+            # not likely to be in, and this prevents us from setting the sgid
+            # bit
+            os.chown(self.test_dir, os.getuid(), os.getgid())
 
         t = self.make_branch_and_tree('.')
         b = t.branch



More information about the bazaar-commits mailing list