本文整理汇总了Python中webkitpy.common.system.filesystem.FileSystem.move方法的典型用法代码示例。如果您正苦于以下问题:Python FileSystem.move方法的具体用法?Python FileSystem.move怎么用?Python FileSystem.move使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webkitpy.common.system.filesystem.FileSystem
的用法示例。
在下文中一共展示了FileSystem.move方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_coverage_works
# 需要导入模块: from webkitpy.common.system.filesystem import FileSystem [as 别名]
# 或者: from webkitpy.common.system.filesystem.FileSystem import move [as 别名]
def test_coverage_works(self):
# This is awkward; by design, running test-webkitpy -c will
# create a .coverage file in tools, so we need to be
# careful not to clobber an existing one, and to clean up.
# FIXME: This design needs to change since it means we can't actually
# run this method itself under coverage properly.
filesystem = FileSystem()
executive = Executive()
module_path = filesystem.path_to_module(self.__module__)
script_dir = module_path[0:module_path.find('webkitpy') - 1]
coverage_file = filesystem.join(script_dir, '.coverage')
coverage_file_orig = None
if filesystem.exists(coverage_file):
coverage_file_orig = coverage_file + '.orig'
filesystem.move(coverage_file, coverage_file_orig)
try:
proc = executive.popen([sys.executable, filesystem.join(script_dir, 'test-webkitpy'), '-c', STUBS_CLASS + '.test_empty'],
stdout=executive.PIPE, stderr=executive.PIPE)
out, _ = proc.communicate()
retcode = proc.returncode
self.assertEqual(retcode, 0)
self.assertIn('Cover', out)
finally:
if coverage_file_orig:
filesystem.move(coverage_file_orig, coverage_file)
elif filesystem.exists(coverage_file):
filesystem.remove(coverage_file)