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)))