VirtualBox

Ignore:
Timestamp:
Dec 20, 2021 6:38:09 PM (3 years ago)
Author:
vboxsync
Message:

vsheriff: python 3 adjustments, properly handling the iterable stuff which is different than in old python 2. bugref:9788

File:
1 edited

Legend:

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

    r90595 r93032  
    708708            atValues = dReasonForResultId.values();
    709709            fSingleReason = True;
    710             if len(dReasonForResultId) == 1 and dReasonForResultId.keys()[0] != oCaseFile.oTestSet.idTestResult:
    711                 self.dprint(u'Promoting single reason to whole set: %s' % (atValues[0],));
    712             elif len(dReasonForResultId) > 1 and len(atValues) == atValues.count(atValues[0]):
    713                 self.dprint(u'Merged %d reasons to a single one: %s' % (len(atValues), atValues[0]));
     710            if len(dReasonForResultId) == 1 and next(iter(dReasonForResultId.keys())) != oCaseFile.oTestSet.idTestResult:
     711                self.dprint(u'Promoting single reason to whole set: %s' % (next(iter(atValues)),));
     712            elif len(dReasonForResultId) > 1 and len(atValues) == list(atValues).count(next(iter(atValues))):
     713                self.dprint(u'Merged %d reasons to a single one: %s' % (len(atValues), next(iter(atValues))));
    714714            else:
    715715                fSingleReason = False;
    716716            if fSingleReason:
    717                 dReasonForResultId = { oCaseFile.oTestSet.idTestResult: atValues[0], };
     717                dReasonForResultId = { oCaseFile.oTestSet.idTestResult: next(iter(atValues)), };
    718718                if dCommentForResultId:
    719                     dCommentForResultId = { oCaseFile.oTestSet.idTestResult: dCommentForResultId.values()[0], };
     719                    dCommentForResultId = { oCaseFile.oTestSet.idTestResult: next(iter(dCommentForResultId.values())), };
    720720        elif oCaseFile.tReason is not None:
    721721            dReasonForResultId = { oCaseFile.oTestSet.idTestResult: oCaseFile.tReason, };
     
    725725
    726726        self.vprint(u'Closing %s with following reason%s: %s'
    727                     % ( oCaseFile.sName, 's' if dReasonForResultId > 0 else '', dReasonForResultId, ));
     727                    % ( oCaseFile.sName, 's' if len(dReasonForResultId) > 1 else '', dReasonForResultId, ));
    728728
    729729        #
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