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 \ filenames = [join(xmlfolder, filename) for filename in listdir(xmlfolder) if \
filename.endswith('.xml')] filename.endswith('.xml')]
filenames.sort() filenames.sort()
if not filenames:
raise DictConsistencyError(_('there is no XML file'), 77, [xmlfolder])
for xmlfile in filenames: for xmlfile in filenames:
try: try:
document = parse(xmlfile) document = parse(xmlfile)

View file

View file

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