~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_permissions.py

  • Committer: John Arbash Meinel
  • Date: 2011-05-11 11:35:28 UTC
  • mto: This revision was merged to the branch mainline in revision 5851.
  • Revision ID: john@arbash-meinel.com-20110511113528-qepibuwxicjrbb2h
Break compatibility with python <2.6.

This includes auditing the code for places where we were doing
explicit 'sys.version' checks and removing them as appropriate.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005-2011 Canonical Ltd
2
2
# -*- coding: utf-8 -*-
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
32
32
 
33
33
import os
34
34
import sys
35
 
import stat
36
 
from cStringIO import StringIO
37
35
import urllib
38
36
 
39
37
from bzrlib import transport
65
63
    :param dir_mode: The mode for all directories
66
64
    :param include_base: If false, only check the subdirectories
67
65
    """
68
 
    t = transport.get_transport(".")
 
66
    t = test.get_transport()
69
67
    if include_base:
70
68
        test.assertTransportMode(t, base, dir_mode)
71
69
    for root, dirs, files in os.walk(base):
140
138
    def test_new_files_group_sticky_bit(self):
141
139
        if sys.platform == 'win32':
142
140
            raise TestSkipped('chmod has no effect on win32')
143
 
        elif sys.platform == 'darwin' or sys.platform.startswith('freebsd'):
144
 
            # OS X (and FreeBSD) create temp dirs with the 'wheel' group, which
145
 
            # users are not likely to be in, and this prevents us from setting
146
 
            # the sgid bit
 
141
        elif sys.platform == 'darwin' or 'freebsd' in sys.platform:
 
142
            # FreeBSD-based platforms create temp dirs with the 'wheel' group,
 
143
            # which users are not likely to be in, and this prevents us from
 
144
            # setting the sgid bit
147
145
            os.chown(self.test_dir, os.getuid(), os.getgid())
148
146
 
149
147
        t = self.make_branch_and_tree('.')
180
178
 
181
179
        # bodge around for stubsftpserver not letting use connect
182
180
        # more than once
183
 
        _t = transport.get_transport(self.get_url())
 
181
        _t = self.get_transport()
184
182
 
185
183
        os.mkdir('local')
186
184
        t_local = self.make_branch_and_tree('local')
257
255
        original_umask = os.umask(umask)
258
256
 
259
257
        try:
260
 
            t = transport.get_transport(self.get_url())
 
258
            t = self.get_transport()
261
259
            # Direct access should be masked by umask
262
260
            t._sftp_open_exclusive('a', mode=0666).write('foo\n')
263
261
            self.assertTransportMode(t, 'a', 0666 &~umask)