VirtualBox

Ignore:
Timestamp:
Mar 8, 2022 2:57:25 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
150378
Message:

testmanager: pylint 2.9.6 adjustments (mostly about using sub-optimal looping and 'with' statements).

Location:
trunk/src/VBox/ValidationKit/testmanager/batch
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testmanager/batch/filearchiver.py

    r93115 r94129  
    123123
    124124                    utils.noxcptDeleteFile(sZipFileNm + '.tmp');
    125                     oZipFile = zipfile.ZipFile(sZipFileNm + '.tmp', 'w', zipfile.ZIP_DEFLATED, allowZip64 = True);
    126 
    127                     for sFile in asFiles:
    128                         sSuff = os.path.splitext(sFile)[1];
    129                         if sSuff in [ '.png', '.webm', '.gz', '.bz2', '.zip', '.mov', '.avi', '.mpg', '.gif', '.jpg' ]:
    130                             ## @todo Consider storing these files outside the zip if they are a little largish.
    131                             self.dprint('TestSet %d: Storing   %s...' % (idTestSet, sFile));
    132                             oZipFile.write(sSrcFileBase + sFile, sFile, zipfile.ZIP_STORED);
    133                         else:
    134                             self.dprint('TestSet %d: Deflating %s...' % (idTestSet, sFile));
    135                             oZipFile.write(sSrcFileBase + sFile, sFile, zipfile.ZIP_DEFLATED);
    136 
    137                     oZipFile.close();
     125                    with zipfile.ZipFile(sZipFileNm + '.tmp', 'w', zipfile.ZIP_DEFLATED, allowZip64 = True) as oZipFile:
     126                        for sFile in asFiles:
     127                            sSuff = os.path.splitext(sFile)[1];
     128                            if sSuff in [ '.png', '.webm', '.gz', '.bz2', '.zip', '.mov', '.avi', '.mpg', '.gif', '.jpg' ]:
     129                                ## @todo Consider storing these files outside the zip if they are a little largish.
     130                                self.dprint('TestSet %d: Storing   %s...' % (idTestSet, sFile));
     131                                oZipFile.write(sSrcFileBase + sFile, sFile, zipfile.ZIP_STORED);
     132                            else:
     133                                self.dprint('TestSet %d: Deflating %s...' % (idTestSet, sFile));
     134                                oZipFile.write(sSrcFileBase + sFile, sFile, zipfile.ZIP_DEFLATED);
    138135
    139136                    #
     
    216213        #
    217214        fRc = True;
    218         for idTestSet in dTestSets:
     215        for idTestSet, oTestSet in dTestSets.items():
    219216            try:
    220                 if self._processTestSet(idTestSet, dTestSets[idTestSet], sCurDir) is not True:
     217                if self._processTestSet(idTestSet, oTestSet, sCurDir) is not True:
    221218                    fRc = False;
    222219            except:
  • trunk/src/VBox/ValidationKit/testmanager/batch/vcs_import.py

    r93115 r94129  
    4343
    4444# Test Manager imports
    45 from testmanager.config                 import g_kaBugTrackers;
     45from testmanager.config                 import g_kdBugTrackers;
    4646from testmanager.core.db                import TMDatabaseConnection;
    4747from testmanager.core.vcsrevisions      import VcsRevisionData, VcsRevisionLogic;
     
    158158
    159159            # Analyze the raw message looking for bug tracker references.
    160             for sBugTrackerKey in g_kaBugTrackers:
    161                 oBugTracker = g_kaBugTrackers[sBugTrackerKey];
     160            for oBugTracker in g_kdBugTrackers.values():
    162161                for sTag in oBugTracker.asCommitTags:
    163162                    off = sRawMsg.find(sTag);
  • trunk/src/VBox/ValidationKit/testmanager/batch/virtual_test_sheriff.py

    r93874 r94129  
    340340
    341341        if self.oConfig.sLogFile:
    342             self.oLogFile = open(self.oConfig.sLogFile, "a");
     342            self.oLogFile = open(self.oConfig.sLogFile, "a");   # pylint: disable=consider-using-with
    343343            self.oLogFile.write('VirtualTestSheriff: $Revision$ \n');
    344344
     
    518518                        ## @todo maybe check the elapsed time here, it could still be a bad run?
    519519                        cOkay += 1;
    520                         if iFirstOkay > iSet:
    521                             iFirstOkay = iSet;
     520                        iFirstOkay = min(iFirstOkay, iSet);
    522521                if iSet > 10:
    523522                    break;
     
    10301029            #
    10311030            cHits = 0;
    1032             for iCpu in dStacks:
    1033                 asBacktrace = dStacks[iCpu];
     1031            for asBacktrace in dStacks.values():
    10341032                for iFrame in xrange(min(3, len(asBacktrace))):
    10351033                    if asBacktrace[iFrame].find('kvm_lock_spinning') >= 0:
Note: See TracChangeset for help on using the changeset viewer.

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