def test_get_yaml_from_uri_from_url(self): # wet url = "http://ros.org/rosinstalls/fuerte-ros-full.rosinstall" yaml_elements = get_yaml_from_uri(url) self.assertTrue(ros_found_in_yaml(yaml_elements), "No ros element in %s" % url) # dry (contains "other" ros element) url = "http://packages.ros.org/cgi-bin/gen_rosinstall.py?rosdistro=fuerte&variant=desktop-full&overlay=no" yaml_elements = get_yaml_from_uri(url) self.assertTrue(ros_found_in_yaml(yaml_elements), "No ros element in %s" % url)
def test_get_yaml_from_uri_from_url_pre_electric(self): # boxturtle url = "http://www.ros.org/rosinstalls/boxturtle_base.rosinstall" yaml_elements = get_yaml_from_uri(url) self.assertTrue(self._ros_found(yaml_elements), "No ros element in %s"%url) # diamondback url = "http://packages.ros.org/cgi-bin/gen_rosinstall.py?rosdistro=diamondback&variant=desktop-full&overlay=no" yaml_elements = get_yaml_from_uri(url) self.assertTrue(yaml_elements is not None) self.assertTrue(len(yaml_elements) > 0, "No elements in %s"%url) self.assertTrue(self._ros_found(yaml_elements), "No ros element in %s"%url)
def test_get_yaml_from_uri_from_missing_file(self): file = "/asdfasdfasdfasfasdf_does_not_exist" try: get_yaml_from_uri(file) self.fail("Expected exception") except MultiProjectException: pass try: get_path_specs_from_uri(file) self.fail("Expected exception") except MultiProjectException: pass
def test_get_yaml_from_uri_from_missing_file(self): filename = "/asdfasdfasdfasfasdf_does_not_exist" try: get_yaml_from_uri(filename) self.fail("Expected exception") except MultiProjectException: pass try: get_path_specs_from_uri(filename) self.fail("Expected exception") except MultiProjectException: pass
def test_get_yaml_from_uri_from_url_pre_electric(self): # boxturtle url = "http://www.ros.org/rosinstalls/boxturtle_base.rosinstall" yaml_elements = get_yaml_from_uri(url) self.assertTrue(self._ros_found(yaml_elements), "No ros element in %s" % url) # diamondback url = "http://packages.ros.org/cgi-bin/gen_rosinstall.py?rosdistro=diamondback&variant=desktop-full&overlay=no" yaml_elements = get_yaml_from_uri(url) self.assertTrue(yaml_elements is not None) self.assertTrue(len(yaml_elements) > 0, "No elements in %s" % url) self.assertTrue(self._ros_found(yaml_elements), "No ros element in %s" % url)
def test_get_yaml_from_uri_from_invalid_url(self): url = "http://invalidurl" try: get_yaml_from_uri(url) self.fail("Expected exception") except MultiProjectException: pass # valid but non-yaml url = "http://www.google.com" try: get_yaml_from_uri(url) self.fail("Expected exception") except MultiProjectException: pass
def test_get_yaml_from_uri_from_url_fuerte(self): url = "http://packages.ros.org/cgi-bin/gen_rosinstall.py?rosdistro=fuerte&variant=desktop-full&overlay=no" yaml_elements = get_yaml_from_uri(url) self.assertTrue(yaml_elements is not None) self.assertTrue(len(yaml_elements) > 0, "No elements in %s" % url) self.assertTrue(self._ros_found(yaml_elements), "No ros element in %s from %s" % (yaml_elements, url))
def test_source(self): """checkout into temp dir and test setup files""" cmd = copy.copy(self.rosinstall_fn) self.simple_rosinstall = os.path.join(self.directory, "simple.rosinstall") _create_yaml_file([_create_config_elt_dict("svn", "ros", 'https://code.ros.org/svn/ros/stacks/ros/tags/boxturtle'), _create_config_elt_dict("svn", "ros_release", 'https://code.ros.org/svn/ros/stacks/ros_release/trunk')], self.simple_rosinstall) cmd.extend(['-j8', self.directory, self.simple_rosinstall]) self.assertTrue(rosinstall_main(cmd)) generated_rosinstall_filename = os.path.join(self.directory, ".rosinstall") self.assertTrue(os.path.exists(generated_rosinstall_filename)) self.assertTrue(os.path.exists(os.path.join(self.directory, "ros"))) self.assertTrue(os.path.exists(os.path.join(self.directory, "ros_release"))) self.assertTrue(os.path.exists(os.path.join(self.directory, "setup.sh"))) source_yaml = get_yaml_from_uri(generated_rosinstall_filename) self.assertEqual(source_yaml, [{'svn': { 'uri': 'https://code.ros.org/svn/ros/stacks/ros/tags/boxturtle', 'local-name': 'ros'} }, {'svn': { 'uri': 'https://code.ros.org/svn/ros/stacks/ros_release/trunk', 'local-name': 'ros_release'} } ]) subprocess.check_call(". %s" % os.path.join(self.directory, 'setup.sh'), shell=True, env=self.new_environ) subprocess.check_call(". %s" % os.path.join(self.directory, 'setup.bash'), shell=True, env=self.new_environ, executable='bash')
def test_get_yaml_from_uri_from_file(self): file = os.path.join("test", "example.yaml") y = get_yaml_from_uri(file) self.assertTrue("text" in y) self.assertTrue(y["text"] == "foobar") self.assertTrue("number" in y) self.assertTrue(y["number"] == 2) # invalid try: yaml = get_yaml_from_uri(os.path.join("test", "example-broken.yaml")) except MultiProjectException: pass try: get_path_specs_from_uri(file) self.fail("Expected exception") except MultiProjectException: pass
def test_source_boxturtle(self): """install boxturtle into temp dir""" cmd = copy.copy(self.rosinstall_fn) self.simple_rosinstall = os.path.join(self.directory, "simple.rosinstall") _create_yaml_file([ _create_config_elt_dict( "svn", "ros", 'https://code.ros.org/svn/ros/stacks/ros/tags/boxturtle'), _create_config_elt_dict( "svn", "ros_release", 'https://code.ros.org/svn/ros/stacks/ros_release/trunk') ], self.simple_rosinstall) cmd.extend([self.directory, self.simple_rosinstall]) self.assertTrue(rosinstall_main(cmd)) generated_rosinstall_filename = os.path.join(self.directory, ".rosinstall") self.assertTrue(os.path.exists(generated_rosinstall_filename)) self.assertTrue(os.path.exists(os.path.join(self.directory, "ros"))) self.assertTrue( os.path.exists(os.path.join(self.directory, "ros_release"))) self.assertTrue( os.path.exists(os.path.join(self.directory, "setup.sh"))) source_yaml = get_yaml_from_uri(generated_rosinstall_filename) self.assertEqual(source_yaml, [{ 'svn': { 'uri': 'https://code.ros.org/svn/ros/stacks/ros/tags/boxturtle', 'local-name': 'ros' } }, { 'svn': { 'uri': 'https://code.ros.org/svn/ros/stacks/ros_release/trunk', 'local-name': 'ros_release' } }]) self.assertEqual( 0, subprocess.call(". %s" % os.path.join(self.directory, 'setup.sh'), shell=True, env=self.new_environ)) self.assertEqual( 0, subprocess.call(". %s" % os.path.join(self.directory, 'setup.bash'), shell=True, env=self.new_environ, executable='/bin/bash'))
def test_get_yaml_from_uri_from_url(self): url = "http://www.ros.org/rosinstalls/boxturtle_base.rosinstall" yaml_elements = get_yaml_from_uri(url) self.assertTrue(ros_found_in_yaml(yaml_elements), "No ros element in %s" % url)
def test_get_yaml_from_uri_from_url(self): url = "http://packages.ros.org/web/rosinstall/generate/raw/groovy/ros-base" yaml_elements = get_yaml_from_uri(url) self.assertTrue(ros_found_in_yaml(yaml_elements), "No ros element in %s" % url)
def test_get_yaml_from_uri_from_url(self): url = "http://packages.ros.org/cgi-bin/gen_rosinstall.py?rosdistro=electric&variant=ros-base&overlay=no" yaml_elements = get_yaml_from_uri(url) self.assertTrue(ros_found_in_yaml(yaml_elements), "No ros element in %s"%url)
def test_get_yaml_from_uri_from_url(self): url = "http://packages.ros.org/web/rosinstall/generate/raw/groovy/ros-base" yaml_elements = get_yaml_from_uri(url) self.assertTrue(ros_found_in_yaml(yaml_elements), "No ros element in %s"%url)
def test_get_yaml_from_uri_from_url_fuerte(self): url = "http://packages.ros.org/cgi-bin/gen_rosinstall.py?rosdistro=fuerte&variant=desktop-full&overlay=no" yaml_elements = get_yaml_from_uri(url) self.assertTrue(yaml_elements is not None) self.assertTrue(len(yaml_elements) > 0, "No elements in %s"%url) self.assertTrue(self._ros_found(yaml_elements), "No ros element in %s from %s"%(yaml_elements, url))
def test_get_yaml_from_uri_from_url(self): url = "http://packages.ros.org/cgi-bin/gen_rosinstall.py?rosdistro=electric&variant=ros-base&overlay=no" yaml_elements = get_yaml_from_uri(url) self.assertTrue(ros_found_in_yaml(yaml_elements), "No ros element in %s" % url)