def publish(self):
     """
     Publish the results of the Testrun
     """
     try:
         for (test_package, data) in self._test_packages.items():
             
             start_time = datetime.datetime.fromtimestamp(data[0])
             duration = data[1]
             
             if duration is None:
                 continue
             
             db_package = Package.objects.filter(package_name = test_package)
             
             if db_package.count() == 0:
                 db_package = Package(package_name = test_package)
                 db_package.save()
             else:
                 db_package = db_package[0]
             
             history = History(package_id = db_package,
                               start_time = start_time,
                               duration = duration,
                               testrun_id = self._testrun_id,
                               verdict = 0)
             history.save()
         
         LOG.info("history data saved")                    
             
     except (TypeError, AttributeError, IntegrityError), error:
         LOG.error("History object creation failed: %s" % error)
    def publish(self):
        """
        Publish the results of the Testrun
        """
        try:
            for (test_package, data) in self._test_packages.items():

                start_time = datetime.datetime.fromtimestamp(data[0])
                duration = data[1]

                if duration is None:
                    continue

                db_package = Package.objects.filter(package_name=test_package)

                if db_package.count() == 0:
                    db_package = Package(package_name=test_package)
                    db_package.save()
                else:
                    db_package = db_package[0]

                history = History(package_id=db_package,
                                  start_time=start_time,
                                  duration=duration,
                                  testrun_id=self._testrun_id,
                                  verdict=0)
                history.save()

            LOG.info("history data saved")

        except (TypeError, AttributeError, IntegrityError), error:
            LOG.error("History object creation failed: %s" % error)
Exemple #3
0
def _create_test_data():

    for i in xrange(NUM_OF_TESTPACKAGES):

        db_pack = Package(package_name="test-package" + str(i) + "-tests")
        db_pack.save()

        history = History(package_id=db_pack,
                          duration=i * 60 * 60,
                          testrun_id=uuid.uuid4().hex,
                          verdict=random.randint(0, 4))
        history.save()
Exemple #4
0
def _create_test_data():

    for i in xrange(NUM_OF_TESTPACKAGES):
        
        db_pack = Package(package_name = "test-package" + str(i) + "-tests")
        db_pack.save()
            
        history = History(package_id = db_pack,
                          duration = i * 60 * 60,
                          testrun_id = uuid.uuid4().hex,
                          verdict = random.randint(0,4))
        history.save()