当前位置: 首页>>代码示例>>Python>>正文


Python FileCheckin.get_checkin_type方法代码示例

本文整理汇总了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()
开发者ID:mincau,项目名称:TACTIC,代码行数:94,代码来源:checkin_test.py


注:本文中的pyasm.checkin.FileCheckin.get_checkin_type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。