~ubuntu-branches/debian/sid/obnam/sid

« back to all changes in this revision

Viewing changes to obnamlib/vfs.py

  • Committer: Package Import Robot
  • Author(s): Lars Wirzenius
  • Date: 2013-11-30 11:18:48 UTC
  • mfrom: (1.1.14)
  • Revision ID: package-import@ubuntu.com-20131130111848-393of9hf0s2ohtlv
Tags: 1.6-1
* New upstream version.
  - Adds a better example for "obnam mount" (Closes: #726808)
  - Explain --log-max units in manpage (Closes:  #683868)
  - Fix bug for sftp URL handling of /~/ for home dirs 
    (Closes: #684349)
  - Missing node problem fixes (Closes: #705554)
* Add Depends and Build-Depends on python-fuse. (Closes: #722553)

Show diffs side-by-side

added added

removed removed

Lines of Context:
160
160
    def lchown(self, pathname, uid, gid):
161
161
        '''Like os.lchown.'''
162
162
 
163
 
    def chmod(self, pathname, mode):
164
 
        '''Like os.chmod.'''
 
163
    def chmod_symlink(self, pathname, mode):
 
164
        '''Like os.lchmod, for symlinks only.
 
165
 
 
166
        This may fail if the pathname is not a symlink (but it may
 
167
        not).  If the target is a symlink, but the platform (e.g.,
 
168
        Linux) does not allow setting the permissions of a symlink,
 
169
        the method will silently do nothing.
 
170
 
 
171
        '''
 
172
 
 
173
    def chmod_not_symlink(self, pathname, mode):
 
174
        '''Like os.chmod, for non-symlinks only.
 
175
 
 
176
        This may fail if pathname is a symlink (but it may not). It
 
177
        MUST NOT be called for a symlink; use chmod_symlink instead.
 
178
 
 
179
        '''
165
180
 
166
181
    def lutimes(self, pathname, atime_sec, atime_nsec, mtime_sec, mtime_nsec):
167
182
        '''Like lutimes(2).
523
538
    def test_lstat_raises_oserror_for_nonexistent_entry(self):
524
539
        self.assertRaises(OSError, self.fs.lstat, 'notexists')
525
540
 
526
 
    def test_chmod_sets_permissions_correctly(self):
 
541
    def test_chmod_not_symlink_sets_permissions_correctly(self):
527
542
        self.fs.mkdir('foo')
528
 
        self.fs.chmod('foo', 0777)
 
543
        self.fs.chmod_not_symlink('foo', 0777)
529
544
        self.assertEqual(self.fs.lstat('foo').st_mode & 0777, 0777)
530
545
 
531
 
    def test_chmod_raises_oserror_for_nonexistent_entry(self):
532
 
        self.assertRaises(OSError, self.fs.chmod, 'notexists', 0)
 
546
    def test_chmod_not_symlink_raises_oserror_for_nonexistent_entry(self):
 
547
        self.assertRaises(OSError, self.fs.chmod_not_symlink, 'notexists', 0)
 
548
 
 
549
    def test_chmod_symlink_raises_oserror_for_nonexistent_entry(self):
 
550
        self.assertRaises(OSError, self.fs.chmod_symlink, 'notexists', 0)
533
551
 
534
552
    def test_lutimes_sets_times_correctly(self):
535
553
        self.fs.mkdir('foo')