Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #943: extend default timeout to account for github ci issues #946

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/setuptools_scm/_run_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import textwrap
import warnings
from typing import Callable
from typing import Final
from typing import Mapping
from typing import overload
from typing import Sequence
Expand All @@ -20,6 +21,11 @@
else:
BaseCompletedProcess = subprocess.CompletedProcess

# pick 40 seconds
# unfortunately github CI for windows sometimes needs
# up to 30 seconds to start a command

BROKEN_TIMEOUT: Final[int] = 40

log = _log.log.getChild("run_cmd")

Expand Down Expand Up @@ -126,7 +132,7 @@ def run(
*,
strip: bool = True,
trace: bool = True,
timeout: int = 20,
timeout: int = BROKEN_TIMEOUT,
check: bool = False,
) -> CompletedProcess:
if isinstance(cmd, str):
Expand Down Expand Up @@ -174,7 +180,7 @@ def has_command(
name: str, args: Sequence[str] = ["version"], warn: bool = True
) -> bool:
try:
p = run([name, *args], cwd=".", timeout=5)
p = run([name, *args], cwd=".", timeout=BROKEN_TIMEOUT)
if p.returncode != 0:
log.error(f"Command '{name}' returned non-zero. This is stderr:")
log.error(p.stderr)
Expand Down