本文整理汇总了Python中checks.datadog.Dogstreams._get_dogstream_log_paths方法的典型用法代码示例。如果您正苦于以下问题:Python Dogstreams._get_dogstream_log_paths方法的具体用法?Python Dogstreams._get_dogstream_log_paths怎么用?Python Dogstreams._get_dogstream_log_paths使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类checks.datadog.Dogstreams
的用法示例。
在下文中一共展示了Dogstreams._get_dogstream_log_paths方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_dogstream_log_path_globbing
# 需要导入模块: from checks.datadog import Dogstreams [as 别名]
# 或者: from checks.datadog.Dogstreams import _get_dogstream_log_paths [as 别名]
def test_dogstream_log_path_globbing(self):
"""Make sure that globbed dogstream logfile matching works."""
# Create a tmpfile to serve as a prefix for the other temporary
# files we'll be globbing.
first_tmpfile = NamedTemporaryFile()
tmp_fprefix = os.path.basename(first_tmpfile.name)
all_tmp_filenames = set([first_tmpfile.name])
# We stick the file objects in here to avoid garbage collection (and
# tmpfile deletion). Not sure why this was happening, but it's working
# with this hack in.
avoid_gc = []
for i in range(3):
new_tmpfile = NamedTemporaryFile(prefix=tmp_fprefix)
all_tmp_filenames.add(new_tmpfile.name)
avoid_gc.append(new_tmpfile)
dogstream_glob = os.path.join(gettempdir(), tmp_fprefix + '*')
paths = Dogstreams._get_dogstream_log_paths(dogstream_glob)
self.assertEqual(set(paths), all_tmp_filenames)