Third party stubtest: Print time per distribution (#13547)

This commit is contained in:
Sebastian Rittau
2025-02-26 21:44:10 +01:00
committed by GitHub
parent 527d724bf4
commit 915a348bfa
3 changed files with 14 additions and 0 deletions
+4
View File
@@ -72,6 +72,10 @@ def print_divider() -> None:
print()
def print_time(t: float) -> None:
print(f"({t:.2f} s) ", end="")
# ====================================================================
# Dynamic venv creation
# ====================================================================
+2
View File
@@ -112,6 +112,8 @@ ignore = [
###
# We're not a library, no need to document everything
"D1", # Missing docstring in ...
# Sometimes, an extra blank line is more readable
"D202", # No blank lines allowed after function docstring
# Doesn't support split "summary line"
"D205", # 1 blank line required between summary line and description
# Used for direct, non-subclass type comparison, for example: `type(val) is str`
+8
View File
@@ -12,6 +12,7 @@ import tempfile
from pathlib import Path
from shutil import rmtree
from textwrap import dedent
from time import time
from typing import NoReturn
from ts_utils.metadata import NoSuchStubError, get_recursive_requirements, read_metadata
@@ -25,6 +26,7 @@ from ts_utils.utils import (
print_error,
print_info,
print_success_msg,
print_time,
)
@@ -36,6 +38,8 @@ def run_stubtest(
specified_platforms_only: bool = False,
keep_tmp_dir: bool = False,
) -> bool:
"""Run stubtest for a single distribution."""
dist_name = dist.name
try:
metadata = read_metadata(dist_name)
@@ -43,6 +47,8 @@ def run_stubtest(
parser.error(str(e))
print(f"{dist_name}... ", end="", flush=True)
t = time()
stubtest_settings = metadata.stubtest_settings
if stubtest_settings.skip:
print(colored("skipping", "yellow"))
@@ -136,6 +142,7 @@ def run_stubtest(
try:
subprocess.run(stubtest_cmd, env=stubtest_env, check=True, capture_output=True)
except subprocess.CalledProcessError as e:
print_time(time() - t)
print_error("fail")
print_divider()
@@ -175,6 +182,7 @@ def run_stubtest(
return False
else:
print_time(time() - t)
print_success_msg()
if keep_tmp_dir:
print_info(f"Virtual environment kept at: {venv_dir}")