本文整理汇总了Python中awscli.customizations.s3.filegenerator.FileGenerator.triggers_warning方法的典型用法代码示例。如果您正苦于以下问题:Python FileGenerator.triggers_warning方法的具体用法?Python FileGenerator.triggers_warning怎么用?Python FileGenerator.triggers_warning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类awscli.customizations.s3.filegenerator.FileGenerator
的用法示例。
在下文中一共展示了FileGenerator.triggers_warning方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_no_warning
# 需要导入模块: from awscli.customizations.s3.filegenerator import FileGenerator [as 别名]
# 或者: from awscli.customizations.s3.filegenerator.FileGenerator import triggers_warning [as 别名]
def test_no_warning(self):
file_gen = FileGenerator(self.service, self.endpoint, '', False)
self.files.create_file("foo.txt", contents="foo")
full_path = os.path.join(self.root, "foo.txt")
return_val = file_gen.triggers_warning(full_path)
self.assertFalse(return_val)
self.assertTrue(file_gen.result_queue.empty())
示例2: test_no_exists
# 需要导入模块: from awscli.customizations.s3.filegenerator import FileGenerator [as 别名]
# 或者: from awscli.customizations.s3.filegenerator.FileGenerator import triggers_warning [as 别名]
def test_no_exists(self):
file_gen = FileGenerator(self.service, self.endpoint, '', False)
filename = os.path.join(self.root, 'file')
return_val = file_gen.triggers_warning(filename)
self.assertTrue(return_val)
warning_message = file_gen.result_queue.get()
self.assertEqual(warning_message.message,
("warning: Skipping file %s. File does not exist." %
filename))
示例3: test_is_special_file_warning
# 需要导入模块: from awscli.customizations.s3.filegenerator import FileGenerator [as 别名]
# 或者: from awscli.customizations.s3.filegenerator.FileGenerator import triggers_warning [as 别名]
def test_is_special_file_warning(self):
file_gen = FileGenerator(self.service, self.endpoint, '', False)
file_path = os.path.join(self.files.rootdir, 'foo')
# Use socket for special file.
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
sock.bind(file_path)
return_val = file_gen.triggers_warning(file_path)
self.assertTrue(return_val)
warning_message = file_gen.result_queue.get()
self.assertEqual(warning_message.message,
("warning: Skipping file %s. File is character "
"special device, block special device, FIFO, or "
"socket." % file_path))
示例4: test_no_read_access
# 需要导入模块: from awscli.customizations.s3.filegenerator import FileGenerator [as 别名]
# 或者: from awscli.customizations.s3.filegenerator.FileGenerator import triggers_warning [as 别名]
def test_no_read_access(self):
file_gen = FileGenerator(self.service, self.endpoint, '', False)
self.files.create_file("foo.txt", contents="foo")
full_path = os.path.join(self.root, "foo.txt")
open_function = 'awscli.customizations.s3.filegenerator._open'
with mock.patch(open_function) as mock_class:
mock_class.side_effect = OSError()
return_val = file_gen.triggers_warning(full_path)
self.assertTrue(return_val)
warning_message = file_gen.result_queue.get()
self.assertEqual(warning_message.message,
("warning: Skipping file %s. File/Directory is "
"not readable." % full_path))