do not allow empty XML directory

This commit is contained in:
Emmanuel Garette 2021-09-13 11:26:38 +02:00
parent f18a53d61a
commit e75965fad2
4 changed files with 3 additions and 1 deletions

View File

@ -65,6 +65,8 @@ class XMLReflector:
filenames = [join(xmlfolder, filename) for filename in listdir(xmlfolder) if \
filename.endswith('.xml')]
filenames.sort()
if not filenames:
raise DictConsistencyError(_('there is no XML file'), 77, [xmlfolder])
for xmlfile in filenames:
try:
document = parse(xmlfile)

View File

View File

@ -54,7 +54,7 @@ def launch_test(test_dir):
except Exception as err:
# import traceback
# traceback.print_exc()
print(f'cannot convert {test_dir}: {err}')
# print(f'cannot convert {test_dir}: {err}')
rmtree(new_dest_dir)
copytree(test_dir, new_dest_dir)
return