wikiparser: Exit with return value 1 on test failure

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
James Valleroy 2020-10-21 19:50:49 -04:00 committed by Sunil Mohan Adapa
parent 53921be1b8
commit 085e3ffef3
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -6,6 +6,7 @@ MoinMoin wiki parser
import logging
import re
import sys
import urllib
from enum import Enum
from pathlib import Path
@ -2060,7 +2061,9 @@ if __name__ == '__main__':
if not arguments.skip_tests:
# Make tests verbose if no input files given
verbose = not arguments.input
doctest.testmod(verbose=verbose)
num_failed = doctest.testmod(verbose=verbose)[0]
if num_failed > 0:
sys.exit(1)
for in_file in arguments.input:
with in_file.open() as wiki_file: