def wmic_rows(): rows = [] nic_rows = parse_wmic_output(check_subprocess(['wmic', 'nic'])[0]) nicconfig_rows = parse_wmic_output( check_subprocess(['wmic', 'nicconfig'])[0]) # We're effectively performing a join on SettingID and GUID here. for nic_row in nic_rows: if nic_row['GUID'] == "": L.verbose("Network adapter '{}' has no GUID. Ignoring it!".format( nic_row['Name'])) continue for nicconfig_row in nicconfig_rows: if nicconfig_row['SettingID'] == nic_row['GUID']: rows.append(merge_two_dicts(nic_row, nicconfig_row)) break return rows
def configure(config=None): if config is None: config = {} for logger_name, settings in list(config.items()): LeakTestLogger.CURRENT_CONFIG[logger_name] = merge_two_dicts( LeakTestLogger.CURRENT_CONFIG[logger_name], settings) # Configure trace first so we can use it to log info about the other loggers. trace_settings = LeakTestLogger.CURRENT_CONFIG['trace'] LeakTestLogger._configure_logger('trace', **trace_settings) for logger_name, settings in list(LeakTestLogger.CURRENT_CONFIG.items()): if logger_name == 'trace': continue LeakTestLogger._configure_logger(logger_name, **settings)
def test_merge_two_dicts(self, dict1, dict2, merged): self.assertEqual(merge_two_dicts(dict1, dict2), merged)