1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
"""
Test that -d/--debug enable dumping of unexpected exceptions
"""
import os
from drivers.alr import prepare_env, prepare_indexes, run_alr
from drivers.asserts import assert_eq, assert_match
def check_output(dump):
assert_match(
'''stderr: PROGRAM_ERROR
stderr: Raising forcibly
stderr: raised PROGRAM_ERROR : Raising forcibly.*
''', dump)
# Check debug dump (we intentionally disable debug flag in run_alr)
check_output(run_alr('-d', 'dev', '--raise',
debug=False, complain_on_error=False).out)
# Long flag version
check_output(run_alr('--debug', 'dev', '--raise',
debug=False, complain_on_error=False).out)
# Check ordinary non-debug output:
assert_eq(run_alr('dev', '--raise', debug=False, complain_on_error=False).out,
"ERROR: Raising forcibly\n"
"ERROR: alr encountered an unexpected error, re-run with -d for details.\n")
print('SUCCESS')
|