Exemplo n.º 1
0
 def update(self, fileState):
     # This file has either changed or this is the initial check. Run all modules on it to see if a new dependency has to be created
     newDependencies = []
     if fileState.fileType in config.fileTypesToCheckImplicitDependencies:
         lines = fileState.readlines()
         for m in self.modules:
             newDependencies = newDependencies + tools.ensureList(self.getDependencies(m, fileState, lines))
     # Whatever dependencies we found: These are now correct. Delete all the old ones that originally came from this file, add the new ones. However, don't touch explicit dependencies, since they have to live during the whole runtime.
     deprecatedDependencies = [d for d in self.dependencies if d.originFile == fileState]
     for d in deprecatedDependencies:
         if not d.explicit:
             self.removeDependency(d)
     for d in newDependencies:
         d.initialize(self.mrv, fileState)
         if d not in self.dependencies:
             self.addDependency(d)
Exemplo n.º 2
0
def testEnsureListWithString():
    assert(tools.ensureList("test") == ["test"])
Exemplo n.º 3
0
def testEnsureListWithList():
    assert(tools.ensureList([1,2,3]) == [1,2,3])
Exemplo n.º 4
0
def testEnsureListWithNone():
    assert(tools.ensureList(None) == [])