Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
0bfbabc2
Unverified
Commit
0bfbabc2
authored
Oct 12, 2022
by
Philip Meier
Committed by
GitHub
Oct 12, 2022
Browse files
cache traceback together with exceptions (#6748)
parent
11a2eeda
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
test/common_utils.py
test/common_utils.py
+8
-5
No files found.
test/common_utils.py
View file @
0bfbabc2
...
...
@@ -210,7 +210,7 @@ def cache(fn):
"""
sentinel
=
object
()
out_cache
=
{}
exc_cache
=
{}
exc_
tb_
cache
=
{}
@
functools
.
wraps
(
fn
)
def
wrapper
(
*
args
,
**
kwargs
):
...
...
@@ -220,14 +220,17 @@ def cache(fn):
if
out
is
not
sentinel
:
return
out
exc
=
exc_cache
.
get
(
key
,
sentinel
)
if
exc
is
not
sentinel
:
raise
exc
exc
_tb
=
exc_
tb_
cache
.
get
(
key
,
sentinel
)
if
exc
_tb
is
not
sentinel
:
raise
exc
_tb
[
0
].
with_traceback
(
exc_tb
[
1
])
try
:
out
=
fn
(
*
args
,
**
kwargs
)
except
Exception
as
exc
:
exc_cache
[
key
]
=
exc
# We need to cache the traceback here as well. Otherwise, each re-raise will add the internal pytest
# traceback frames anew, but they will only be removed once. Thus, the traceback will be ginormous hiding
# the actual information in the noise. See https://github.com/pytest-dev/pytest/issues/10363 for details.
exc_tb_cache
[
key
]
=
exc
,
exc
.
__traceback__
raise
exc
out_cache
[
key
]
=
out
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment