From c4a95e4d88175aa8ce7b093de196f587b622f85b Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 5 Dec 2026 08:44:26 -0600 Subject: [PATCH 1/2] cli(test[vt]): Document filtered terminal snapshot updates why: With libvt 0.0.1a6 shipping marker-filtered vt_snapshot discovery, contributors can check and refresh ordinary and terminal CLI goldens through the Syrupy marker. what: - Document checking and refreshing CLI goldens with the Syrupy marker in .github/CONTRIBUTING.md Refs tmux-python/libvt#189 --- .github/CONTRIBUTING.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index acc0e325..161dadf0 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -135,6 +135,16 @@ Tests are written as standalone functions (`test_*`), not grouped into `class TestFoo:` blocks — use descriptive function names and file organization instead. This applies to pytest tests, not doctests. +`just test -m syrupy_snapshot` checks the ordinary and terminal goldens +on Python 3.12 or later. Refresh the selected goldens after changing CLI +output with the same marker. + +```console +$ just test -m syrupy_snapshot --snapshot-update +``` + +Append a pytest node ID to refresh one case. + **libvcs fixtures.** The suite leans on libvcs's pytest plugin: `create_git_remote_repo`, `create_svn_remote_repo`, `create_hg_remote_repo` (factory fixtures), `git_repo`, `svn_repo`, `hg_repo` (pre-made repository From 99228d8b319ed4bb010acc39f847e03e2b134401 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Thu, 3 Dec 2026 19:29:29 -0600 Subject: [PATCH 2/2] cli(test[vt]): Give the fast clone time to finish why: Both repositories reached the test's one-second watchdog under load, preventing the snapshot from observing a single timeout. what: - Give the real fast clone five seconds under the CLI watchdog. - Keep the slow Git shim blocked past the watchdog and refresh the two affected Syrupy goldens. --- tests/cli/__snapshots__/test_vt_snapshots.ambr | 16 ++++++++-------- tests/cli/test_vt_snapshots.py | 14 +++++++++----- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/tests/cli/__snapshots__/test_vt_snapshots.ambr b/tests/cli/__snapshots__/test_vt_snapshots.ambr index 556d4512..dd9f5822 100644 --- a/tests/cli/__snapshots__/test_vt_snapshots.ambr +++ b/tests/cli/__snapshots__/test_vt_snapshots.ambr @@ -1134,17 +1134,17 @@ # --- # name: test_cli_sync_watchdog_timeout_pty_vt_snapshots[timeout_pty_delta] header: size=96x22 cursor=(3,44,vis=False) alt=False modes=[] -> size=96x22 cursor=(15,0,vis=True) alt=False modes=[] - row 1 cols 0..81: "Cloning into 'hung-analytics-warehouse'... " -> '- Timed out hung-analytics-warehouse after 1.0s → ~/code/hung-analytics-warehouse' + row 1 cols 0..81: "Cloning into 'hung-analytics-warehouse'... " -> '- Timed out hung-analytics-warehouse after 5.0s → ~/code/hung-analytics-warehouse' row 2 cols 0..29: 'Receiving objects: 12% (6/50)' -> ' ' row 3 cols 0..49: '⠋ Syncing hung-analytics-warehouse ... 0.1s ' -> 'Summary: 2 repos, 1 synced, 1 failed, 1 timed out' - row 5 cols 0..36: ' ' -> 'Timed out: 1 repository exceeded 1s.' + row 5 cols 0..36: ' ' -> 'Timed out: 1 repository exceeded 5s.' styles: r3[0..1]: fg=cyan, r3[10..34]: fg=cyan -> r1[0..1]: fg=yellow, r1[12..36]: fg=cyan, r1[43..47]: fg=yellow (+18 more) - size=96x22 cursor=(3,44,vis=False) alt=False modes=[] + size=96x22 cursor=(15,0,vis=True) alt=False modes=[] ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ │✓ Synced fast-sdk → ~/code/fast-sdk │ - │Cloning into 'hung-analytics-warehouse'... │ - + │- Timed out hung-analytics-warehouse after 1.0s → ~/code/hung-analytics-warehouse │ + + │- Timed out hung-analytics-warehouse after 5.0s → ~/code/hung-analytics-warehouse │ │^^^^^^^ ^^ ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^ ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ │ - │Receiving objects: 12% (6/50) │ + │ │ @@ -1154,10 +1154,10 @@ │^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ ^^^ │ │ │ - │ │ - + │Timed out: 1 repository exceeded 1s. │ + + │Timed out: 1 repository exceeded 5s. │ │^^^^^ ^^^^ ^ ^^^^^^^^^^ ^^^^^^^^ ^^^ │ - │ │ - + │ - hung-analytics-warehouse → ~/code/hung-analytics-warehouse (1.0s elapsed) │ + + │ - hung-analytics-warehouse → ~/code/hung-analytics-warehouse (5.0s elapsed) │ │ ^ ^^^^^^^^^^^^^^^^^^^^^^^^ ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ ^^^^^^^^ │ │ │ - │ │ @@ -1214,12 +1214,12 @@ size=96x22 cursor=(15,0,vis=True) alt=False modes=[] ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ │✓ Synced fast-sdk → ~/code/fast-sdk │ - │- Timed out hung-analytics-warehouse after 1.0s → ~/code/hung-analytics-warehouse │ + │- Timed out hung-analytics-warehouse after 5.0s → ~/code/hung-analytics-warehouse │ │ │ │Summary: 2 repos, 1 synced, 1 failed, 1 timed out │ │ │ - │Timed out: 1 repository exceeded 1s. │ - │ - hung-analytics-warehouse → ~/code/hung-analytics-warehouse (1.0s elapsed) │ + │Timed out: 1 repository exceeded 5s. │ + │ - hung-analytics-warehouse → ~/code/hung-analytics-warehouse (5.0s elapsed) │ │ │ │→ Rerun just the affected repositories with a larger timeout: │ │ vcspull sync --workspace '~/code' --timeout 120 hung-analytics-warehouse │ diff --git a/tests/cli/test_vt_snapshots.py b/tests/cli/test_vt_snapshots.py index 6f6a5586..db29f5ae 100644 --- a/tests/cli/test_vt_snapshots.py +++ b/tests/cli/test_vt_snapshots.py @@ -1474,7 +1474,7 @@ def test_cli_sync_watchdog_timeout_pty_vt_snapshots( vt_pty: PtyFactory, vt_snapshot: SnapshotAssertion, ) -> None: - """``--timeout 1`` PTY snapshots mid-hang spinner, 32-col rerun recipe, and log.""" + """Snapshot the slow clone timeout, rerun recipe, and log hint.""" from libvt.testing import vt_screen real_git = shutil.which("git") @@ -1485,6 +1485,7 @@ def test_cli_sync_watchdog_timeout_pty_vt_snapshots( ws_dir.mkdir(parents=True) bin_dir = tmp_path / "bin" log_file = fake_home / ".vcspull" / "logs" / "timeout.log" + timeout_seconds = 5 remote_fast, _ = _init_local_bare_remote(tmp_path, "fast-sdk") remote_hung, _ = _init_local_bare_remote(tmp_path, "hung-analytics-warehouse") @@ -1533,7 +1534,7 @@ def test_cli_sync_watchdog_timeout_pty_vt_snapshots( "--jobs", "1", "--timeout", - "1", + str(timeout_seconds), "--log-file", str(log_file), "--file", @@ -1543,8 +1544,8 @@ def test_cli_sync_watchdog_timeout_pty_vt_snapshots( env = _pty_cli_env(fake_home, prepend_bin=bin_dir) scrubbers = [ (fake_home, "~"), - (r"after \d+\.\ds", "after 1.0s"), - (r"\(\d+\.\ds elapsed\)", "(1.0s elapsed)"), + (r"after \d+\.\ds", f"after {timeout_seconds}.0s"), + (r"\(\d+\.\ds elapsed\)", f"({timeout_seconds}.0s elapsed)"), *_SYNC_SCRUBBERS, ] @@ -1570,7 +1571,10 @@ async def _exercise() -> None: assert rc == 0 assert done_snap.cursor.visible is True assert pty.terminal.synchronized is False - assert "Timed out: 1 repository exceeded 1s." in done_snap.text + assert ( + f"Timed out: 1 repository exceeded {timeout_seconds}s." + in done_snap.text + ) assert "Rerun just the affected repositories" in done_snap.text assert "Probe each repository manually" in done_snap.text assert vt_screen(done_snap, scrubbers=scrubbers) == vt_snapshot(