~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_osutils.py

  • Committer: John Arbash Meinel
  • Date: 2006-08-09 14:43:27 UTC
  • mto: This revision was merged to the branch mainline in revision 1912.
  • Revision ID: john@arbash-meinel.com-20060809144327-d604af2edf646794
Clean up and write tests for permissions. Now we use fstat which should be cheap, and lets us check the permissions and the file size

Show diffs side-by-side

added added

removed removed

Lines of Context:
131
131
            finally:
132
132
                os.remove('socket')
133
133
 
 
134
    def test_get_umask(self):
 
135
        if sys.platform == 'win32':
 
136
            # umask always returns '0', no way to set it
 
137
            self.assertEqual(0, osutils.get_umask())
 
138
            return
 
139
 
 
140
        orig_umask = osutils.get_umask()
 
141
        try:
 
142
            os.umask(0222)
 
143
            self.assertEqual(0222, osutils.get_umask())
 
144
            os.umask(0022)
 
145
            self.assertEqual(0022, osutils.get_umask())
 
146
            os.umask(0002)
 
147
            self.assertEqual(0002, osutils.get_umask())
 
148
            os.umask(0027)
 
149
            self.assertEqual(0027, osutils.get_umask())
 
150
        finally:
 
151
            os.umask(orig_umask)
 
152
 
134
153
 
135
154
class TestSafeUnicode(TestCase):
136
155