~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_branch/test_permissions.py

  • Committer: Jelmer Vernooij
  • Date: 2012-02-20 12:19:29 UTC
  • mfrom: (6437.23.11 2.5)
  • mto: (6581.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 6582.
  • Revision ID: jelmer@samba.org-20120220121929-7ni2psvjoatm1yp4
Merge bzr/2.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
import os
30
30
import sys
31
31
import stat
32
 
from StringIO import StringIO
33
32
 
34
33
from bzrlib import tests
35
 
from bzrlib.branch import Branch
 
34
from bzrlib.branch import BzrBranch
36
35
from bzrlib.bzrdir import BzrDir
37
 
from bzrlib.lockable_files import LockableFiles
38
36
from bzrlib.remote import RemoteBranchFormat
39
 
from bzrlib.tests.test_permissions import chmod_r, check_mode_r
40
 
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
41
 
from bzrlib.workingtree import WorkingTree
 
37
from bzrlib.tests.test_permissions import check_mode_r
42
38
 
43
39
 
44
40
class _NullPermsStat(object):
63
59
                                          ' permission logic')
64
60
        if sys.platform == 'win32':
65
61
            raise tests.TestNotApplicable('chmod has no effect on win32')
66
 
        # also, these are BzrBranch format specific things..
67
62
        os.mkdir('a')
68
63
        mode = stat.S_IMODE(os.stat('a').st_mode)
69
64
        t = self.make_branch_and_tree('.')
 
65
        # also, these are BzrBranch format specific things..
 
66
        if not isinstance(t.branch, BzrBranch):
 
67
            raise tests.TestNotApplicable(
 
68
                "Only applicable to bzr branches")
70
69
        b = t.branch
71
70
        self.assertEqualMode(mode, b.bzrdir._get_dir_mode())
72
71
        self.assertEqualMode(mode & ~07111, b.bzrdir._get_file_mode())
95
94
            # which users are not likely to be in, and this prevents us
96
95
            # from setting the sgid bit
97
96
            os.chown(self.test_dir, os.getuid(), os.getgid())
98
 
        # also, these are BzrBranch format specific things..
99
97
        t = self.make_branch_and_tree('.')
100
98
        b = t.branch
 
99
        # also, these are BzrBranch format specific things..
 
100
        if not isinstance(b, BzrBranch):
 
101
            raise tests.TestNotApplicable(
 
102
                "Only applicable to bzr branches")
101
103
        os.mkdir('b')
102
104
        os.chmod('b', 02777)
103
105
        b = self.make_branch('b')