Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 6 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

from __future__ import annotations

from typing import TYPE_CHECKING
import os
import typing as t

import pytest
from syrupy.extensions.json import JSONSnapshotExtension
from syrupy.extensions.single_file import SingleFileSnapshotExtension, WriteMode

if TYPE_CHECKING:
if t.TYPE_CHECKING:
from syrupy.assertion import SnapshotAssertion


Expand All @@ -34,5 +35,7 @@ def snapshot_yaml(snapshot: SnapshotAssertion) -> SnapshotAssertion:

@pytest.fixture(autouse=True)
def _default_serial_sync_jobs(monkeypatch: pytest.MonkeyPatch) -> None:
"""Default ``VCSPULL_JOBS=1`` so sequential CLI tests stay deterministic."""
"""Default ``VCSPULL_JOBS=1`` and a 30s sync budget for contended test hosts."""
monkeypatch.setenv("VCSPULL_JOBS", "1")
if "VCSPULL_SYNC_TIMEOUT_SECONDS" not in os.environ:
monkeypatch.setenv("VCSPULL_SYNC_TIMEOUT_SECONDS", "30")
18 changes: 13 additions & 5 deletions tests/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import json
import logging
import shutil
import subprocess
import textwrap
import typing as t
Expand All @@ -22,7 +23,12 @@

from vcspull._internal.config_reader import ConfigReader
from vcspull.cli import cli
from vcspull.cli.sync import _looks_like_branch_error, sync, update_repo
from vcspull.cli.sync import (
_looks_like_branch_error,
_resolve_repo_timeout,
sync,
update_repo,
)
from vcspull.config import (
detect_git_depth,
detect_git_shallow,
Expand Down Expand Up @@ -870,11 +876,10 @@ def test_hg_configured_remote_reaches_native_sync(
"""Loaded Mercurial paths retain pull selection and separate push URLs."""
from vcspull._internal.sync_process import run_sync_process

shutil.copytree(hg_repo.path, tmp_path / "upstream")
upstream = HgSync(url=hg_repo.url, path=tmp_path / "upstream")
upstream.obtain()
(upstream.path / "next").write_text("new upstream revision\n")
upstream.run(["add", "next"])
upstream.run(["commit", "-m", "advance upstream"])
upstream.run(["commit", "-A", "-m", "advance upstream"])
expected = upstream.get_revision()
push_url = (tmp_path / "push-only").as_uri()
config = tmp_path / "repos.yaml"
Expand All @@ -899,7 +904,10 @@ def test_hg_configured_remote_reaches_native_sync(
entry = load_configs([config])[0]
if worker:
outcome = run_sync_process(
entry, progress_callback=lambda *args: None, timeout=15, is_human=False
entry,
progress_callback=lambda *args: None,
timeout=_resolve_repo_timeout(None),
is_human=False,
)
assert outcome.status == "synced", outcome.error
else:
Expand Down