From 75c10d596a8b7aa48a7a5d1c1ce42eb81a19b864 Mon Sep 17 00:00:00 2001 From: Tully Foote Date: Tue, 26 Oct 2010 21:07:14 +0000 Subject: [PATCH] to ros_comm --- test/test_rosdep/CMakeLists.txt | 34 ---- test/test_rosdep/Makefile | 1 - test/test_rosdep/mainpage.dox | 30 ---- test/test_rosdep/manifest.xml | 20 --- test/test_rosdep/test/example_rosdep.yaml | 14 -- .../test/example_rosdep_conflicting.yaml | 8 - test/test_rosdep/test/invalid_rosdep.yaml | 14 -- .../test/test_rosdep_commandline.py | 63 ------- test/test_rosdep/test/test_rosdep_core.py | 161 ------------------ .../test/test_rosdep_yaml_cache.py | 151 ---------------- 10 files changed, 496 deletions(-) delete mode 100644 test/test_rosdep/CMakeLists.txt delete mode 100644 test/test_rosdep/Makefile delete mode 100644 test/test_rosdep/mainpage.dox delete mode 100644 test/test_rosdep/manifest.xml delete mode 100644 test/test_rosdep/test/example_rosdep.yaml delete mode 100644 test/test_rosdep/test/example_rosdep_conflicting.yaml delete mode 100644 test/test_rosdep/test/invalid_rosdep.yaml delete mode 100644 test/test_rosdep/test/test_rosdep_commandline.py delete mode 100644 test/test_rosdep/test/test_rosdep_core.py delete mode 100644 test/test_rosdep/test/test_rosdep_yaml_cache.py diff --git a/test/test_rosdep/CMakeLists.txt b/test/test_rosdep/CMakeLists.txt deleted file mode 100644 index 7e71a7a8..00000000 --- a/test/test_rosdep/CMakeLists.txt +++ /dev/null @@ -1,34 +0,0 @@ -cmake_minimum_required(VERSION 2.4.6) -include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake) - -# Set the build type. Options are: -# Coverage : w/ debug symbols, w/o optimization, w/ code-coverage -# Debug : w/ debug symbols, w/o optimization -# Release : w/o debug symbols, w/ optimization -# RelWithDebInfo : w/ debug symbols, w/ optimization -# MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries -#set(ROS_BUILD_TYPE RelWithDebInfo) - -rosbuild_init() - -#set the default path for built executables to the "bin" directory -set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) -#set the default path for built libraries to the "lib" directory -set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) - -#uncomment if you have defined messages -#rosbuild_genmsg() -#uncomment if you have defined services -#rosbuild_gensrv() - -#common commands for building c++ executables and libraries -#rosbuild_add_library(${PROJECT_NAME} src/example.cpp) -#target_link_libraries(${PROJECT_NAME} another_library) -#rosbuild_add_boost_directories() -#rosbuild_link_boost(${PROJECT_NAME} thread) -#rosbuild_add_executable(example examples/example.cpp) -#target_link_libraries(example ${PROJECT_NAME}) - -rosbuild_add_pyunit(test/test_rosdep_core.py) -rosbuild_add_pyunit(test/test_rosdep_commandline.py) -rosbuild_add_pyunit(test/test_rosdep_yaml_cache.py) diff --git a/test/test_rosdep/Makefile b/test/test_rosdep/Makefile deleted file mode 100644 index b75b928f..00000000 --- a/test/test_rosdep/Makefile +++ /dev/null @@ -1 +0,0 @@ -include $(shell rospack find mk)/cmake.mk \ No newline at end of file diff --git a/test/test_rosdep/mainpage.dox b/test/test_rosdep/mainpage.dox deleted file mode 100644 index 9462450b..00000000 --- a/test/test_rosdep/mainpage.dox +++ /dev/null @@ -1,30 +0,0 @@ -/** -\mainpage -\htmlinclude manifest.html - -\b test_rosdep is ... - - - - -\section codeapi Code API - - - - -*/ \ No newline at end of file diff --git a/test/test_rosdep/manifest.xml b/test/test_rosdep/manifest.xml deleted file mode 100644 index 25641d36..00000000 --- a/test/test_rosdep/manifest.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - test_rosdep - - - Tully Foote - BSD - - http://ros.org/wiki/test_rosdep - - - - - - - - - - diff --git a/test/test_rosdep/test/example_rosdep.yaml b/test/test_rosdep/test/example_rosdep.yaml deleted file mode 100644 index dbe6fe42..00000000 --- a/test/test_rosdep/test/example_rosdep.yaml +++ /dev/null @@ -1,14 +0,0 @@ -rosdep_test: - rosdep_test_os: - 9.10: librosdep_test1.40-all-dev - rosdep_test_version: librosdep_test1.37-dev - 8.10: | - this is a script -zlib: - rosdep_test_os: zlib1g-dev - debian: zlib1g-dev -other_rosdep_test: - rosdep_test_os: - other_version: foo -no_os_rosdep_test: - other_os: not_useful \ No newline at end of file diff --git a/test/test_rosdep/test/example_rosdep_conflicting.yaml b/test/test_rosdep/test/example_rosdep_conflicting.yaml deleted file mode 100644 index 7376d750..00000000 --- a/test/test_rosdep/test/example_rosdep_conflicting.yaml +++ /dev/null @@ -1,8 +0,0 @@ -rosdep_test: - rosdep_test_os: - 9.10: librosdep_test1.40-all-dev - rosdep_test_version: not-librosdep_test1.37-dev - 8.10: | - this is a script -otherlib: - rosdep_test_os: package_name diff --git a/test/test_rosdep/test/invalid_rosdep.yaml b/test/test_rosdep/test/invalid_rosdep.yaml deleted file mode 100644 index 9f9a7e3b..00000000 --- a/test/test_rosdep/test/invalid_rosdep.yaml +++ /dev/null @@ -1,14 +0,0 @@ -rosdep_test: - rosdep_test_os: - 9.10: librosdep_test1.40-all-dev - rosdep_test_version: librosdep_test1.37-dev - 8.10: | - this is a script -zlib: - rosdep_test_os: zlib1g-dev - debian: zlib1g-dev -other_rosdep_test: - rosdep_test_os: - other_version: foo -no_os_rosdep_test: - { \ No newline at end of file diff --git a/test/test_rosdep/test/test_rosdep_commandline.py b/test/test_rosdep/test/test_rosdep_commandline.py deleted file mode 100644 index 2e2cac16..00000000 --- a/test/test_rosdep/test/test_rosdep_commandline.py +++ /dev/null @@ -1,63 +0,0 @@ -# Software License Agreement (BSD License) -# -# Copyright (c) 2009, Willow Garage, Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# * Neither the name of Willow Garage, Inc. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -import roslib; roslib.load_manifest('test_rosdep') - -import os -import struct -import sys -import unittest -import subprocess - -import rostest -import rosdep.core - - -class RosdepCommandlineTest(unittest.TestCase): - - def test_Rosdep_commandline_satisfy(self): - self.assertEqual(0,subprocess.call(["rosdep", "satisfy", "test_rosdep"])) - self.assertEqual(0,subprocess.call(["rosdep", "generate_bash", "test_rosdep"])) - def test_Rosdep_commandline_satisfy_y(self): - self.assertEqual(0,subprocess.call(["rosdep", "satisfy", "-y", "test_rosdep", "rosdep"])) - def test_Rosdep_commandline_satisfy_multiple(self): - self.assertEqual(0,subprocess.call(["rosdep", "satisfy", "test_rosdep", "rosdep"])) - def test_Rosdep_commandline_check(self): - self.assertEqual(0,subprocess.call(["rosdep", "check", "test_rosdep"])) - def test_Rosdep_commandline_what_needs(self): - self.assertEqual(0,subprocess.call(["rosdep", "what_needs", "boost"])) - def test_Rosdep_commandline_where_defined(self): - self.assertEqual(0,subprocess.call(["rosdep", "where_defined", "boost"])) - - -if __name__ == '__main__': - rostest.unitrun('test_rosdep', 'test_commandline', RosdepCommandlineTest, coverage_packages=['rosdep.commandline']) - diff --git a/test/test_rosdep/test/test_rosdep_core.py b/test/test_rosdep/test/test_rosdep_core.py deleted file mode 100644 index b711a417..00000000 --- a/test/test_rosdep/test/test_rosdep_core.py +++ /dev/null @@ -1,161 +0,0 @@ -# Software License Agreement (BSD License) -# -# Copyright (c) 2009, Willow Garage, Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# * Neither the name of Willow Garage, Inc. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -import roslib; roslib.load_manifest('test_rosdep') - -import os -import struct -import sys -import unittest - -import rostest -import rosdep.core - -class RosdepCoreTest(unittest.TestCase): - def test_RosdepLookupPackage_parse_yaml_package(self): - rdlp = rosdep.core.RosdepLookupPackage("rosdep_test_os", "rosdep_test_version", "test_rosdep", rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version")) - yaml_map = rdlp.parse_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"),"test", "example_rosdep.yaml")) - rdlp.insert_map(yaml_map, "example_yaml_path", False) - output = rdlp.lookup_rosdep("rosdep_test") - self.assertEqual("librosdep_test1.37-dev", output) - output = rdlp.lookup_rosdep("foobar") - self.assertEqual(False, output) - - - def test_RosdepLookupPackage_parse_yaml_package_override(self): - rdlp = rosdep.core.RosdepLookupPackage("rosdep_test_os", "rosdep_test_version", "test_rosdep", rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version")) - yaml_map = rdlp.parse_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"),"test", "example_rosdep.yaml")) - rdlp.insert_map(yaml_map, "example_yaml_path", False) - rdlp.insert_map(yaml_map, "example_yaml_path2", True) - output = rdlp.lookup_rosdep("rosdep_test") - self.assertEqual("librosdep_test1.37-dev", output) - output = rdlp.lookup_rosdep("foobar") - self.assertEqual(False, output) - - - def test_RosdepLookupPackage_parse_yaml_package_collision_pass(self): - rdlp = rosdep.core.RosdepLookupPackage("rosdep_test_os", "rosdep_test_version", "test_rosdep", rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version")) - yaml_map = rdlp.parse_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"),"test", "example_rosdep.yaml")) - rdlp.insert_map(yaml_map, "example_yaml_path", False) - rdlp.insert_map(yaml_map, "example_yaml_path2", False) - output = rdlp.lookup_rosdep("rosdep_test") - self.assertEqual("librosdep_test1.37-dev", output) - output = rdlp.lookup_rosdep("foobar") - self.assertEqual(False, output) - - - def test_RosdepLookupPackage_parse_yaml_package_collision_fail(self): - rdlp = rosdep.core.RosdepLookupPackage("rosdep_test_os", "rosdep_test_version", "test_rosdep", rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version")) - yaml_map = rdlp.parse_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"),"test", "example_rosdep.yaml")) - rdlp.insert_map(yaml_map, "example_yaml_path", False) - yaml_map = rdlp.parse_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"),"test", "example_rosdep_conflicting.yaml")) - self.assertRaises(rosdep.core.RosdepException, rdlp.insert_map, yaml_map, "example_yaml_path2", False) - - def test_RosdepLookupPackage_parse_yaml_package_collision_override(self): - rdlp = rosdep.core.RosdepLookupPackage("rosdep_test_os", "rosdep_test_version", "test_rosdep", rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version")) - yaml_map = rdlp.parse_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"),"test", "example_rosdep.yaml")) - rdlp.insert_map(yaml_map, "example_yaml_path", False) - yaml_map = rdlp.parse_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"),"test", "example_rosdep_conflicting.yaml")) - rdlp.insert_map(yaml_map, "example_yaml_path2", True) - output = rdlp.lookup_rosdep("rosdep_test") - self.assertEqual("not-librosdep_test1.37-dev", output) - output = rdlp.lookup_rosdep("foobar") - self.assertEqual(False, output) - - def test_RosdepLookupPackage_get_sources(self): - rdlp = rosdep.core.RosdepLookupPackage("rosdep_test_os", "rosdep_test_version", "test_rosdep", rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version")) - - sources = rdlp.get_sources("rosdep_test") - self.assertEqual([], sources) - - yaml_map = rdlp.parse_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"),"test", "example_rosdep.yaml")) - rdlp.insert_map(yaml_map, "example_yaml_path", False) - rdlp.insert_map(yaml_map, "example_yaml_path2", False) - - sources = rdlp.get_sources("rosdep_test") - self.assertEqual(["example_yaml_path", "example_yaml_path2"], sources) - - sources = rdlp.get_sources("undefined") - self.assertEqual([], sources) - - def test_RosdepLookupPackage_get_map(self): - rdlp = rosdep.core.RosdepLookupPackage("rosdep_test_os", "rosdep_test_version", "test_rosdep", rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version")) - - - yaml_map = rdlp.parse_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"),"test", "example_rosdep.yaml")) - rdlp.insert_map(yaml_map, "example_yaml_path", False) - parsed_output = {'zlib': 'zlib1g-dev', 'rosdep_test': 'librosdep_test1.37-dev'} - self.assertEqual(parsed_output, rdlp.get_map()) - - rdlp.insert_map(yaml_map, "example_yaml_path2", False) - self.assertEqual(parsed_output, rdlp.get_map()) - - def test_RosdepLookupPackage_failed_version_lookup(self): - rdlp = rosdep.core.RosdepLookupPackage("rosdep_test_os", "rosdep_test_version", "test_rosdep", rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version")) - yaml_map = rdlp.parse_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"),"test", "example_rosdep.yaml")) - rdlp.insert_map(yaml_map, "example_yaml_path", False) - output = rdlp.lookup_rosdep("other_rosdep_test") - self.assertEqual(output, False) - - def test_RosdepLookupPackage_failed_os_lookup(self): - rdlp = rosdep.core.RosdepLookupPackage("rosdep_test_os", "rosdep_test_version", "test_rosdep", rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version")) - yaml_map = rdlp.parse_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"),"test", "example_rosdep.yaml")) - rdlp.insert_map(yaml_map, "example_yaml_path", False) - output = rdlp.lookup_rosdep("no_os_rosdep_test") - self.assertEqual(output, False) - - def test_Rosdep_tripwire_robust(self): - rd = rosdep.core.Rosdep(["rosdep"], "rosdep", robust=True) - try: - rd.check() - rd.what_needs(["boost"]) - rd.depdb(['rosdep']) - rd.where_defined(['boost']) - except: - self.fail("test Rosdep improperly Raised an exception.") - - def test_Rosdep_tripwire(self): - rd = rosdep.core.Rosdep(["rosdep"], "rosdep", robust=False) - try: - rd.check() - rd.what_needs(["boost"]) - rd.depdb(['rosdep']) - rd.where_defined(['boost']) - except: - self.fail("test Rosdep improperly Raised an exception.") - - - - -if __name__ == '__main__': - os.environ["ROSDEP_TEST_OS"] = "rosdep_test_os" - rostest.unitrun('test_rosdep', 'test_core', RosdepCoreTest, coverage_packages=['rosdep.core']) - diff --git a/test/test_rosdep/test/test_rosdep_yaml_cache.py b/test/test_rosdep/test/test_rosdep_yaml_cache.py deleted file mode 100644 index b44aeee9..00000000 --- a/test/test_rosdep/test/test_rosdep_yaml_cache.py +++ /dev/null @@ -1,151 +0,0 @@ -# Software License Agreement (BSD License) -# -# Copyright (c) 2009, Willow Garage, Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# * Neither the name of Willow Garage, Inc. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -import roslib; roslib.load_manifest('test_rosdep') - -import os -import struct -import sys -import unittest - -import rostest -import rosdep.core - - -class RosdepYamlCacheTest(unittest.TestCase): - def test_YamlCache_init(self): - yc = rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version") - - def test_YamlCache_get_yaml(self): - yc = rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version") - yaml_dict = yc.get_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"), "test", "example_rosdep.yaml")) - - yaml_truth = {'other_rosdep_test': - {'rosdep_test_os': - {'other_version': 'foo'} - }, - 'no_os_rosdep_test': - {'other_os': 'not_useful' - }, - 'zlib': - {'rosdep_test_os': 'zlib1g-dev', - 'debian': 'zlib1g-dev' - }, - 'rosdep_test': - {'rosdep_test_os': - {'rosdep_test_version': 'librosdep_test1.37-dev', - '9.10': 'librosdep_test1.40-all-dev', - '8.10': 'this is a script\n' - } - } - } - self.assertEqual(yaml_dict, yaml_truth) - - def test_YamlCache_get_yaml_repeated(self): - yc = rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version") - yaml_dict = yc.get_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"), "test", "example_rosdep.yaml")) - yaml_dict2 = yc.get_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"), "test", "example_rosdep.yaml")) - self.assertEqual(yaml_dict, yaml_dict2) - - yaml_truth = {'other_rosdep_test': - {'rosdep_test_os': - {'other_version': 'foo'} - }, - 'no_os_rosdep_test': - {'other_os': 'not_useful' - }, - 'zlib': - {'rosdep_test_os': 'zlib1g-dev', - 'debian': 'zlib1g-dev' - }, - 'rosdep_test': - {'rosdep_test_os': - {'rosdep_test_version': 'librosdep_test1.37-dev', - '9.10': 'librosdep_test1.40-all-dev', - '8.10': 'this is a script\n' - } - } - } - self.assertEqual(yaml_dict2, yaml_truth) - - def test_YamlCache_rosstack_depends(self): ## TODO add this in a walled garden so it can be asserted as being equal to something specific - yc = rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version") - depends = yc.get_rosstack_depends("ros") - depends2 = yc.get_rosstack_depends("ros") - self.assertEqual(depends, depends2) - - def test_YamlCache_no_file(self): - yc = rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version") - self.assertEqual({}, yc.get_yaml("non_extant_rosdep.yaml")) - - def test_YamlCache_parse_failure(self): - yc = rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version") - self.assertEqual({}, yc.get_yaml(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"), "test", "invalid_rosdep.yaml"))) - - def test_YamlCache_get_specific_rosdeps(self): - yc = rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version") - yaml_dict = yc.get_specific_rosdeps(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"), "test", "example_rosdep.yaml")) - - yaml_truth = { - 'zlib': 'zlib1g-dev', - 'rosdep_test':'librosdep_test1.37-dev', - } - self.assertEqual(yaml_dict, yaml_truth) - - def test_YamlCache_get_specific_rosdeps_repeated(self): - yc = rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version") - yaml_dict = yc.get_specific_rosdeps(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"), "test", "example_rosdep.yaml")) - yaml_dict2 = yc.get_specific_rosdeps(os.path.join(roslib.packages.get_pkg_dir("test_rosdep"), "test", "example_rosdep.yaml")) - self.assertEqual(yaml_dict, yaml_dict2) - - yaml_truth = { - 'zlib': 'zlib1g-dev', - 'rosdep_test':'librosdep_test1.37-dev', - } - self.assertEqual(yaml_dict2, yaml_truth) - - def test_RosdepLookupPackage_get_os_from_yaml(self): - yc = rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version") - yaml_os_map = {"rosdep_test_os":"one", "other":"two", "three":"three"}; - output = yc.get_os_from_yaml("rosdep_name", yaml_os_map, "source_path") - self.assertEqual("one", output) - - def test_RosdepLookupPackage_get_version_from_yaml(self): - yc = rosdep.core.YamlCache("rosdep_test_os", "rosdep_test_version") - yaml_map = {"8.04":"one", "rosdep_test_version":"two", "three":"three"}; - output = yc.get_version_from_yaml("rosdep_name", yaml_map, "source_path" ) - self.assertEqual("two", output) - - - -if __name__ == '__main__': - rostest.unitrun('test_rosdep', 'test_yaml_cache', RosdepYamlCacheTest, coverage_packages=['rosdep.core']) -