uniquify the return from find_resource(), and update a test

This commit is contained in:
Brian Gerkey 2012-01-15 22:33:27 +00:00
parent 15ee2cb24d
commit 1adb42b34f
2 changed files with 4 additions and 3 deletions

View File

@ -527,4 +527,5 @@ def find_resource(pkg, resource_name, filter_fn=None, rospack=None, catkin_packa
if pkg in catkin_packages_cache:
matches.extend(_find_resource(catkin_packages_cache[pkg], resource_name, filter_fn=filter_fn))
matches.extend(_find_resource(pkg_path, resource_name, filter_fn=filter_fn))
return matches
# Uniquify the results, in case we found the same file twice
return list(set(matches))

View File

@ -58,9 +58,9 @@ class RoslibPackagesTest(unittest.TestCase):
import roslib.packages
d = roslib.packages.get_pkg_dir('roslib')
p = os.path.join(d, 'test', 'fake_node.py')
self.assertEquals(p, roslib.packages.find_node('roslib', 'fake_node.py'))
self.assertEquals([p], roslib.packages.find_node('roslib', 'fake_node.py'))
self.assertEquals(None, roslib.packages.find_node('roslib', 'not_a_node'))
self.assertEquals([], roslib.packages.find_node('roslib', 'not_a_node'))
def test_get_pkg_dir(self):
import roslib.packages