def test_chmod(self): try: fo = FileObject("test", temporary=True) fo.chmod(0o644) if oct(os.stat(fo.path).st_mode & 0o777) != oct(0o644): raise Exception("Wrong mode of file") except Exception as exc: traceback.print_exc() self.fail(exc)