Exemplo n.º 1
0
def running(*args):
    from libs.objop import StrOperation
    ui = UIDriver()

    if len(args) == 1:
        args = StrOperation.splitStr(args[0], " ", '"')
    ui.setRunnerByArgs(True, args)
    ui.launch()
Exemplo n.º 2
0
 def __replaceArgStr(self, argStr, argRplace):
     try:
         argIndex = 0
         for arg in StrOperation.splitStr(argRplace, ",", "'"):
             argStr = argStr.replace("{%s}" % argIndex, arg)
             argIndex += 1
     except:
         pass
     return argStr
Exemplo n.º 3
0
def running(*args):
    from libs.objop import StrOperation
    import sys

    if len(args) == 0:
        args = ("-t", sys.argv[0])
    elif len(args) == 1:
        args = ["-t", sys.argv[0]] + StrOperation.splitStr(args[0], " ", '"')
    _sc.setRunnerByArgs(True, args)
    _sc.launch()
Exemplo n.º 4
0
def servering(*args):
    from libs.objop import StrOperation
    import sys

    if len(args) == 0:
        args = ("-t", sys.argv[0])
    elif len(args) == 1:
        args = ["-t", sys.argv[0]] + StrOperation.splitStr(args[0], " ", '"')
    sdriver.setDriverByArgs(args)
    sdriver.startService()
Exemplo n.º 5
0
def testing(*args):
    from tmodel.runner.launcher import TestLoader
    import sys
    
    if len(args) == 0:
        args = ("-f", sys.argv[0])
    elif len(args) == 1:
        from libs.objop import StrOperation
        args = ["-f", sys.argv[0]] + list(StrOperation.splitStr(args[0], " ", '"'))
    tcode = TestLoader(driver, list(args)).launch()
    sys.exit(0 if tcode is None else tcode)
Exemplo n.º 6
0
def servering(*args):
    import sys
    if sys.getdefaultencoding() != "utf-8":
        reload(sys)
        eval('sys.setdefaultencoding("utf-8")')
    from libs.objop import StrOperation
    
    if len(args) == 0:
        args = ("-t", sys.argv[0])
    elif len(args) == 1:
        args = ["-t", sys.argv[0]] + StrOperation.splitStr(args[0], " ", '"')
    sdriver.setDriverByArgs(args)
    sdriver.startService()
Exemplo n.º 7
0
 def fromIniStr(self, iniConfig, isInit=False):
     for keyValLine in iniConfig.split("\n"):
         try:
             kvs = StrOperation.splitStr(keyValLine, True)
             name, value = kvs[0], kvs[1]
             if isInit:
                 self.InitDict(name, None, value)
             elif value != "" and name[0] != "#":
                 self.SetDict(name, value)
         except:
             keyValLine = keyValLine.strip()
             if self.propOrder != None and not self.propOrder.__contains__(
                     keyValLine):
                 self.propOrder.append(keyValLine)
Exemplo n.º 8
0
def testing(*args):
    import sys
    if sys.getdefaultencoding() != "utf-8":
        reload(sys)
        eval('sys.setdefaultencoding("utf-8")')

    from tmodel.runner.launcher import TestLoader
    if len(args) == 0:
        args = ("-f", sys.argv[0])
    elif len(args) == 1:
        from libs.objop import StrOperation
        args = list(StrOperation.splitStr(args[0], " ",
                                          '"')) + ["-f", sys.argv[0]]

    tcode = TestLoader(driver, list(args)).launch()
    sys.exit(0 if tcode is None else tcode)
Exemplo n.º 9
0
    def __executeSql__(self, operation="show", fields="*", table="db", dbName="",
            where="1=1", whereArgs="", affectRows=100, dbConfig="local"):
        if Sql.isEmpty(dbConfig):
            return "no db config"
        if Sql.isEmpty(dbName):dbName = None

        if Sql.isEmpty(affectRows):
            affectRows = 100
        affectRows, operationType = int(affectRows), operation[0:10].lower().strip()

        try:
            argIndex = 0
            for arg in StrOperation.splitStr(whereArgs, ",", "'"):
                where = where.replace("{%s}" % argIndex, arg)
                argIndex += 1
        except Exception as ex:
            return ("%s" % ex)

        conn = self.__getConn(dbConfig)

        if operationType == "select":
            query = "select %s from %s.%s where %s limit %s" % (fields, dbName, table, where, affectRows)
            return conn.executeSql(query, True, dbName=dbName)
        elif operationType == "update":
            if self.isCheckUpdate:
                query = "select count(1) as affectRows from %s.%s where %s " % (dbName, table, where)
                actAffectRows = conn.executeSql(query, True, dbName=dbName)[0]['affectRows']
            else:
                actAffectRows = affectRows
            if actAffectRows == affectRows:
                update = "update %s.%s set %s where %s limit %s" % (dbName, table, fields, where, affectRows)
                return conn.executeSql(update, isSelect=False, isCommit=True, dbName=dbName)
            else:
                return "Actual %s != Expect %s" % (actAffectRows, affectRows)
        elif self.isSupportDelete and operationType == "delete":
            delete = "delete from %s.%s where %s limit %s" % (dbName, table, where, affectRows)
            return conn.executeSql(delete, isSelect=False, isCommit=True, dbName=dbName)
        elif operationType == "show":
            if Sql.isEmpty(dbName):
                return conn.executeSql("show databases", dbName=dbName)
            else:
                return conn.executeSql("show tables", dbName=dbName)
        elif self.isSupportAnySql:
            return conn.executeSql(operation, dbName=dbName)
        else:
            return "Bad operation %s" % operation