VirtualBox

Ignore:
Timestamp:
May 27, 2016 1:16:02 AM (9 years ago)
Author:
vboxsync
Message:

testmanager: failiure reason fixes, some exception throwing cleanups, delinting with pylint 1.5.5.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testmanager/core/build.py

    r56295 r61220  
    3737from testmanager                        import config;
    3838from testmanager.core                   import coreconsts;
    39 from testmanager.core.base              import ModelDataBase, ModelDataBaseTestCase, ModelLogicBase, TMExceptionBase;
     39from testmanager.core.base              import ModelDataBase, ModelDataBaseTestCase, ModelLogicBase, TMExceptionBase, \
     40                                               TMTooManyRows, TMInvalidData, TMRowNotFound, TMRowInUse;
    4041
    4142
     
    7677        """
    7778        if aoRow is None:
    78             raise TMExceptionBase('BuildCategory not found.');
     79            raise TMRowNotFound('BuildCategory not found.');
    7980
    8081        self.idBuildCategory     = aoRow[0];
     
    9495        aoRow = oDb.fetchOne()
    9596        if aoRow is None:
    96             raise TMExceptionBase('idBuildCategory=%s not found' % (idBuildCategory, ));
     97            raise TMRowNotFound('idBuildCategory=%s not found' % (idBuildCategory, ));
    9798        return self.initFromDbRow(aoRow);
    9899
     
    220221        cBuilds = self._oDb.fetchOne()[0];
    221222        if cBuilds > 0:
    222             raise TMExceptionBase('Build category #%d is used by %d builds and can therefore not be deleted.'
    223                                   % (idBuildCategory, cBuilds,));
     223            raise TMRowInUse('Build category #%d is used by %d builds and can therefore not be deleted.'
     224                             % (idBuildCategory, cBuilds,));
    224225
    225226        #
     
    294295
    295296        # Check BuildCategoryData before do anything
    296         dDataErrors = oData.validateAndConvert(self._oDb);
     297        dDataErrors = oData.validateAndConvert(self._oDb, oData.ksValidateFor_Add);
    297298        if len(dDataErrors) > 0:
    298             raise TMExceptionBase('Invalid data passed to addBuildCategory(): %s' % (dDataErrors,));
     299            raise TMInvalidData('Invalid data passed to addBuildCategory(): %s' % (dDataErrors,));
    299300
    300301        # Does it already exist?
     
    363364        """
    364365        if aoRow is None:
    365             raise TMExceptionBase('Build not found.');
     366            raise TMRowNotFound('Build not found.');
    366367
    367368        self.idBuild            = aoRow[0];
     
    389390        aoRow = oDb.fetchOne()
    390391        if aoRow is None:
    391             raise TMExceptionBase('idBuild=%s not found (tsNow=%s sPeriodBack=%s)' % (idBuild, tsNow, sPeriodBack,));
     392            raise TMRowNotFound('idBuild=%s not found (tsNow=%s sPeriodBack=%s)' % (idBuild, tsNow, sPeriodBack,));
    392393        return self.initFromDbRow(aoRow);
    393394
     
    443444        """
    444445        if aoRow is None:
    445             raise TMExceptionBase('Build not found.');
     446            raise TMRowNotFound('Build not found.');
    446447        BuildData.initFromDbRow(self, aoRow);
    447448        self.oCat = BuildCategoryData().initFromDbRow(aoRow[11:]);
     
    461462        aoRow = oDb.fetchOne()
    462463        if aoRow is None:
    463             raise TMExceptionBase('idBuild=%s not found (tsNow=%s sPeriodBack=%s)' % (idBuild, tsNow, sPeriodBack,));
     464            raise TMRowNotFound('idBuild=%s not found (tsNow=%s sPeriodBack=%s)' % (idBuild, tsNow, sPeriodBack,));
    464465        return self.initFromDbRow(aoRow);
    465466
     
    556557        # Validate input and get current data.
    557558        #
    558         dErrors = oData.validateAndConvert(self._oDb);
     559        dErrors = oData.validateAndConvert(self._oDb, oData.ksValidateFor_Edit);
    559560        if len(dErrors) > 0:
    560             raise TMExceptionBase('editEntry invalid input: %s' % (dErrors,));
     561            raise TMInvalidData('editEntry invalid input: %s' % (dErrors,));
    561562        oOldData = BuildData().initFromDbWithId(self._oDb, oData.idBuild);
    562563
     
    714715        aRows = self._oDb.fetchAll()
    715716        if len(aRows) not in (0, 1):
    716             raise TMExceptionBase('Found more than one build with the same credentials. Database structure is corrupted.')
     717            raise TMTooManyRows('Found more than one build with the same credentials. Database structure is corrupted.')
    717718        try:
    718719            return BuildDataEx().initFromDbRow(aRows[0])
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette