mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2026-09-26 17:20:25 -04:00
* manual python 3.8 removals * poetry * pyupgrade * black * isort * manually tidy imports * work around shadowed type * catch up build network protocol files for pyupgrade changes * placate pylint * re-enable 20.04 * placate flake8
43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
from __future__ import annotations
|
|
|
|
import json
|
|
import pathlib
|
|
import subprocess
|
|
import sys
|
|
|
|
import chia._tests
|
|
|
|
build_job_matrix_path = pathlib.Path(chia._tests.__file__).with_name("build-job-matrix.py")
|
|
|
|
|
|
def run(args: list[str]) -> str:
|
|
completed_process = subprocess.run(
|
|
[sys.executable, build_job_matrix_path, *args],
|
|
check=True,
|
|
encoding="utf-8",
|
|
stdout=subprocess.PIPE,
|
|
)
|
|
return completed_process.stdout
|
|
|
|
|
|
def test() -> None:
|
|
timeouts: dict[int, dict[str, int]] = {}
|
|
|
|
multipliers = [1, 2, 3]
|
|
|
|
for multiplier in multipliers:
|
|
timeouts[multiplier] = {}
|
|
output = run(args=["--per", "directory", "--timeout-multiplier", str(multiplier)])
|
|
matrix = json.loads(output)
|
|
for entry in matrix:
|
|
timeouts[multiplier][entry["name"]] = entry["job_timeout"]
|
|
|
|
reference = timeouts[1]
|
|
|
|
for multiplier in multipliers:
|
|
if multiplier == 1:
|
|
continue
|
|
|
|
adjusted_reference = {key: value * multiplier for key, value in reference.items()}
|
|
assert timeouts[multiplier] == adjusted_reference
|