<s> from testrunner import testhelp <EOL> from conary_test import rephelp <EOL> import os <EOL> from conary import conaryclient <EOL> from conary . conaryclient import cml , modelupdate , troveset , update <EOL> from conary . errors import TroveSpecsNotFound <EOL> from conary . deps import deps <EOL> from conary . repository import changeset <EOL> class ModelUpdateTest ( rephelp . RepositoryHelper ) : <EOL> def _applyModel ( self , modelList , addSearchLabel = True , apply = True , <EOL> useCache = None ) : <EOL> cachePath = os . path . join ( self . workDir , '<STR_LIT>' ) <EOL> from conary import callbacks <EOL> client = conaryclient . ConaryClient ( self . cfg , <EOL> updateCallback = callbacks . UpdateCallback ( ) ) <EOL> model = cml . CML ( self . cfg ) <EOL> cache = modelupdate . CMLTroveCache ( <EOL> client . getDatabase ( ) , client . getRepos ( ) ) <EOL> if useCache and os . path . exists ( cachePath ) : <EOL> cache . load ( cachePath ) <EOL> if addSearchLabel : <EOL> updatedModel = list ( modelList ) <EOL> updatedModel . insert ( <NUM_LIT:0> , '<STR_LIT>' ) <EOL> else : <EOL> updatedModel = modelList <EOL> model . parse ( updatedModel ) <EOL> updJob = client . newUpdateJob ( ) <EOL> ts = client . cmlGraph ( model ) <EOL> suggMap = client . _updateFromTroveSetGraph ( updJob , ts , cache ) <EOL> if useCache : <EOL> cache . save ( cachePath ) <EOL> if not apply : <EOL> return ts <EOL> client . applyUpdateJob ( updJob ) <EOL> return updJob , suggMap <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testSearchPath ( self ) : <EOL> self . addComponent ( '<STR_LIT>' , fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] ) <EOL> self . addComponent ( '<STR_LIT>' , <EOL> fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] ) <EOL> self . addCollection ( "<STR_LIT>" , [ "<STR_LIT>" , ( "<STR_LIT>" , False ) ] ) <EOL> self . addCollection ( "<STR_LIT>" , [ "<STR_LIT:foo>" ] , <EOL> weakRefList = [ "<STR_LIT>" ] ) <EOL> self . addComponent ( '<STR_LIT>' , fileContents = [ ( '<STR_LIT>' , '<STR_LIT>' ) ] ) <EOL> self . addComponent ( '<STR_LIT>' , <EOL> fileContents = [ ( '<STR_LIT>' , '<STR_LIT>' ) ] ) <EOL> self . addCollection ( "<STR_LIT>" , [ "<STR_LIT>" , ( "<STR_LIT>" , False ) ] ) <EOL> self . addCollection ( "<STR_LIT>" , [ "<STR_LIT:foo>" ] , <EOL> weakRefList = [ "<STR_LIT>" ] ) <EOL> self . _applyModel ( [ '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> self . resetRoot ( ) <EOL> self . _applyModel ( [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> self . resetRoot ( ) <EOL> self . _applyModel ( [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> self . resetRoot ( ) <EOL> self . _applyModel ( [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> self . verifyNoFile ( self . rootDir + '<STR_LIT>' ) <EOL> self . resetRoot ( ) <EOL> self . _applyModel ( [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . verifyNoFile ( self . rootDir + '<STR_LIT>' ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> self . resetRoot ( ) <EOL> self . _applyModel ( [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> self . verifyNoFile ( self . rootDir + '<STR_LIT>' ) <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testIntermediateSearchPath ( self ) : <EOL> self . addComponent ( '<STR_LIT>' , fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] ) <EOL> self . addCollection ( "<STR_LIT>" , [ "<STR_LIT>" ] ) <EOL> self . addComponent ( '<STR_LIT>' , fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] ) <EOL> self . addCollection ( "<STR_LIT>" , [ "<STR_LIT>" ] ) <EOL> self . addCollection ( "<STR_LIT>" , [ "<STR_LIT:foo>" , "<STR_LIT:bar>" ] , <EOL> weakRefList = [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . addComponent ( '<STR_LIT>' , <EOL> fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] ) <EOL> self . addCollection ( "<STR_LIT>" , [ "<STR_LIT>" ] ) <EOL> self . addComponent ( '<STR_LIT>' , fileContents = [ ( '<STR_LIT>' , '<STR_LIT>' ) ] ) <EOL> self . addCollection ( "<STR_LIT>" , [ "<STR_LIT>" ] ) <EOL> self . addComponent ( '<STR_LIT>' , fileContents = [ ( '<STR_LIT>' , '<STR_LIT>' ) ] ) <EOL> self . addCollection ( "<STR_LIT>" , [ "<STR_LIT>" , ( "<STR_LIT>" , False ) ] ) <EOL> self . addCollection ( "<STR_LIT>" , [ "<STR_LIT:foo>" , "<STR_LIT:bar>" ] , <EOL> weakRefList = [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> self . _applyModel ( [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] , <EOL> addSearchLabel = False ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> self . resetRoot ( ) <EOL> self . _applyModel ( [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] , <EOL> addSearchLabel = False ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . resetRoot ( ) <EOL> self . assertRaises ( TroveSpecsNotFound , self . _applyModel , [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] , <EOL> addSearchLabel = False ) <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testInstallWinsOverSearchPath ( self ) : <EOL> self . addComponent ( '<STR_LIT>' , fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] ) <EOL> self . addComponent ( '<STR_LIT>' , <EOL> fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] , <EOL> provides = '<STR_LIT>' ) <EOL> self . addCollection ( "<STR_LIT>" , [ "<STR_LIT>" , ( "<STR_LIT>" , False ) ] ) <EOL> self . addCollection ( "<STR_LIT>" , [ "<STR_LIT:foo>" ] , <EOL> weakRefList = [ ( "<STR_LIT>" , True ) , <EOL> ( "<STR_LIT>" , False ) ] ) <EOL> self . addComponent ( '<STR_LIT>' , <EOL> fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] , <EOL> provides = '<STR_LIT>' ) <EOL> self . addComponent ( '<STR_LIT>' ) <EOL> self . addCollection ( "<STR_LIT>" , [ "<STR_LIT>" , ( "<STR_LIT>" , False ) ] ) <EOL> self . addComponent ( '<STR_LIT>' , <EOL> fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] , <EOL> requires = '<STR_LIT>' ) <EOL> self . addCollection ( "<STR_LIT>" , [ "<STR_LIT>" ] ) <EOL> self . _applyModel ( [ '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) <EOL> self . verifyNoFile ( self . rootDir + '<STR_LIT>' ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> self . resetRoot ( ) <EOL> self . _applyModel ( [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> self . verifyNoFile ( self . rootDir + '<STR_LIT>' ) <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testModelImmediateSearchPath ( self ) : <EOL> '''<STR_LIT>''' <EOL> self . addComponent ( '<STR_LIT>' ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . _applyModel ( [ '<STR_LIT>' , <EOL> '<STR_LIT>' ] , addSearchLabel = False ) <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testSimple ( self ) : <EOL> self . addComponent ( '<STR_LIT>' , fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . _applyModel ( [ '<STR_LIT>' ] ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> self . addComponent ( '<STR_LIT>' , fileContents = [ ( '<STR_LIT>' , '<STR_LIT>' ) ] ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . _applyModel ( [ '<STR_LIT>' ] ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . addComponent ( '<STR_LIT>' , fileContents = [ ( '<STR_LIT>' , '<STR_LIT>' ) ] ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , fileContents = [ ( '<STR_LIT>' , '<STR_LIT>' ) ] , <EOL> requires = deps . parseDep ( '<STR_LIT>' ) ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . _applyModel ( [ '<STR_LIT>' ] ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT>' ) <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testSplit ( self ) : <EOL> self . addComponent ( '<STR_LIT>' , fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> oldThreshold = self . cfg . updateThreshold <EOL> self . cfg . updateThreshold = <NUM_LIT:2> <EOL> try : <EOL> updJob , suggMap = self . _applyModel ( [ '<STR_LIT>' ] ) <EOL> jobs = updJob . getJobs ( ) <EOL> assert ( len ( jobs ) == <NUM_LIT:2> ) <EOL> for job in jobs : <EOL> assert ( set ( [ x [ <NUM_LIT:0> ] [ <NUM_LIT:3> : ] for x in job ] ) == <EOL> set ( [ '<STR_LIT>' , '<STR_LIT>' ] ) ) <EOL> finally : <EOL> self . cfg . updateThreshold = oldThreshold <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testDependencyFailure ( self ) : <EOL> self . addComponent ( '<STR_LIT>' , <EOL> requires = deps . parseDep ( '<STR_LIT>' ) ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . assertRaises ( conaryclient . DepResolutionFailure , <EOL> self . _applyModel , [ '<STR_LIT>' ] ) <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testSearchPathBadTrove ( self ) : <EOL> e = self . assertRaises ( TroveSpecsNotFound , <EOL> self . _applyModel , [ '<STR_LIT>' ] ) <EOL> txt = '<STR_LIT>' <EOL> self . assertEquals ( str ( e ) , txt ) <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testInstallBadTrove ( self ) : <EOL> self . openRepository ( ) <EOL> e = self . assertRaises ( TroveSpecsNotFound , <EOL> self . _applyModel , [ '<STR_LIT>' ] ) <EOL> txt = '<STR_LIT>' <EOL> self . assertEquals ( str ( e ) , txt ) <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testErase ( self ) : <EOL> self . addComponent ( '<STR_LIT>' , <EOL> fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] ) <EOL> self . addComponent ( '<STR_LIT>' , <EOL> fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . _applyModel ( [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> assert ( not os . path . exists ( self . rootDir + '<STR_LIT>' ) ) <EOL> self . addComponent ( '<STR_LIT>' ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . resetRoot ( ) <EOL> self . _applyModel ( [ '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) <EOL> self . addCollection ( '<STR_LIT>' , [ "<STR_LIT:foo>" ] ) <EOL> self . _applyModel ( [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testExcludeTroves ( self ) : <EOL> self . addComponent ( '<STR_LIT>' , [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] ) <EOL> self . addComponent ( '<STR_LIT>' , [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] ) <EOL> self . addCollection ( '<STR_LIT:foo>' , [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> oldExclude = self . cfg . excludeTroves <EOL> try : <EOL> self . cfg . configLine ( '<STR_LIT>' ) <EOL> self . _applyModel ( [ '<STR_LIT>' ] ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> assert ( not os . path . exists ( self . rootDir + '<STR_LIT>' ) ) <EOL> self . _applyModel ( [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> finally : <EOL> self . cfg . excludeTroves = oldExclude <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testInclude ( self ) : <EOL> self . addComponent ( "<STR_LIT>" , <EOL> fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] ) <EOL> self . addCollection ( "<STR_LIT>" , [ "<STR_LIT>" ] ) <EOL> self . addComponent ( "<STR_LIT>" , fileContents = [ <EOL> ( "<STR_LIT>" , "<STR_LIT>" ) ] ) <EOL> self . addCollection ( "<STR_LIT>" , [ "<STR_LIT>" ] ) <EOL> self . _applyModel ( <EOL> [ '<STR_LIT>' % self . cfg . buildLabel , <EOL> '<STR_LIT>' ] , <EOL> addSearchLabel = False ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> self . resetRoot ( ) <EOL> self . _applyModel ( <EOL> [ '<STR_LIT>' % self . cfg . buildLabel , <EOL> '<STR_LIT>' ] , <EOL> addSearchLabel = False ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> self . addComponent ( "<STR_LIT>" , fileContents = [ <EOL> ( "<STR_LIT>" , "<STR_LIT>" ) , <EOL> ( "<STR_LIT>" , "<STR_LIT:\n>" ) ] ) <EOL> self . _applyModel ( <EOL> [ '<STR_LIT>' % self . cfg . buildLabel , <EOL> '<STR_LIT>' ] , <EOL> addSearchLabel = False ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testIncludeDeps ( self ) : <EOL> self . addComponent ( "<STR_LIT>" , <EOL> fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] ) <EOL> self . addCollection ( "<STR_LIT>" , [ '<STR_LIT>' ] ) <EOL> self . addComponent ( "<STR_LIT>" , fileContents = [ <EOL> ( "<STR_LIT>" , <EOL> "<STR_LIT>" ) ] ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:1.0>' , <EOL> requires = deps . parseDep ( '<STR_LIT>' ) ) <EOL> self . addCollection ( "<STR_LIT:bar>" , [ "<STR_LIT>" ] ) <EOL> self . _applyModel ( <EOL> [ '<STR_LIT>' % self . cfg . buildLabel , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] , <EOL> addSearchLabel = False ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testIncludeErrors ( self ) : <EOL> self . addComponent ( "<STR_LIT>" , fileContents = [ <EOL> ( "<STR_LIT>" , <EOL> "<STR_LIT>" ) , <EOL> ( "<STR_LIT>" , "<STR_LIT:\n>" ) ] ) <EOL> e = self . assertRaises ( troveset . IncludeException , <EOL> self . _applyModel , [ '<STR_LIT>' ] ) <EOL> self . assertEquals ( str ( e ) , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> self . addComponent ( "<STR_LIT>" , fileContents = [ ] ) <EOL> e = self . assertRaises ( troveset . IncludeException , <EOL> self . _applyModel , [ '<STR_LIT>' ] ) <EOL> self . assertEquals ( str ( e ) , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> self . addComponent ( '<STR_LIT>' ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> e = self . assertRaises ( troveset . IncludeException , <EOL> self . _applyModel , [ '<STR_LIT>' ] ) <EOL> self . assertEquals ( str ( e ) , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> e = self . assertRaises ( troveset . IncludeException , <EOL> self . _applyModel , [ '<STR_LIT>' ] ) <EOL> self . assertEquals ( str ( e ) , '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testIncludeLoops ( self ) : <EOL> self . addComponent ( "<STR_LIT>" , <EOL> fileContents = [ ( "<STR_LIT>" , "<STR_LIT>" ) ] ) <EOL> self . addCollection ( "<STR_LIT>" , [ "<STR_LIT>" ] ) <EOL> e = self . assertRaises ( troveset . IncludeException , <EOL> self . _applyModel , [ '<STR_LIT>' ] ) <EOL> self . assertEquals ( str ( e ) , '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testKeepDepsDeps ( self ) : <EOL> self . addComponent ( "<STR_LIT>" , <EOL> requires = deps . parseDep ( '<STR_LIT>' ) ) <EOL> self . addCollection ( "<STR_LIT>" , [ "<STR_LIT>" ] ) <EOL> self . addComponent ( "<STR_LIT>" , <EOL> requires = deps . parseDep ( '<STR_LIT>' ) ) <EOL> self . addCollection ( "<STR_LIT>" , [ "<STR_LIT>" ] ) <EOL> self . addComponent ( "<STR_LIT>" , fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1>' ) ] ) <EOL> self . addCollection ( "<STR_LIT>" , [ "<STR_LIT>" ] ) <EOL> updJob , suggMap = self . _applyModel ( [ '<STR_LIT>' ] ) <EOL> self . assertEquals ( len ( suggMap ) , <NUM_LIT:2> ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1>' ) <EOL> updJob , suggMap = self . _applyModel ( [ '<STR_LIT>' ] ) <EOL> self . assertEquals ( len ( suggMap ) , <NUM_LIT:0> ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1>' ) <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testLocalLabelDeps ( self ) : <EOL> csPath = self . workDir + '<STR_LIT>' <EOL> csPath1 = self . workDir + '<STR_LIT>' <EOL> csPath2 = self . workDir + '<STR_LIT>' <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT>' , <EOL> changeSetFile = csPath ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT>' , <EOL> changeSetFile = csPath1 ) <EOL> pkg = self . addCollection ( '<STR_LIT>' , <EOL> [ '<STR_LIT>' , ( '<STR_LIT>' , False ) ] , <EOL> changeSetFile = csPath2 ) <EOL> cs = changeset . ChangeSetFromFile ( csPath ) <EOL> os . unlink ( csPath ) <EOL> cs . merge ( changeset . ChangeSetFromFile ( csPath1 ) ) <EOL> cs . merge ( changeset . ChangeSetFromFile ( csPath2 ) ) <EOL> cs . setPrimaryTroveList ( [ pkg . getNameVersionFlavor ( ) ] ) <EOL> cs . writeToFile ( csPath ) <EOL> self . updatePkg ( self . rootDir , csPath ) <EOL> self . addComponent ( '<STR_LIT>' , <EOL> requires = '<STR_LIT>' ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . assertRaises ( update . DepResolutionFailure , <EOL> self . _applyModel , <EOL> [ '<STR_LIT>' % pkg . getVersion ( ) , <EOL> '<STR_LIT>' % self . cfg . buildLabel , ] , <EOL> addSearchLabel = True ) <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testPin ( self ) : <EOL> self . addComponent ( '<STR_LIT>' , <EOL> fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , <EOL> fileContents = [ ( '<STR_LIT>' , '<STR_LIT>' ) ] ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . _applyModel ( [ '<STR_LIT>' ] ) <EOL> self . pin ( '<STR_LIT:foo>' ) <EOL> self . _applyModel ( [ '<STR_LIT>' ] ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT>' ) <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testRedirect ( self ) : <EOL> self . addComponent ( '<STR_LIT>' , fileContents = [ '<STR_LIT>' ] ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , fileContents = [ '<STR_LIT>' ] ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> redirectRecipe = "<STR_LIT:\n>" . join ( [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) <EOL> built , d = self . buildRecipe ( redirectRecipe , "<STR_LIT>" ) <EOL> self . _applyModel ( [ '<STR_LIT>' ] ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' ) <EOL> redirectRecipe = "<STR_LIT:\n>" . join ( [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) <EOL> built , d = self . buildRecipe ( redirectRecipe , "<STR_LIT>" ) <EOL> self . _applyModel ( [ '<STR_LIT>' ] ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' ) <EOL> redirectRecipe = "<STR_LIT:\n>" . join ( [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) <EOL> built , d = self . buildRecipe ( redirectRecipe , "<STR_LIT>" ) <EOL> self . assertRaisesRegexp ( conaryclient . UpdateError , <EOL> '<STR_LIT>' , <EOL> self . _applyModel , [ '<STR_LIT>' ] ) <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testReferences ( self ) : <EOL> self . addComponent ( '<STR_LIT>' ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , <EOL> fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addCollection ( '<STR_LIT>' , <EOL> [ '<STR_LIT:foo>' , <EOL> ( '<STR_LIT>' , False ) ] ) <EOL> self . _applyModel ( [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testRemoveRecursion ( self ) : <EOL> self . addComponent ( '<STR_LIT>' , <EOL> fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , <EOL> fileContents = [ ( '<STR_LIT>' , '<STR_LIT>' ) ] ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . _applyModel ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . verifyNoFile ( self . rootDir + '<STR_LIT>' ) <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testPatch ( self ) : <EOL> self . addComponent ( '<STR_LIT>' , <EOL> fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] ) <EOL> self . addComponent ( '<STR_LIT>' , <EOL> fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , <EOL> fileContents = [ ( '<STR_LIT>' , '<STR_LIT>' ) ] ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . _applyModel ( [ '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT:1.0>' , <EOL> fileContents = [ '<STR_LIT>' ] ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addCollection ( '<STR_LIT>' , <EOL> [ '<STR_LIT:foo>' , ( '<STR_LIT:bar>' , False ) ] , <EOL> weakRefList = [ '<STR_LIT>' , '<STR_LIT>' , <EOL> ( '<STR_LIT>' , False ) ] ) <EOL> self . _applyModel ( [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> assert ( not os . path . exists ( self . rootDir + '<STR_LIT>' ) ) <EOL> self . _applyModel ( [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT>' ) <EOL> assert ( not os . path . exists ( self . rootDir + '<STR_LIT>' ) ) <EOL> assert ( not os . path . exists ( self . rootDir + '<STR_LIT>' ) ) <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testUpdate ( self ) : <EOL> self . addComponent ( '<STR_LIT>' , <EOL> fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] ) <EOL> self . addComponent ( '<STR_LIT>' , <EOL> fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , <EOL> fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT:foo>' , '<STR_LIT:bar>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , <EOL> fileContents = [ ( '<STR_LIT>' , '<STR_LIT>' ) ] ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . _applyModel ( [ '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] ) <EOL> assert ( not os . path . exists ( self . rootDir + '<STR_LIT>' ) ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> self . resetRoot ( ) <EOL> self . _applyModel ( [ '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] ) <EOL> assert ( not os . path . exists ( self . rootDir + '<STR_LIT>' ) ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> self . addCollection ( '<STR_LIT>' , <EOL> [ '<STR_LIT:foo>' , ( '<STR_LIT:bar>' , False ) ] , <EOL> weakRefList = [ '<STR_LIT>' , '<STR_LIT>' , <EOL> ( '<STR_LIT>' , False ) ] ) <EOL> self . resetRoot ( ) <EOL> self . _applyModel ( [ '<STR_LIT>' ] ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> assert ( not os . path . exists ( self . rootDir + '<STR_LIT>' ) ) <EOL> self . _applyModel ( [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT:1.0>' ) <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testUpdateOptionalPackages ( self ) : <EOL> '''<STR_LIT>''' <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT>' , filePrimer = <NUM_LIT:1> ) <EOL> self . addCollection ( '<STR_LIT:foo>' , '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT>' , filePrimer = <NUM_LIT:2> ) <EOL> self . addCollection ( '<STR_LIT:foo>' , '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addCollection ( '<STR_LIT>' , '<STR_LIT>' , <EOL> [ ( '<STR_LIT:foo>' , False ) ] , <EOL> weakRefList = [ ( '<STR_LIT>' , False ) ] ) <EOL> self . _applyModel ( [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) <EOL> self . verifyNoFile ( self . rootDir + '<STR_LIT>' ) <EOL> self . verifyFile ( self . rootDir + '<STR_LIT>' , '<STR_LIT>' ) <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testWalk ( self ) : <EOL> self . addComponent ( '<STR_LIT>' , <EOL> fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] ) <EOL> self . addComponent ( '<STR_LIT>' , <EOL> fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . addComponent ( '<STR_LIT>' , <EOL> fileContents = [ ( '<STR_LIT>' , '<STR_LIT:1.0>' ) ] ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT:foo>' , '<STR_LIT:bar>' ] , <EOL> weakRefList = [ ( "<STR_LIT>" , False ) , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) <EOL> self . _applyModel ( [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] ) <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testBranchUpdate ( self ) : <EOL> "<STR_LIT>" <EOL> self . addComponent ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . addCollection ( '<STR_LIT:foo>' , '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . _applyModel ( [ '<STR_LIT>' ] ) <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testCacheMergeBug ( self ) : <EOL> "<STR_LIT>" <EOL> self . addComponent ( '<STR_LIT>' , provides = '<STR_LIT>' ) <EOL> self . addComponent ( '<STR_LIT>' , provides = '<STR_LIT>' ) <EOL> self . addComponent ( '<STR_LIT>' , requires = '<STR_LIT>' ) <EOL> self . addComponent ( '<STR_LIT>' , requires = '<STR_LIT>' ) <EOL> for name in [ '<STR_LIT:foo>' , '<STR_LIT>' , '<STR_LIT:bar>' , '<STR_LIT>' ] : <EOL> self . addCollection ( name , [ '<STR_LIT>' ] ) <EOL> model = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] <EOL> self . _applyModel ( model , addSearchLabel = False , useCache = True ) <EOL> model . append ( '<STR_LIT>' ) <EOL> self . _applyModel ( model , addSearchLabel = False , useCache = True ) <EOL> self . _applyModel ( model , addSearchLabel = False , useCache = True ) <EOL> @ testhelp . context ( '<STR_LIT>' ) <EOL> def testImplicitDepUpdate ( self ) : <EOL> "<STR_LIT>" <EOL> t1 = self . addComponent ( '<STR_LIT>' , provides = '<STR_LIT>' ) <EOL> t2 = self . addComponent ( '<STR_LIT>' , provides = '<STR_LIT>' ) <EOL> self . addComponent ( '<STR_LIT>' , requires = '<STR_LIT>' ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addCollection ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> self . addCollection ( '<STR_LIT:bar>' , [ '<STR_LIT>' ] ) <EOL> self . _applyModel ( [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] ) <EOL> jobs , suggMap = self . _applyModel ( [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] ) <EOL> jobs = sorted ( sum ( jobs . jobs , [ ] ) ) <EOL> self . assertEqual ( jobs , [ <EOL> ( '<STR_LIT:foo>' , ( t1 . getVersion ( ) , t1 . getFlavor ( ) ) , ( t2 . getVersion ( ) , t2 . getFlavor ( ) ) , False ) , <EOL> ( '<STR_LIT>' , ( t1 . getVersion ( ) , t1 . getFlavor ( ) ) , ( t2 . getVersion ( ) , t2 . getFlavor ( ) ) , False ) , <EOL> ] ) </s>
