コード例 #1
0
ファイル: models.py プロジェクト: dalinhuang/demodemo
 def build_index(self):
     from trac import client_settings, DIFF_SETTING
     project = self.parent()
     oldIndex = TestBuildIndex.all().ancestor(project).filter("build =", self)
     for e in oldIndex: e.delete()
     
     settings = client_settings(None, project, DIFF_SETTING)
     
     items = []
     for f in settings.settings:
         if not hasattr(self, f):continue
         items.append("%s:%s" % (f, getattr(self, f)))
     
     from utils import md5
     logging.debug("start build index for build '%s' in '%s'" % (self.build_name, project.name))
     #indexes = self.__full_combine(items)
     for i in self.__full_combine(items):
         logging.debug("index:%s" % i)
         TestBuildIndex(parent=project, build=self, 
                        index=md5(i),
                        create_date=self.create_date).put()
         
     logging.debug("done to build index.")
コード例 #2
0
ファイル: reportViews.py プロジェクト: dalinhuang/demodemo
def diff(r, build="", ajax='no'):
    """
    diff with history build:
    2. robot build
    2. base line
        
    1. sut name
       sut version
    3. sut release
    4. execute by
    
    last  cur
    PASS/FAIL->unknown  ---> unknown --> white
    
    FAIL->PASS  ---> info --> blue
    FAIL->FAIL  ---> warning --> yellow
    PASS->FAIL  ---> fatal--> red
    PASS->PASS  ---> ignore --> dark
        
    """

    build = db.get(db.Key(build))
    if build is None: return ("redirect:/rf_trac/index", )
    
    settings = client_settings(r, build.parent(), DIFF_SETTING)
    if r.REQUEST.has_key('submit'): 
        settings.set_value(r.REQUEST, all='Y')
    else:
        settings.set_value({})
        
    diff_result = diff_test_build(build, settings)
    
    s = project_settings(r, build.parent(), CATEGORY_SETTING)
    
    category_items = []
    for e in s.category.splitlines():
        if not e or e.startswith("#"): continue
        k, v = e.count(":") > 0 and e.split(":", 1) or (e, e)
        category_items.append("<option value='%s'>%s</option>" % (k, v))
    
    count = 0
    diff_form = ""   
    diff_setting = settings
    for e in diff_setting.items_order:
        check = diff_setting.value(e) == '1' and "checked" or ""
        help = diff_setting.help(e)
        diff_form += """<input id='%s' type='checkbox' name='%s' %s value='1'>
        <label for="%s">%s</label>&nbsp;&nbsp;""" % (e, e, check, e, help)
        count += 1
        #if count % 4 == 0: diff_form += "<br/>"        
    
    log_list = RobotResult.all().filter("build =", build)
    
    log_list = [e for e in log_list]
    for e in log_list:
        e.diff = diff_result[e.uuid]
    
    return ("report/rf_trac_report_build.html", {"build":build,
                                      "log_list": log_list,
                                      "category_list":"".join(category_items),
                                      "diff_form": diff_form,
                                     });