コード例 #1
0
ファイル: tests.py プロジェクト: dahool/vertaal
    def runTest(self):
        man = Manager(self.project,
                      self.release,
                      self.component,
                      self.language,
                      self.log)

        """ perform checkout """
        # perform build
        rev = man.build()

        # check if the file was added
        pofiles = POFile.objects.filter(component=self.component,
                                  release=self.release,
                                  language=self.language)
        
        # the repo should contain one file only
        self.assertEquals(pofiles.count(),1)
        
        """ perform commit """
        # modify the file
        f = open(pofiles[0].file,"a")
        f.write("test")
        f.close()
        
        # perform commit
        revc = man.commit(None, None, "test")
        self.assertEquals(revc, (rev + 1))
        
        # POT creation
        potman = POTUpdater(self.project, self.release, self.component,self.log)        
        potman.build()
        
        potfiles = POTFile.objects.filter(component=self.component)
        
        self.assertEquals(potfiles.count(),1)
        self.assertEquals(potfiles[0].total,5) # 5 messages
        self.assertEquals(potfiles[0].updated,'2009-09-21 09:47+0200')
コード例 #2
0
ファイル: views.py プロジェクト: dahool/vertaal
            if canbuild:
                locks.append(b)
                for team in project.teams.all():
                    
                    if (POFile.objects.filter(release=release,
                                          component=component,
                                          language=team.language).count()) == 0:
                        logger.debug("New language %s" % team.language)
                        new_team = True
                    else:
                        logger.debug("Rebuild language %s" % team.language)
                        new_team = False
                    
                    repo = Manager(project, release, component, team.language, logfile)
                    try:
                        b.setrev(repo.build())
#                        send_pm(user, subject=_('Build of %(component)s on release %(release)s for team %(team)s completed.')
#                                        % {'component': component.name,
#                                           'release': release.name,
#                                           'team': team.language.name})
                    except lock.LockException, l:
                        repo.notify_callback(l)
                        logger.error(l)
                        send_pm(user, _("Project locked"), message=_('Project locked for %(team)s. Try again in a few minutes. If the problem persist contact the administrator.') % {
                                            'team': team.language.name})
                    except Exception, e:
                        repo.notify_callback(e)
                        logger.error(e)
                        send_pm(user, _('Error building team %(team)s.') % {'team': team.language.name}, _('Reason: %(error)s') % {'error': e.args} )
                    finally:
                        del repo