Skip to content

Commit

Permalink
ignore py313 changes to stack trace (error indicators ----^^^^^) and …
Browse files Browse the repository at this point in the history
…remove py2 specifc stack normalization
  • Loading branch information
mahmoud committed Nov 3, 2024
1 parent 920c13c commit 783d41c
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions glom/test/test_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ def _norm_stack(formatted_stack, exc):

normalized = []
for line in formatted_stack.splitlines():
if set(line.strip()) <= set('^~'):
# python 3.13 added this error indicator which isn't really useful to test
continue
if line.strip().startswith('File'):
file_name = line.split('"')[1]
short_file_name = os.path.split(file_name.strip('"'))[1]
Expand All @@ -68,16 +71,6 @@ def _norm_stack(formatted_stack, exc):

line = line.rstrip() # trailing whitespace shouldn't matter

# qualify python2's unqualified error type names
exc_type_name = exc.__class__.__name__
if exc_type_name in line:
mod_name = str(getattr(exc.__class__, '__module__', '') or '')
exc_type_qual_name = exc_type_name
if 'builtin' not in mod_name:
exc_type_qual_name = mod_name + '.' + exc_type_name
if exc_type_qual_name not in line:
line = line.replace(exc_type_name, exc_type_qual_name)

normalized.append(line)

stack = "\n".join(normalized) + '\n'
Expand Down

0 comments on commit 783d41c

Please sign in to comment.