pytorch/tools/testing/target_determination/gen_artifact.py
Xuehai Pan 45411d1fc9 Use absolute path path.resolve() -> path.absolute() (#129409)
Changes:

1. Always explicit `.absolute()`: `Path(__file__)` -> `Path(__file__).absolute()`
2. Replace `path.resolve()` with `path.absolute()` if the code is resolving the PyTorch repo root directory.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/129409
Approved by: https://github.com/albanD
2025-01-03 20:03:40 +00:00

16 lines
432 B
Python

from __future__ import annotations
import json
import os
from pathlib import Path
from typing import Any
REPO_ROOT = Path(__file__).absolute().parents[3]
def gen_ci_artifact(included: list[Any], excluded: list[Any]) -> None:
file_name = f"td_exclusions-{os.urandom(10).hex()}.json"
with open(REPO_ROOT / "test" / "test-reports" / file_name, "w") as f:
json.dump({"included": included, "excluded": excluded}, f)