Specify src path for isort. (#8867)

This commit is contained in:
Jiaming Yuan
2023-03-06 17:30:27 +08:00
committed by GitHub
parent 4d665b3fb0
commit 6a892ce281
37 changed files with 59 additions and 48 deletions

View File

@@ -3,12 +3,15 @@ import os
import subprocess
import sys
from multiprocessing import Pool, cpu_count
from typing import Dict, Tuple
from typing import Dict, Optional, Tuple
from pylint import epylint
from test_utils import PY_PACKAGE, ROOT, cd, print_time, record_time
CURDIR = os.path.normpath(os.path.abspath(os.path.dirname(__file__)))
SRCPATH = os.path.normpath(
os.path.join(CURDIR, os.path.pardir, os.path.pardir, "python-package")
)
@record_time
@@ -29,7 +32,7 @@ Please run the following command on your machine to address the formatting error
@record_time
def run_isort(rel_path: str) -> bool:
cmd = ["isort", "--check", "--profile=black", rel_path]
cmd = ["isort", f"--src={SRCPATH}", "--check", "--profile=black", rel_path]
ret = subprocess.run(cmd).returncode
if ret != 0:
subprocess.run(["isort", "--version"])