fix: запускать .sh-скрипты через sh на Windows в test-deps
Skeleton contracts / contracts (pull_request) Failing after 34s
Skeleton contracts / contracts (pull_request) Failing after 34s
Co-authored-by: aider (deepseek/deepseek-chat) <aider@aider.chat>
This commit is contained in:
@@ -8,6 +8,7 @@ import argparse
|
|||||||
import base64
|
import base64
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
@@ -30,11 +31,24 @@ BASE_URL = (_args.base_url or os.environ.get("BASE_URL") or "http://localhost:80
|
|||||||
ROOT = Path(__file__).resolve().parents[1]
|
ROOT = Path(__file__).resolve().parents[1]
|
||||||
|
|
||||||
|
|
||||||
|
def _script_command(full: Path) -> list[str]:
|
||||||
|
"""Windows не умеет запускать .sh напрямую — вызываем через sh (Git Bash/WSL)."""
|
||||||
|
if os.name == "nt":
|
||||||
|
sh = shutil.which("sh") or shutil.which("bash")
|
||||||
|
if not sh:
|
||||||
|
raise unittest.SkipTest(
|
||||||
|
"sh/bash not found in PATH; install Git for Windows or run under WSL"
|
||||||
|
)
|
||||||
|
return [sh, str(full)]
|
||||||
|
return [str(full)]
|
||||||
|
|
||||||
|
|
||||||
def run_script(path):
|
def run_script(path):
|
||||||
full = (ROOT / path).resolve()
|
full = (ROOT / path).resolve()
|
||||||
if not full.is_file():
|
if not full.is_file():
|
||||||
raise unittest.SkipTest("script not found: " + str(full))
|
raise unittest.SkipTest("script not found: " + str(full))
|
||||||
proc = subprocess.run([str(full)], cwd=str(ROOT), capture_output=True, timeout=120)
|
cmd = _script_command(full)
|
||||||
|
proc = subprocess.run(cmd, cwd=str(ROOT), capture_output=True, timeout=120)
|
||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
"script failed: " + path + " rc=" + str(proc.returncode)
|
"script failed: " + path + " rc=" + str(proc.returncode)
|
||||||
|
|||||||
Reference in New Issue
Block a user