def __setupStage(self): """ Create all objects within the database with defaults """ self.executionDetails = TestExecutionDetails.create( testSuiteName = self.testSuiteName, executionName = self.executionName, #TODO: make me! scmidentifier = 'N/A', shortFilterDesc = self.shortFilterDesc, testPackDescriptor = self.packFilterDesc, startTime = time.time(), endTime = -1, duration = -1, envservExecutionModeName = 'automated', # FIXME: read from config hostNetAddress = Network.getIPAddressByInterface(), hostMacAddress = Network.getMacAddress(), tasVersion = os.environ['TAS_VERSION']) self.executionDetails.save() if not hasattr(self, 'source'): raise Exception("SQLLiteLogger: Source object has not been set") ResultBaseModel.Meta.database.set_autocommit(False) for group in self.source.groups: for test in group.tests: testDetails = TestDetails.get_or_create( testId = str(test.testId), module = str(test.testFile), testName = test.combineClassMethod(), invalid = test.invalid, manualInspection = test.manualInspection, docstrings = "\n".join(test.docstrings), timeout = test.testTimeout) testState = TestStates.filter(sequenceId = test.state.index).get() testResults = TestResults.create( testDetailsRef = testDetails, executed = False, invalid = test.invalid, result = testState, error = test.error, startTime = -1, duration = -1, manualInspection = test.manualInspection, testExecutionDetailsRef = self.executionDetails, peerRef = None, iterationId = None) testResults.save() testDetails.save() ResultBaseModel.Meta.database.commit() ResultBaseModel.Meta.database.set_autocommit(True)