Skip to content

Commit

Permalink
Test for new config var
Browse files Browse the repository at this point in the history
  • Loading branch information
mosteo committed Sep 11, 2023
1 parent 92aa349 commit e82e807
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
36 changes: 36 additions & 0 deletions testsuite/tests/misc/env-traceback/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""
Check ALR_TRACEBACK_ENABLED env var
"""

import os
from drivers.alr import run_alr
from drivers.asserts import assert_eq, assert_match

def check_no_traceback():
assert_eq('ERROR: Raising forcibly\n'
'ERROR: alr encountered an unexpected error,'
' re-run with -d for details.\n',
run_alr("dev", "--raise",
debug=False, complain_on_error=False).out)


def check_traceback():
assert_match(".*0x", # appears in both symbolic and raw tracebacks
run_alr("dev", "--raise",
debug=False, complain_on_error=False).out)


# By default (no `-d` or ALR_TRACEBACK_ENABLED) we don't get a backtrace

check_no_traceback()
for val in ["", "0", "false", "no"]:
os.environ['ALR_TRACEBACK_ENABLED'] = val
check_no_traceback()

# With ALR_TRACEBACK_ENABLED we do get a backtrace

for val in ["1", "true", "yes"]:
os.environ['ALR_TRACEBACK_ENABLED'] = val
check_traceback()

print('SUCCESS')
1 change: 1 addition & 0 deletions testsuite/tests/misc/env-traceback/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
driver: python-script

0 comments on commit e82e807

Please sign in to comment.