Since not long ago, an attempt of running pytest test/functorch/test_vmap.py -v ends up in an error:
File "/opt/pytorch/pytorch/test/functorch/test_vmap.py", line 6579, in <module>
instantiate_device_type_tests(TestVmapOperatorsOpInfo, globals(), only_for=only_for)
File "/usr/local/lib/python3.12/dist-packages/torch/testing/_internal/common_device_type.py", line 1074, in instantiate_device_type_tests
device_type_test_class.instantiate_test(
File "/usr/local/lib/python3.12/dist-packages/torch/testing/_internal/common_device_type.py", line 634, in instantiate_test
instantiate_test_helper(
File "/usr/local/lib/python3.12/dist-packages/torch/testing/_internal/common_device_type.py", line 540, in instantiate_test_helper
test = decorator(test)
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/torch/testing/_internal/opinfo/core.py", line 1713, in __call__
raise RuntimeError("Multiple sets of sample_skips_and_xfails defined")
RuntimeError: Multiple sets of sample_skips_and_xfails defined
================================================================================== short test summary info ===================================================================================
ERROR ../opt/pytorch/pytorch/test/functorch/test_vmap.py - RuntimeError: Multiple sets of sample_skips_and_xfails defined
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
====================================================================================== 1 error in 3.91s ======================================================================================
due to test_vmap_exhaustive having multiple decorators skipIf and xfailIf from test/functorch/common_utils.py. Both of these rely on sample_skips_and_xfails:
https://github.com/pytorch/pytorch/blob/d3ce23d75ee5e488787aafb12c281b5142d91e75/test/functorch/common_utils.py#L481-L497
Though, using a mix of these on a certain test end up in the RuntimeError:
https://github.com/pytorch/pytorch/blob/d3ce23d75ee5e488787aafb12c281b5142d91e75/torch/testing/_internal/opinfo/core.py#L1713
This PR proposes appending the rules, as this simplifies the usage of sample_skips_and_xfails.
Fixes #184894
Pull Request resolved: #185905
Approved by: https://github.com/benjaminglass1, https://github.com/eqy
SOCIAL SHARE CARD GENERATOR