Skip to content

Commit

Permalink
Merge pull request #5296 from microDev1/traceback
Browse files Browse the repository at this point in the history
Add test for `traceback` module
  • Loading branch information
gamblor21 authored Sep 3, 2021
2 parents d88361c + 7dbf750 commit 69e7b8b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/circuitpython/traceback_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
try:
import traceback
except ImportError:
print("SKIP")
raise SystemExit


def fun():
raise Exception("test")


try:
fun()
except Exception as exc:
print("\nNo Trace:")
traceback.print_exception(None, exc, None)
print("\nDefault Trace:")
traceback.print_exception(None, exc, exc.__traceback__)
print("\nLimit=1 Trace:")
traceback.print_exception(None, exc, exc.__traceback__, limit=1)
print("\nLimit=0 Trace:")
traceback.print_exception(None, exc, exc.__traceback__, limit=0)
print("\nLimit=-1 Trace:")
traceback.print_exception(None, exc, exc.__traceback__, limit=-1)
print("")

0 comments on commit 69e7b8b

Please sign in to comment.