From bf8ec0747d824a0851357b2676842e8d32e90eb5 Mon Sep 17 00:00:00 2001 From: Dirk Thomas Date: Sun, 4 Nov 2012 04:23:07 +0000 Subject: [PATCH] normpath some paths to pass unit tests with ROS_ROOT containing .. --- core/roslib/src/roslib/packages.py | 1 + core/roslib/test/test_roslib_packages.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/roslib/src/roslib/packages.py b/core/roslib/src/roslib/packages.py index 14da36a0..e80d947c 100644 --- a/core/roslib/src/roslib/packages.py +++ b/core/roslib/src/roslib/packages.py @@ -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): diff --git a/core/roslib/test/test_roslib_packages.py b/core/roslib/test/test_roslib_packages.py index a9f42663..b42eda4b 100644 --- a/core/roslib/test/test_roslib_packages.py +++ b/core/roslib/test/test_roslib_packages.py @@ -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'))