Skip to content

Commit

Permalink
Raise original exception when test hits codemod.TransformFailure
Browse files Browse the repository at this point in the history
Otherwise it's very hard to tell why the test failed.
  • Loading branch information
kit1980 authored Mar 11, 2024
1 parent 8846f5c commit 5cc186a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/test_torchfix.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def _codemod_results(source_path):
config = TorchCodemodConfig(select=list(GET_ALL_ERROR_CODES()))
context = TorchCodemod(codemod.CodemodContext(filename=source_path), config)
new_module = codemod.transform_module(context, code)
if isinstance(new_module, codemod.TransformFailure):
raise new_module.error
return new_module.code


Expand Down

0 comments on commit 5cc186a

Please sign in to comment.