uniquify the return from find_resource(), and update a test
This commit is contained in:
parent
15ee2cb24d
commit
1adb42b34f
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue