VirtualBox

Ignore:
Timestamp:
Nov 20, 2020 3:14:02 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
141441
Message:

testmanager/status.py: Fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testmanager/cgi/status.py

    r86935 r86936  
    113113        testboxes_dict = dict_update(testboxes_dict, testbox_name, test_result)
    114114
    115         if "testbox_os" not in testboxes_dict[testbox_name].keys(): ## bird: you don't need to use keys() here.
     115        if "testbox_os" not in testboxes_dict[testbox_name]:
    116116            testboxes_dict[testbox_name].update({"testbox_os": test_box_os})
    117117
    118         if "sched_group" not in testboxes_dict[testbox_name].keys():
     118        if "sched_group" not in testboxes_dict[testbox_name]:
    119119            testboxes_dict[testbox_name].update({"sched_group": test_sched_group})
    120120        elif test_sched_group not in testboxes_dict[testbox_name]["sched_group"]:
    121             testboxes_dict[testbox_name]["sched_group"] = testboxes_dict[testbox_name]["sched_group"] + ","+ test_sched_group
     121            testboxes_dict[testbox_name]["sched_group"] += "," + test_sched_group
    122122
    123123        if test_result == "running":
    124124            testboxes_dict[testbox_name].update({"hours_running": find_test_duration(test_created)})
    125125
    126     #earlier: clean_file_and_insert_data(testboxes_dict, target_file)
    127126    return testboxes_dict;
    128127
     
    137136    elif testbox_os == "solaris":
    138137        dict_update(vb_dict, test_name + " / solaris", test_result)
    139     else:
    140         dict_update(vb_dict, test_name + " / other", test_result)
    141 
     138#    else:
     139#        dict_update(vb_dict, test_name + " / other", test_result)
     140
     141
     142# const/immutable.
     143g_kdTestStatuses = {
     144    'running': 0,
     145    'success': 0,
     146    'skipped': 0,
     147    'bad-testbox': 0,
     148    'aborted': 0,
     149    'failure': 0,
     150    'timed-out': 0,
     151    'rebooted': 0,
     152}
    142153
    143154def dict_update(target_dict, key_name, test_result):
    144     def test_statuses_dict_default():
    145         test_statuses_dict = {
    146             'running': 0,
    147             'success': 0,
    148             'skipped': 0,
    149             'bad-testbox': 0,
    150             'aborted': 0,
    151             'failure': 0,
    152             'timed-out': 0,
    153             'rebooted': 0,
    154         }
    155         return test_statuses_dict
    156     if key_name not in target_dict.keys():
    157         target_dict.update({key_name: test_statuses_dict_default().copy()})
    158     if test_result in test_statuses_dict_default().keys():
     155    if key_name not in target_dict:
     156        target_dict.update({key_name: g_kdTestStatuses.copy()})
     157    if test_result in g_kdTestStatuses:
    159158        target_dict[key_name][test_result] += 1
    160159    return target_dict
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