def testGetHigherLevelPath(self): """Checks that higher directories are recursively checked for OWNERS. Also, checks that there isn't a recursive loop. """ path = expand_owners._GetOwnersFilePath('src/banana/chocolate/OWNERS') result = expand_owners._GetHigherLevelOwnersFilePath(path) # The condition is true when the tools directory's parent directory is src, # which is generally the case locally. However, the parent directory is not # always src, e.g. on various testing bots. if os.path.basename(_GetToolsParentDir()) == 'src': self.assertRegexpMatches(result, r'.*OWNERS') else: self.assertEqual(result, '')
def testGetHigherLevelPathDerivedPathInSrcDirectory(self): """Checks that higher directories are recursively checked for OWNERS.""" path = expand_owners._GetOwnersFilePath('src/banana/chocolate/OWNERS') self.assertRegexpMatches( expand_owners._GetHigherLevelOwnersFilePath(path), r'.*src/OWNERS')