本文整理汇总了Python中pyasm.checkin.FileCheckin.get_checkin_type方法的典型用法代码示例。如果您正苦于以下问题:Python FileCheckin.get_checkin_type方法的具体用法?Python FileCheckin.get_checkin_type怎么用?Python FileCheckin.get_checkin_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.checkin.FileCheckin
的用法示例。
在下文中一共展示了FileCheckin.get_checkin_type方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _test_with_naming
# 需要导入模块: from pyasm.checkin import FileCheckin [as 别名]
# 或者: from pyasm.checkin.FileCheckin import get_checkin_type [as 别名]
def _test_with_naming(self):
server = Config.get_value("install", "server")
process = "process"
person_code = self.person.get_code()
filename = "filename.jpg"
process = "naming"
subdirs = ['']
# create a naming
naming = SearchType.create("config/naming")
naming.set_value("search_type", "unittest/person")
naming.set_value("context", "naming/*")
naming.set_value("file_naming", "TEST{basefile}_v{version}.{ext}")
naming.commit()
# create 2nd naming where
naming = SearchType.create("config/naming")
naming.set_value("search_type", "unittest/person")
naming.set_value("context", "naming/empty_dir_test")
naming.set_value("file_naming", "TEST{basefile}_v{version}.{ext}")
naming.set_value("dir_naming", "{@GET(.description)}")
naming.commit()
# create 3rd latest_versionless naming where
naming = SearchType.create("config/naming")
naming.set_value("search_type", "unittest/person")
naming.set_value("context", "strict/low")
naming.set_value("file_naming", "{basefile}_latest.{ext}")
naming.set_value("dir_naming", "{@GET(.description)}")
naming.set_value("latest_versionless", "1")
naming.commit()
# create 4th current_versionless naming where
naming = SearchType.create("config/naming")
naming.set_value("search_type", "unittest/person")
naming.set_value("context", "strict/hi")
naming.set_value("file_naming", "{basefile}_current.{ext}")
naming.set_value("dir_naming", "{@GET(.description)}")
naming.set_value("current_versionless", "1")
naming.commit()
self.clear_naming()
for i, subdir in enumerate(subdirs):
if subdir:
context = "%s/%s/%s" % (process, subdir, filename)
else:
context = "%s/%s" % (process, filename)
# create a new test.txt file
file_path = "./%s" % filename
file = open(file_path, 'w')
file.write("test")
file.close()
#checkin = FileCheckin(self.person, file_path, context=context, checkin_type='auto')
#checkin = FileCheckin(self.person, file_path, context=context, checkin_type='strict')
checkin = FileCheckin(self.person, file_path, context=context)
checkin.execute()
# ensure that the check-in type is strict
checkin_type = checkin.get_checkin_type()
self.assertEquals("strict", checkin_type)
snapshot = checkin.get_snapshot()
checked_context = snapshot.get_value("context")
path = snapshot.get_path_by_type("main")
basename = os.path.basename(path)
expected = "TESTfilename_v001.jpg"
self.assertEquals(expected, basename)
# create a new test.txt file
file_path = "./%s" % filename
file = open(file_path, 'w')
file.write("test2")
file.close()
checkin = FileCheckin(self.person, file_path, context='naming/empty_dir_test')
checkin.execute()