def testTryFindSingleEnv( self ): dep = [ 'dep-a-1.0.0' ] environments = Environments( dep ) matches = environments.findMatchingEnvironments() self.assertEquals( len( matches ), 1 ) for match in matches: # there is only one :-) self.assertEquals( match.makeDescription(), 'dep-a-1.0.0' )
def testTryFindThreeMatches( self ): dep = [ 'dep-a-1.?.0' ] environments = Environments( dep ) matches = environments.findMatchingEnvironments() # there should be 3 matches self.assertEquals( len( matches ), 3 ) # check if every environment contains every dependency only once allPaths = [] for environment in matches: paths = [] for dependency in environment.getDependencies(): self.assertTrue( dependency.getFolder() not in paths ) # this must be true because there is only one dependency we are looking for, so every path should appear only once self.assertTrue( dependency.getFolder() not in allPaths ) self.assertTrue( os.path.isdir( dependency.getFolder() ) ) paths.append( dependency.getFolder() ) allPaths.append( dependency.getFolder() )
from core.Configuration import Configuration from core.environments.Environments import Environments from core.helpers.BoilerPlate import BuildProject from core.helpers.PathResolver import PathResolver from core.plugins.Preprocessor import Preprocessor from core.plugins.builders.generators.CMakeBuilder import CMakeBuilder, CMakeVariable from core.plugins.packagers.CPack import CPack from core.plugins.testers.CTest import CTest from core.plugins.reporters.EmailReporter import EmailReporter from core.helpers.GlobalMApp import mApp from core.plugins.platforms.BlackLister import BlackLister build, project = BuildProject( name = 'GammaRay', version = '0.1.0', url = '[email protected]:gammaray.git' ) build.addPlugin( BlackLister( variable = 'QMAKESPEC', pattern = 'win32-g\+\+' ) ) sharedDebug = Environments( [ 'Qt-4.7.?-Shared-Debug' ], 'Qt 4 Shared Debug', project ) #sharedDebug = Environments( [], 'Qt 4 Shared Debug', project ) sharedDebug.setOptional( True ) debug = Configuration( 'Debug', sharedDebug, ) cmakeDebug = CMakeBuilder() cmakeDebug.addCMakeVariable( CMakeVariable( 'CMAKE_BUILD_TYPE', 'debug', 'STRING' ) ) debug.addPlugin( cmakeDebug ) debug.addPlugin( CTest() ) sharedRelease = Environments( [ 'Qt-4.7.?' ], 'Qt 4 Shared Release', project ) #sharedRelease = Environments( [], 'Qt 4 Shared Release', project ) release = Configuration( 'Release', sharedRelease ) cmakeRelease = CMakeBuilder() cmakeRelease.addCMakeVariable( CMakeVariable( 'CMAKE_BUILD_TYPE', 'release', 'STRING' ) ) release.addPlugin( cmakeRelease )
def testTryFindNonExistantEnv( self ): dep = [ 'nonsense-1.0.0' ] environments = Environments( dep ) matches = environments.findMatchingEnvironments() self.assertEquals( len( matches ), 0 )
def testTryFindNEnv( self ): dep = [ 'dep-a-1.?.0', 'dep-b-2.?.0' ] environments = Environments( dep ) matches = environments.findMatchingEnvironments() self._printMatches( matches ) self.assertEquals( len( matches ), 7 )
def testTryFindTwoEnvironmentsSameFolder( self ): dep = [ 'dep-a-1.0.0', 'dep-b-2.0.0' ] environments = Environments( dep ) matches = environments.findMatchingEnvironments() self._printMatches( matches ) self.assertEquals( len( matches ), 1 )
from core.helpers.BoilerPlate import BuildProject from core.helpers.PathResolver import PathResolver from core.plugins.Preprocessor import Preprocessor from core.plugins.builders.generators.CMakeBuilder import CMakeBuilder, CMakeVariable from core.plugins.packagers.CPack import CPack from core.plugins.testers.CTest import CTest from core.plugins.reporters.EmailReporter import EmailReporter from core.helpers.GlobalMApp import mApp from core.plugins.platforms.BlackLister import BlackLister build, project = BuildProject(name='GammaRay', version='0.1.0', url='[email protected]:gammaray.git') build.addPlugin(BlackLister(variable='QMAKESPEC', pattern='win32-g\+\+')) sharedDebug = Environments(['Qt-4.7.?-Shared-Debug'], 'Qt 4 Shared Debug', project) #sharedDebug = Environments( [], 'Qt 4 Shared Debug', project ) sharedDebug.setOptional(True) debug = Configuration( 'Debug', sharedDebug, ) cmakeDebug = CMakeBuilder() cmakeDebug.addCMakeVariable( CMakeVariable('CMAKE_BUILD_TYPE', 'debug', 'STRING')) debug.addPlugin(cmakeDebug) debug.addPlugin(CTest()) sharedRelease = Environments(['Qt-4.7.?'], 'Qt 4 Shared Release', project) #sharedRelease = Environments( [], 'Qt 4 Shared Release', project ) release = Configuration('Release', sharedRelease)