def test__Manifest(self): from roslib.manifestlib import _Manifest m = _Manifest() # check defaults self.assertEquals('package', m._type) m = _Manifest('stack') self.assertEquals('stack', m._type)
def test_Manifest_xml(self): from roslib.manifestlib import parse, _Manifest m = _Manifest() parse(m, EXAMPLE1) self._subtest_parse_example1(m) # verify roundtrip m2 = _Manifest() parse(m2, m.xml()) self._subtest_parse_example1(m2)
def test_parse_example1_file(self): from roslib.manifestlib import parse_file, _Manifest p = os.path.join(roslib.packages.get_pkg_dir('test_roslib'), 'test', 'manifest_tests', 'example1.xml') self._subtest_parse_example1(parse_file(_Manifest(), p)) p = os.path.join(roslib.packages.get_pkg_dir('test_roslib'), 'test', 'manifest_tests', 'stack_example1.xml') self._subtest_parse_stack_example1(parse_file(_Manifest('stack'), p))
def test_parse_example1_file(self): from roslib.manifestlib import parse_file, _Manifest p = os.path.join(get_test_path(), 'manifest_tests', 'example1.xml') self._subtest_parse_example1(parse_file(_Manifest(), p)) p = os.path.join(get_test_path(), 'manifest_tests', 'stack_example1.xml') self._subtest_parse_stack_example1(parse_file(_Manifest('stack'), p)) p = os.path.join(get_test_path(), 'manifest_tests', 'stack_version.xml') self._subtest_parse_stack_version(parse_file(_Manifest('stack'), p))
def test_parse_bad_file(self): from roslib.manifestlib import parse_file, _Manifest, ManifestException base_p = os.path.join(get_test_path(), 'manifest_tests') m = _Manifest() for b in ['bad1.xml', 'bad2.xml', 'bad3.xml']: p = os.path.join(base_p, b) try: parse_file(m, p) self.fail("parse should have failed on bad manifest") except ManifestException, e: print str(e) self.assert_(b in str(e), "file name should be in error message [%s]"%(str(e)))
def test_parse_bad_file(self): from roslib.manifestlib import parse_file, _Manifest, ManifestException base_p = os.path.join(get_test_path(), 'manifest_tests') m = _Manifest() for b in ['bad1.xml', 'bad2.xml', 'bad3.xml']: p = os.path.join(base_p, b) try: parse_file(m, p) self.fail('parse should have failed on bad manifest') except ManifestException as e: print(str(e)) self.assert_(b in str(e), 'file name should be in error message [%s]' % (str(e)))
def test_parse_bad_file(self): from roslib.manifestlib import parse_file, _Manifest, ManifestException my_dir = roslib.packages.get_pkg_dir('test_roslib') base_p = os.path.join(my_dir, 'test', 'manifest_tests') m = _Manifest() for b in ['bad1.xml', 'bad2.xml', 'bad3.xml']: p = os.path.join(base_p, b) try: parse_file(m, p) self.fail("parse should have failed on bad manifest") except ManifestException, e: print str(e) self.assert_( b in str(e), "file name should be in error message [%s]" % (str(e)))
def test_parse_example1_string(self): from roslib.manifestlib import parse, _Manifest self._subtest_parse_stack_example1(parse(_Manifest('stack'), STACK_EXAMPLE1))
def test_Manifest_str(self): # just make sure it doesn't crash from roslib.manifestlib import parse, _Manifest str(parse(_Manifest(), EXAMPLE1))
def test_parse_example1_string(self): from roslib.manifestlib import parse, _Manifest self._subtest_parse_example1(parse(_Manifest(), EXAMPLE1)) self._subtest_parse_stack_example1( parse(_Manifest('stack'), STACK_EXAMPLE1))