Skip to content

Commit

Permalink
suppress exceptions from test output (closes #134)
Browse files Browse the repository at this point in the history
  • Loading branch information
pseewald committed Oct 25, 2022
1 parent ce9d619 commit e1d7aa7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions fprettify/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1902,9 +1902,9 @@ def set_fprettify_logger(level):
logger.addHandler(stream_handler)


def log_exception(e, message):
def log_exception(e, message, level="exception"):
"""log an exception and a message"""
log_message(message, "exception", e.filename, e.line_nr)
log_message(message, level, e.filename, e.line_nr)


def log_message(message, level, filename, line_nr):
Expand Down
4 changes: 2 additions & 2 deletions fprettify/tests/fortrantests.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ def test_result(path, info):
FprettifyTestCase.n_success += 1
except fprettify.FprettifyParseException as e:
test_info = "parse error"
fprettify.log_exception(e, test_info)
fprettify.log_exception(e, test_info, level="warning")
test_content = test_result(example, test_info)
FprettifyTestCase.n_parsefail += 1
except fprettify.FprettifyInternalException as e:
test_info = "internal error"
fprettify.log_exception(e, test_info)
fprettify.log_exception(e, test_info, level="warning")
test_content = test_result(example, test_info)
FprettifyTestCase.n_internalfail += 1
except: # pragma: no cover
Expand Down
1 change: 0 additions & 1 deletion fprettify/tests/unittests.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
sys.stderr.detach(), encoding='UTF-8', line_buffering=True)

import fprettify
from fprettify.fparse_utils import FprettifyParseException, FprettifyInternalException
from fprettify.tests.test_common import FprettifyTestCase, RUNSCRIPT


Expand Down

0 comments on commit e1d7aa7

Please sign in to comment.