Skip to content

Commit

Permalink
Fixes the exception for some IDEs like PyCharm.
Browse files Browse the repository at this point in the history
  • Loading branch information
bfloch committed Sep 6, 2019
1 parent 9740318 commit d55b4f4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/rez/tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,12 @@ def wrapper(self, *args, **kwargs):
try:
func(self, *args, **kwargs)
except AssertionError as e:
# Add the shell to the exception message
args = list(e.args)
args[0] += " (in shell '{}')".format(shell)
e.args = tuple(args)
# Add the shell to the exception message, if possible.
# In some IDEs the args do not exist at all.
if e.args:
args = list(e.args)
args[0] += " (in shell '{}')".format(shell)
e.args = tuple(args)
raise
return wrapper
return decorator
Expand Down

0 comments on commit d55b4f4

Please sign in to comment.