def test_validators_plist_ufo3_metainfo_successful_xml_ufolib_tests(): meta_validator = plistvalidators.MetainfoPlistValidator( ufo3_test_success_path, 3, ufo3_dir_list) xml_test_fails = meta_validator.run_xml_validation() ufolib_test_fails = meta_validator.run_ufolib_import_validation() assert isinstance(xml_test_fails, list) assert isinstance(ufolib_test_fails, list) assert len(xml_test_fails) == 0 assert len(ufolib_test_fails) == 0
def test_validators_plist_ufo3_metainfo_version_fail(capsys): meta_ufo_path = os.path.join(metainfo_test_dir_failpath, 'UFO3-VersionFail.ufo') meta_validator = plistvalidators.MetainfoPlistValidator( meta_ufo_path, 3, ufo3_dir_list) with pytest.raises(SystemExit) as pytest_wrapped_e: fail_list = meta_validator.run_ufolib_import_validation() out, err = capsys.readouterr() assert pytest_wrapped_e.type == SystemExit assert pytest_wrapped_e.value.code == 1 assert 'metainfo.plist' in out
def test_validators_plist_ufo3_metainfo_xml_fail(capsys): meta_ufo_path = os.path.join(metainfo_test_dir_failpath, 'UFO3-XMLmeta.ufo') meta_validator = plistvalidators.MetainfoPlistValidator( meta_ufo_path, 3, ufo3_dir_list) with pytest.raises(SystemExit) as pytest_wrapped_e: fail_list = meta_validator.run_xml_validation() assert len(fail_list) == 1 assert 'metainfo.plist failed XML validation' in fail_list[ 0].test_long_stdstream_string out, err = capsys.readouterr() assert pytest_wrapped_e.type == SystemExit assert pytest_wrapped_e.value.code == 1 assert 'UFO3-XMLmeta.ufo' in out assert 'metainfo.plist' in out
def test_validators_plist_ufo3_metainfo_missing_file_fail(capsys): meta_missingfile_ufo_path = os.path.join(metainfo_test_dir_failpath, 'UFO3-MissingMeta.ufo') meta_validator = plistvalidators.MetainfoPlistValidator( meta_missingfile_ufo_path, 3, ufo3_dir_list) meta_validator.run_xml_validation() # should not raise SystemExit with pytest.raises(SystemExit) as pytest_wrapped_e: fail_list = meta_validator.run_ufolib_import_validation() assert len(fail_list) == 0 out, err = capsys.readouterr() assert pytest_wrapped_e.type == SystemExit assert pytest_wrapped_e.value.code == 1 assert 'UFO3-MissingMeta.ufo' in out assert 'metainfo.plist' in out