normpath some paths to pass unit tests with ROS_ROOT containing ..

This commit is contained in:
Dirk Thomas 2012-11-04 04:23:07 +00:00
parent 0092abbba3
commit bf8ec0747d
2 changed files with 2 additions and 1 deletions

View File

@ -174,6 +174,7 @@ def get_pkg_dir(package, required=True, ros_root=None, ros_package_path=None):
if not pkg_dir:
raise InvalidROSPkgException("Cannot locate installation of package %s: %s. ROS_ROOT[%s] ROS_PACKAGE_PATH[%s]"%(package, rperr.strip(), ros_root, ros_package_path))
pkg_dir = os.path.normpath(pkg_dir)
if not os.path.exists(pkg_dir):
raise InvalidROSPkgException("Cannot locate installation of package %s: [%s] is not a valid path. ROS_ROOT[%s] ROS_PACKAGE_PATH[%s]"%(package, pkg_dir, ros_root, ros_package_path))
elif not os.path.isdir(pkg_dir):

View File

@ -50,7 +50,7 @@ class RoslibPackagesTest(unittest.TestCase):
def test_get_pkg_dir(self):
import roslib.packages
import roslib.rospack
path = roslib.rospack.rospackexec(['find', 'roslib'])
path = os.path.normpath(roslib.rospack.rospackexec(['find', 'roslib']))
self.assertEquals(path, roslib.packages.get_pkg_dir('roslib'))
try:
self.assertEquals(path, roslib.packages.get_pkg_dir('fake_roslib'))