def getList(value): roughtValueList = value[1:-1].split(c.COMA) valueList = list() for value in roughtValueList: gottenValue = getValue(value) if ObjectHelper.isNotEmpty(gottenValue): valueList.append(gottenValue) return valueList
def updateSettingTree(toUpdateSettingTree, gatheringSettingTree): if ObjectHelper.isNotEmpty(gatheringSettingTree): if ObjectHelper.isNone(toUpdateSettingTree) or StringHelper.isBlank( toUpdateSettingTree): toUpdateSettingTree = {} if ObjectHelper.isCollection( gatheringSettingTree) and ObjectHelper.isDictionary( gatheringSettingTree): for key, value in gatheringSettingTree.items(): if ObjectHelper.isNotEmpty(value) and ObjectHelper.isNotNone( value): if key not in toUpdateSettingTree or ObjectHelper.isEmpty( toUpdateSettingTree[key]): toUpdateSettingTree[key] = value else: updateSettingTree(toUpdateSettingTree[key], gatheringSettingTree[key]) elif key not in toUpdateSettingTree: toUpdateSettingTree[key] = value
def replaceEnvironmentVariables(environmentVariables): global ACTIVE_ENVIRONMENT_VALUE originalActiveEnvironment = None if ObjectHelper.isNone( ACTIVE_ENVIRONMENT_VALUE) else f'{c.NOTHING}{ACTIVE_ENVIRONMENT_VALUE}' if ObjectHelper.isNotEmpty(originalActiveEnvironment): ACTIVE_ENVIRONMENT_VALUE = None originalEnvironmentVariables = {} if ObjectHelper.isDictionary(environmentVariables): for key, value in environmentVariables.items(): originalEnvironmentVariables[key] = EnvironmentHelper.switch( key, value) getActiveEnvironment() LogHelper.loadSettings() return originalEnvironmentVariables, originalActiveEnvironment
def update(environmentKey, environmentValue, default=None) : if ObjectHelper.isNotEmpty(environmentKey) : associatedValue = None if not environmentValue is None : associatedValue = str(StringHelper.filterString(environmentValue)) OS.environ[environmentKey] = associatedValue elif not default is None : associatedValue = str(StringHelper.filterString(default)) OS.environ[environmentKey] = associatedValue else : try: delete(environmentKey) except Exception as exception : LogHelper.warning(update, f'Failed to delete "{environmentKey}" enviroment variable key', exception=exception) return associatedValue else : LogHelper.debug(update, f'arguments: environmentKey: {environmentKey}, environmentValue: {environmentValue}, default: {default}') raise Exception(f'Error associating environment variable "{environmentKey}" key to environment variable "{environmentValue}" value')
def getTestModuleNames(runOnly, ignore, globalsInstance): testsToRun = [] if ObjectHelper.isNone( runOnly) or ObjectHelper.isNotCollection(runOnly) else runOnly testsToIgnore = [] if ObjectHelper.isNone( ignore) or ObjectHelper.isNotCollection(ignore) else ignore runSpecificTests = ObjectHelper.isNotEmpty(testsToRun) LogHelper.prettyPython(getTestModuleNames, f'runSpecificTests: {runSpecificTests}, testsToRun', testsToRun, logLevel=LogHelper.TEST) testModuleNames = [] if ObjectHelper.isEmpty(testsToRun): testQueryTree = SettingHelper.querySetting(TEST_PACKAGE, globalsInstance.apiTree) LogHelper.prettyPython(getTestModuleNames, 'Test query tree', testQueryTree, logLevel=LogHelper.TEST) testModuleNames += getTestModuleNamesFromQuerryTree( testQueryTree, runOnly, ignore) else: for testName in testsToIgnore: if testName in testsToRun: testModuleNames, testsToRun, runSpecificTests.remove(testName) for testName in testsToRun: testNameSplitted = testName.split(c.DOT) testModuleName = c.NOTHING if 2 == len(testNameSplitted): testModuleName = testNameSplitted[-2] if testModuleName not in testModuleNames and StringHelper.isNotBlank( testName): testModuleNames.append(testModuleName) LogHelper.prettyPython(getTestModuleNames, 'Test module names', testModuleNames, logLevel=LogHelper.TEST) return testModuleNames, testsToRun, runSpecificTests
def isSettingValue(settingValue): return ObjectHelper.isNotEmpty(settingValue) or ObjectHelper.isCollection( settingValue)