IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 15, 2010, 2:51:13 PM (16 years ago)
Author:
Serge CHASTEL
Message:

Test report now in xml

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/sc_branches/psps_testing/testers/fits/p2.py

    r29228 r29438  
    4949        True
    5050        """
    51         PsPsLogger.info('Testing P2FitsTester object')
    52         # 1. There is no image for the PrimaryHDU (at 0)
    53         PsPsLogger.debug('  Testing P2FitsTester object: primary')
    54         product = self.test_primary()
    55         if not product.success:
    56             return product
    57         # 2. Look at the FrameMeta information
    58         PsPsLogger.debug('  Testing P2FitsTester object: frameMeta')
    59         product = self.test_frame_meta(be_tolerant_for_types)
    60         # Fail if there is any failure and we are type-strict
    61         if not product.success and not be_tolerant_for_types:
    62             return product
    63         # 3. There should be 'product.nOTA' sequences of [ImageMeta,
    64         # Detection, SkinnyObject, ObjectCalColor] frames
    65         frameID = product.frameID
    66         nOTA = product.nOTA
    67         if len(self.fits) != 4*nOTA + 2:
    68             TestReport.ko('Invalid number of OTA: from FITS file: %d / from FrameMeta %d'
    69                           % (len(self.fits)-2/4, nOTA),
     51        try:
     52            PsPsLogger.info('Testing P2FitsTester object')
     53            # 1. There is no image for the PrimaryHDU (at 0)
     54            PsPsLogger.debug('  Testing P2FitsTester object: primary')
     55            product = self.test_primary()
     56            if not product.success:
     57                return product
     58            # 2. Look at the FrameMeta information
     59            PsPsLogger.debug('  Testing P2FitsTester object: frameMeta')
     60            product = self.test_frame_meta(be_tolerant_for_types)
     61            # Fail if there is any failure and we are type-strict
     62            if not product.success and not be_tolerant_for_types:
     63                return product
     64            # 3. There should be 'product.nOTA' sequences of [ImageMeta,
     65            # Detection, SkinnyObject, ObjectCalColor] frames
     66            frameID = product.frameID
     67            nOTA = product.nOTA
     68            if len(self.fits) != 4*nOTA + 2:
     69                TestReport.ko('Invalid number of OTA: from FITS file: %d / from FrameMeta %d'
     70                              % (len(self.fits)-2/4, nOTA),
     71                              {'requirement': 'TBD'})
     72                return TestProduct()
     73            for ota_index in range(nOTA):
     74                PsPsLogger.debug('  Testing P2FitsTester object: OTA (%d/%d)'
     75                                 % ((ota_index+1), nOTA))
     76                subproduct = self.test_detections_frames(frameID, ota_index,
     77                                                         be_tolerant_for_types)
     78                if subproduct.success:
     79                    TestReport.ok(requirement)
     80                product.success = product.success and subproduct.success
     81            return product
     82        except KeyError, e:
     83            PsPsLogger.error('  Exception caught!')
     84            TestReport.ko('Unexpected exception',
    7085                          {'requirement': 'TBD'})
     86            TestReport.info(e)
    7187            return TestProduct()
    72         for ota_index in range(nOTA):
    73             PsPsLogger.debug('  Testing P2FitsTester object: OTA (%d/%d)'
    74                                % ((ota_index+1), nOTA))
    75             subproduct = self.test_detections_frames(frameID, ota_index,
    76                                                      be_tolerant_for_types)
    77             if subproduct.success:
    78                 TestReport.ok(requirement)
    79             product.success = product.success and subproduct.success
    80         return product
     88           
    8189
    8290    #####################################################
     
    9199        fits_index = 4*ota_index+2
    92100        product = TestProduct()
    93         TestReport.title('Data frames tests')
     101        TestReport.addSection('Data frames tests')
    94102        if self.fits[fits_index].name != 'IMAGEMETA':
    95103            TestReport.ko(requirement,
     
    115123        query = 'SELECT * FROM ImageMeta WHERE imageID = %s' % str(imageID)
    116124        answer = self.psi_inquisitor.query(query)
    117         TestReport.title('ImageMeta values tests (frame %d - %s)'
    118                          % (ota_index, query))
     125        TestReport.addSection('ImageMeta values tests (frame %d - %s)'
     126                              % (ota_index, query))
    119127        subproduct = match(self.fits[fits_index].data, answer, requirement,
    120128                           tolerance = Configuration.TOLERANCE,
     
    158166        """
    159167        Tests the contents of the FrameMeta table.
    160         - 48 columns x 1 row
    161         - This table contains values that are useful, namely: frameID,
    162           nOTA (number of OTA).
    163         - The data can be found in PSI using the query:
     168          - 48 columns x 1 row
     169          - This table contains values that are useful, namely: frameID,
     170            nOTA (number of OTA).
     171          - The data can be found in PSI using the query:
    164172                   SELECT * FROM FrameMeta WHERE frameID = <frameID>;
    165173        """
    166174        requirement = 'PSDC-940-006-01, 3.6.6.8: '
    167175        product = TestProduct()
    168         TestReport.title('MetaFrame tests')
     176        TestReport.addSection('MetaFrame tests')
    169177        if self.fits[1].header['NAXIS'] != 2:
    170178            TestReport.ko(requirement, 'NAXIS != 2')
     
    196204        Check that the primary header i.e. fits[0] has no dimension.
    197205        """
    198         TestReport.title('Primary frame tests')
     206        TestReport.addSection('Primary frame tests')
    199207        requirement = 'PSDC-940-006-01, 3.6.3, 1'
    200208        product = TestProduct()
Note: See TracChangeset for help on using the changeset viewer.