def test_main(self): try: rootdir = tempfile.mkdtemp() src_file = os.path.join(rootdir, 'package.xml') check_file = os.path.join(rootdir, 'foo.cmake') with open(src_file, 'w') as fhand: fhand.write('''<package> <name>foopack</name> <version>0.1.2</version> <description>foo</description> <maintainer email='*****@*****.**'>foo</maintainer> <license>foo</license> <run_depend>rd1</run_depend> <run_depend>rd2</run_depend> <build_depend>bd1</build_depend> <build_depend>bd2</build_depend> </package>''') main([src_file, check_file]) self.assertTrue(os.path.isfile(check_file)) with open(check_file, 'r') as fhand: contents = fhand.read() self.assertEqual( '''set(_CATKIN_CURRENT_PACKAGE "foopack") set(foopack_MAINTAINER "foo <*****@*****.**>") set(foopack_DEPRECATED "") set(foopack_VERSION "0.1.2") set(foopack_BUILD_DEPENDS "bd1" "bd2") set(foopack_RUN_DEPENDS "rd1" "rd2") set(foopack_BUILDTOOL_DEPENDS )''', contents) finally: shutil.rmtree(rootdir)
def test_main(self): try: rootdir = tempfile.mkdtemp() src_file = os.path.join(rootdir, 'package.xml') check_file = os.path.join(rootdir, 'foo.cmake') with open(src_file, 'w') as fhand: fhand.write('''<package> <name>foopack</name> <version>0.1.2</version> <description>foo</description> <maintainer email='*****@*****.**'>foo</maintainer> <license>foo</license> <run_depend>rd1</run_depend> <run_depend>rd2</run_depend> <build_depend>bd1</build_depend> <build_depend>bd2</build_depend> </package>''') main([src_file, check_file]) self.assertTrue(os.path.isfile(check_file)) with open(check_file, 'r') as fhand: contents = fhand.read() self.assertEqual('''set(_CATKIN_CURRENT_PACKAGE "foopack") set(foopack_RUN_DEPENDS "rd1" "rd2") set(foopack_VERSION "0.1.2") set(foopack_MAINTAINER "foo <*****@*****.**>") set(foopack_BUILD_DEPENDS "bd1" "bd2")''', contents) finally: shutil.rmtree(rootdir)
def test_main(self): try: rootdir = tempfile.mkdtemp() src_file = os.path.join(rootdir, 'package.xml') check_file = os.path.join(rootdir, 'foo.cmake') with open(src_file, 'w') as fhand: fhand.write('''<package> <name>foopack</name> <version>0.1.2</version> <description>foo</description> <maintainer email='*****@*****.**'>foo</maintainer> <license>foo</license> <url type="bugtracker">http://www.example.com/issues</url> <url type="repository">http://www.example.com/repo</url> <url type="website">http://www.example.com</url> <run_depend>rd1</run_depend> <run_depend>rd2</run_depend> <build_depend>bd1</build_depend> <build_depend>bd2</build_depend> </package>''') main([src_file, check_file]) self.assertTrue(os.path.isfile(check_file)) with open(check_file, 'r') as fhand: contents = fhand.read() self.assertEqual( set([ 'set(_CATKIN_CURRENT_PACKAGE "foopack")', 'set(foopack_MAINTAINER "foo <*****@*****.**>")', 'set(foopack_PACKAGE_FORMAT "1")', 'set(foopack_DEPRECATED "")', 'set(foopack_VERSION "0.1.2")', 'set(foopack_BUILD_DEPENDS "bd1" "bd2")', 'set(foopack_BUILDTOOL_DEPENDS )', 'set(foopack_BUILD_EXPORT_DEPENDS "rd1" "rd2")', 'set(foopack_BUILDTOOL_EXPORT_DEPENDS )', 'set(foopack_EXEC_DEPENDS "rd1" "rd2")', 'set(foopack_RUN_DEPENDS "rd1" "rd2")', 'set(foopack_TEST_DEPENDS )', 'set(foopack_DOC_DEPENDS )', 'set(foopack_URL_BUGTRACKER "http://www.example.com/issues")', 'set(foopack_URL_REPOSITORY "http://www.example.com/repo")', 'set(foopack_URL_WEBSITE "http://www.example.com")', ]), set(contents.splitlines())) finally: shutil.rmtree(rootdir)