~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_osutils.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-07-02 15:39:26 UTC
  • mfrom: (2568.1.1 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20070702153926-23pkgktuxy6sahxr
(Elliot Murphy) Use os.lstat rather than os.stat for osutils.make_readonly/make_writeable

Show diffs side-by-side

added added

removed removed

Lines of Context:
247
247
        self.assertEqual(baz_path, osutils.dereference_path(foo_baz_path))
248
248
 
249
249
 
 
250
    def test_changing_access(self):
 
251
        f = file('file', 'w')
 
252
        f.write('monkey')
 
253
        f.close()
 
254
 
 
255
        # Make a file readonly
 
256
        osutils.make_readonly('file')
 
257
        mode = osutils.lstat('file').st_mode
 
258
        self.assertEqual(mode, mode & 0777555)
 
259
 
 
260
        # Make a file writable
 
261
        osutils.make_writable('file')
 
262
        mode = osutils.lstat('file').st_mode
 
263
        self.assertEqual(mode, mode | 0200)
 
264
 
 
265
        if osutils.has_symlinks():
 
266
            # should not error when handed a symlink
 
267
            os.symlink('nonexistent', 'dangling')
 
268
            osutils.make_readonly('dangling')
 
269
            osutils.make_writable('dangling')
 
270
 
 
271
 
250
272
    def test_kind_marker(self):
251
273
        self.assertEqual("", osutils.kind_marker("file"))
252
274
        self.assertEqual("/", osutils.kind_marker(osutils._directory_kind))