mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 00:21:07 +01:00
Summary: Applies new import merging and sorting from µsort v1.0. When merging imports, µsort will make a best-effort to move associated comments to match merged elements, but there are known limitations due to the diynamic nature of Python and developer tooling. These changes should not produce any dangerous runtime changes, but may require touch-ups to satisfy linters and other tooling. Note that µsort uses case-insensitive, lexicographical sorting, which results in a different ordering compared to isort. This provides a more consistent sorting order, matching the case-insensitive order used when sorting import statements by module name, and ensures that "frog", "FROG", and "Frog" always sort next to each other. For details on µsort's sorting and merging semantics, see the user guide: https://usort.readthedocs.io/en/stable/guide.html#sorting Test Plan: S271899 Reviewed By: lisroach Differential Revision: D36402110 Pull Request resolved: https://github.com/pytorch/pytorch/pull/78973 Approved by: https://github.com/osalpekar
26 lines
783 B
Python
26 lines
783 B
Python
import subprocess
|
|
|
|
from ..util.setting import TestPlatform
|
|
from ..util.utils import print_error
|
|
|
|
|
|
def run_cpp_test(binary_file: str) -> None:
|
|
# cpp test binary
|
|
try:
|
|
subprocess.check_call(binary_file)
|
|
except subprocess.CalledProcessError:
|
|
print_error(f"Binary failed to run: {binary_file}")
|
|
|
|
|
|
def get_tool_path_by_platform(platform: TestPlatform) -> str:
|
|
if platform == TestPlatform.FBCODE:
|
|
from caffe2.fb.code_coverage.tool.package.fbcode.utils import ( # type: ignore[import]
|
|
get_llvm_tool_path,
|
|
)
|
|
|
|
return get_llvm_tool_path() # type: ignore[no-any-return]
|
|
else:
|
|
from ..oss.utils import get_llvm_tool_path # type: ignore[no-redef]
|
|
|
|
return get_llvm_tool_path() # type: ignore[no-any-return]
|