示例#1
0
    def testStale(self):
        # is a file with mtime older than max_staleness considered stale?

        self.makefile(self.fname, "foo")
        uid1 = filesys.fuid(self.fname)

        time.sleep(2)  # thanks for waiting :)
        uid2 = filesys.fuid(self.fname, max_staleness=1)
        assert uid2 != uid1  # should be considered stale if platform has no inode support
示例#2
0
    def testUpdateFileInPlace(self):
        # update file in place, changing size and maybe mtime
        self.makefile(self.fname, "foo")
        uid1 = filesys.fuid(self.fname)

        self.makefile(self.fname, "foofoo")
        uid2 = filesys.fuid(self.fname)

        assert uid2 != uid1  # we changed size and maybe mtime
示例#3
0
    def testUpdateFileMovingFromTemp(self):
        # update file by moving another file over it
        # changing inode, maybe mtime, but not size

        self.makefile(self.fname, "foo")
        uid1 = filesys.fuid(self.fname)

        self.makefile(self.tmpname, "bar")
        os.rename(self.tmpname, self.fname)
        uid2 = filesys.fuid(self.fname)

        assert uid2 != uid1  # we didn't change size, but inode and maybe mtime
示例#4
0
    def testNewFile(self):
        # freshly created file
        self.makefile(self.fname, "foo")
        uid1 = filesys.fuid(self.fname)

        assert uid1 is not None  # None would mean some failure in fuid()
示例#5
0
    def testNoFile(self):
        # no file created
        uid = filesys.fuid(self.fname)

        assert uid is None  # there is no file yet, fuid will fail internally and return None