def testExpandPaths(self): recipe = self.getRecipe() tmpDir = recipe.macros.destdir fn = os.path.join(tmpDir, 'foo') self.touch(fn) reg = self.getRegexp('/foo') paths = action._expandPaths([reg], recipe.macros) self.assertEquals([fn], paths) paths = action._expandPaths(['/*'], recipe.macros) self.assertEquals([fn], paths) glob = self.getGlob('/f?o') paths = action._expandPaths([glob], recipe.macros) self.assertEquals([fn], paths)
def testExpandGlobsWithDirs(self): recipe = self.getRecipe() tmpDir = recipe.macros.destdir goodFn = os.path.join(tmpDir, 'foo.bar') badFn = os.path.join(tmpDir, 'foo', 'bar') self.touch(goodFn) self.touch(badFn) glob = self.getGlob('/foo*') paths = action._expandPaths([glob], recipe.macros) self.assertEquals(sorted([goodFn, os.path.dirname(badFn)]), sorted(paths)) glob = self.getGlob('/foo?*') paths = action._expandPaths([glob], recipe.macros) self.assertEquals([goodFn], paths) glob = self.getGlob('/foo?bar') paths = action._expandPaths([glob], recipe.macros) self.assertEquals([goodFn], paths)