def setUp( self, useScm = False, useEnvironments = False ): MomTestCase.setUp( self, False ) sys.argv = [] # reset command line arguments build = Build( name = 'XmlReportTestBuild' ) project = Project( 'XmlReportTestProject' ) build.setProject( project ) if useScm: project.createScm( 'git://github.com/KDAB/Make-O-Matic.git' ) if useEnvironments: environments = Environments( [ 'dep-a-1.?.0' ], 'Test dependency', project ) else: environments = Environments() # add some plugin dox = DoxygenGenerator() dox.setEnabled( False ) project.addPlugin( dox ) # add some configurations Configuration( 'Debug', environments ) Configuration( 'Release', environments ) build.getSettings().set( Settings.EnvironmentsBaseDir, self.TEST_MOM_ENVIRONMENTS ) self.build = build self.project = project self.cwd = os.getcwd()
def getBuild( name, minimumMomVersion ): try: build = Build( minimumMomVersion, name ) build.getParameters().parse() mApp().getSettings().set( Settings.ScriptLogLevel, build.getParameters().getDebugLevel() ) build.addLogger( ConsoleLogger() ) build.addLogger( FileLogger() ) build.addPlugin( XmlReportGenerator() ) build.addPlugin( ConsoleReporter() ) build.addPlugin( IntegrityChecker() ) build.initialize() return build except MomException as e: print( 'Error during setup, return code {0}: {1}'.format( e.getReturnCode() , str( e ) ), sys.stderr ) sys.exit( e.getReturnCode() )