def WebSubmitFileConverterTestGenerator(): from invenio.websubmit_file_converter import get_conversion_map, can_convert if can_convert(".odt", ".txt"): ## Special test for unoconv/LibreOffice yield WebSubmitFileConverterTest( os.path.join(CFG_PREFIX, "lib", "webtest", "invenio", "test.odt"), ".odt", ".txt" ) if can_convert(".doc", ".txt"): ## Special test for unoconv/LibreOffice yield WebSubmitFileConverterTest( os.path.join(CFG_PREFIX, "lib", "webtest", "invenio", "test.doc"), ".doc", ".txt" ) for from_format in get_conversion_map().keys(): input_file = os.path.join(CFG_PREFIX, "lib", "webtest", "invenio", "test%s" % from_format) if not os.path.exists(input_file): ## Can't run such a test because there is no test example continue for to_format in get_conversion_map().keys(): if from_format == to_format: continue conversion_map = can_convert(from_format, to_format) if conversion_map: if [converter for converter in conversion_map if converter[0].__name__ == "unoconv"]: ## We don't want to test unoconv which is tested separately continue yield WebSubmitFileConverterTest(input_file, from_format, to_format)
def WebSubmitFileConverterTestGenerator(): from invenio.websubmit_file_converter import get_conversion_map, can_convert if can_convert('.odt', '.txt'): ## Special test for unoconv/LibreOffice yield WebSubmitFileConverterTest( os.path.join(CFG_PREFIX, 'lib', 'webtest', 'invenio', 'test.odt'), '.odt', '.txt') if can_convert('.doc', '.txt'): ## Special test for unoconv/LibreOffice yield WebSubmitFileConverterTest( os.path.join(CFG_PREFIX, 'lib', 'webtest', 'invenio', 'test.doc'), '.doc', '.txt') for from_format in get_conversion_map().keys(): input_file = os.path.join(CFG_PREFIX, 'lib', 'webtest', 'invenio', 'test%s' % from_format) if not os.path.exists(input_file): ## Can't run such a test because there is no test example continue for to_format in get_conversion_map().keys(): if from_format == to_format: continue conversion_map = can_convert(from_format, to_format) if conversion_map: if [ converter for converter in conversion_map if converter[0].__name__ == 'unoconv' ]: ## We don't want to test unoconv which is tested separately continue yield WebSubmitFileConverterTest(input_file, from_format, to_format)
def WebSubmitFileConverterTestGenerator(): from invenio.websubmit_file_converter import get_conversion_map, can_convert for from_format in get_conversion_map().keys(): input_file = os.path.join(CFG_PREFIX, 'lib', 'webtest', 'invenio', 'test%s' % from_format) if not os.path.exists(input_file): ## Can't run such a test because there is no test example continue for to_format in get_conversion_map().keys(): if from_format == to_format: continue if not can_convert(from_format, to_format): continue yield WebSubmitFileConverterTest(input_file, from_format, to_format)