示例#1
0
    def test_expand_to_packages_unary(self):
        # test unary
        test_dir = os.path.join(roslib.packages.get_pkg_dir('test_roslib'), 'test', 'stack_tests_unary')

        env = os.environ.copy()
        env[rospkg.environment.ROS_PACKAGE_PATH] = test_dir

        from roslib.stacks import expand_to_packages      
        self.assertEquals((['foo'], []), expand_to_packages(['foo'], env=env))
        self.assertEquals((['foo', 'bar'], []), expand_to_packages(['foo', 'bar'], env=env))
示例#2
0
    def test_expand_to_packages_unary(self):
        # test unary
        test_dir = os.path.join(roslib.packages.get_pkg_dir('roslib'), 'test', 'stack_tests_unary')

        env = os.environ.copy()
        env[rospkg.environment.ROS_PACKAGE_PATH] = test_dir

        from roslib.stacks import expand_to_packages
        self.assertEquals((['foo'], []), expand_to_packages(['foo'], env=env))
        self.assertEquals((['foo', 'bar'], []), expand_to_packages(['foo', 'bar'], env=env))
示例#3
0
 def test_expand_to_packages(self):
     from roslib.stacks import expand_to_packages
     try:
         # it's possible to accidentally pass in a sequence type
         # like a string and get weird results, so check that we
         # don't
         self.assertEquals(([], []), expand_to_packages('ros'))
         self.fail("expand_to_packages should only take in a list of strings")
     except ValueError: pass
     
     self.assertEquals(([], []), expand_to_packages([]))
     self.assertEquals((['rosmake', 'roslib', 'roslib'], []), expand_to_packages(['rosmake', 'roslib', 'roslib']))
     self.assertEquals(([], ['bogus_one', 'bogus_two']), expand_to_packages(['bogus_one', 'bogus_two']))
示例#4
0
    def test_expand_to_packages(self):
        from roslib.stacks import expand_to_packages
        try:
            # it's possible to accidentally pass in a sequence type
            # like a string and get weird results, so check that we
            # don't
            self.assertEquals(([], []), expand_to_packages('ros'))
            self.fail('expand_to_packages should only take in a list of strings')
        except ValueError:
            pass

        self.assertEquals(([], []), expand_to_packages([]))
        self.assertEquals((['rosmake', 'roslib', 'roslib'], []), expand_to_packages(['rosmake', 'roslib', 'roslib']))
        self.assertEquals(([], ['bogus_one', 'bogus_two']), expand_to_packages(['bogus_one', 'bogus_two']))
示例#5
0
    def test_expand_to_packages(self):
        from roslib.stacks import expand_to_packages
        try:
            # it's possible to accidentally pass in a sequence type
            # like a string and get weird results, so check that we
            # don't
            self.assertEquals(([], []), expand_to_packages('ros'))
            self.fail(
                "expand_to_packages should only take in a list of strings")
        except ValueError:
            pass

        self.assertEquals(([], []), expand_to_packages([]))
        self.assertEquals(
            (['rospy', 'test_roslib', 'roslib'], []),
            expand_to_packages(['rospy', 'test_roslib', 'roslib']))
        self.assertEquals(([], ['bogus_one', 'bogus_two']),
                          expand_to_packages(['bogus_one', 'bogus_two']))

        self.assertEquals(([], ['bogus_one', 'bogus_two']),
                          expand_to_packages(['bogus_one', 'bogus_two']))

        # TODO: setup directory tree so that this can be more precisely calculated
        valid, invalid = expand_to_packages(['ros', 'bogus_one'])
        self.assertEquals(['bogus_one'], invalid)
        check = [
            'rospy', 'roscpp', 'rospack', 'rosmake', 'roslib', 'rostest',
            'std_msgs'
        ]
        for c in check:
            self.assert_(c in valid,
                         "expected [%s] to be in ros expansion" % c)
示例#6
0
   def test_expand_to_packages(self):
       from roslib.stacks import expand_to_packages
       try:
           # it's possible to accidentally pass in a sequence type
           # like a string and get weird results, so check that we
           # don't
           self.assertEquals(([], []), expand_to_packages('ros'))
           self.fail("expand_to_packages should only take in a list of strings")
       except ValueError: pass
       
       self.assertEquals(([], []), expand_to_packages([]))
       self.assertEquals((['rosmake', 'test_roslib', 'roslib'], []), expand_to_packages(['rosmake', 'test_roslib', 'roslib']))
       self.assertEquals(([], ['bogus_one', 'bogus_two']), expand_to_packages(['bogus_one', 'bogus_two']))
 
       self.assertEquals(([], ['bogus_one', 'bogus_two']), expand_to_packages(['bogus_one', 'bogus_two']))      
 
       # TODO: setup directory tree so that this can be more precisely calculated
       valid, invalid = expand_to_packages(['ros', 'bogus_one'])
       self.assertEquals(['bogus_one'], invalid)
       check = ['rosbuild', 'rospack', 'rosunit', 'test_roslib']
       for c in check:
           self.assert_(c in valid, "expected [%s] to be in ros expansion"%c)