Repository navigation
fix(test): make the _url_copy tests type-clean and machine-independent - #773
Merged
Merged
Conversation
martinsifra
requested review from
keboola-pr-reviewer-bot and
soustruh
as code owners
September 16, 2026 23:37
keboola-pr-reviewer-bot
previously approved these changes
Sep 16, 2026
keboola-pr-reviewer-bot
left a comment
There was a problem hiding this comment.
Verdict: auto_approve (risk 1/5) · profile _default
Test-only change to a single test file, no source tree touched — auto-approve.
Closed
9 of 10 tasks
`main` is red: CI's `uv run ty check` step fails on three `console.file.getvalue()` reads in tests/test_url_copy.py. Rich declares `Console.file` as `IO[str]`, which has no `getvalue`. Added an `_output()` helper that narrows it back with `cast(io.StringIO, ...)` -- the idiom tests/test_output.py already uses at its 23 read sites -- and routed the three reads through it. Two tests were also environment-dependent and failed for essentially every developer while passing in CI. `copier=None` means "detect a backend" (_url_copy.py:123), not "there is none", so `test_disabled_without_backend` and `test_on_prompt_silent_when_disabled` asserted "disabled" on a machine where `detect_clipboard()` finds nothing -- true only in a bare container. On macOS (`pbcopy` always present), Windows (`clip`), WSL (`clip.exe`) or any Linux desktop with `xclip`/`wl-copy` they failed, which is how this was noticed and which is why the Windows CI job went red too. Both now stage the no-backend case by monkeypatching `detect_clipboard`. Test-only; no production behaviour changes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
martinsifra
force-pushed
the
fix/ty-url-copy-tests
branch
from
September 17, 2026 00:18
e521b31 to
cc23cd4
Compare
keboola-pr-reviewer-bot
dismissed
their stale review
September 17, 2026 00:18
Dismissing prior approval — a new commit was pushed and this review was for an earlier SHA. Run @keboola-pr-reviewer-bot review to get a fresh verdict.
|
New commit on |
keboola-pr-reviewer-bot
approved these changes
Sep 17, 2026
keboola-pr-reviewer-bot
left a comment
There was a problem hiding this comment.
Verdict: auto_approve (risk 1/5) · profile _default
Test-only fix to one test file makes assertions type-clean and machine-independent; no source or runtime behavior changes.
martinsifra
added a commit
that referenced
this pull request
Sep 17, 2026
Covers everything merged since v0.94.0: #768 (uv audit / uv >= 0.12.15), #772 (device-login "press c to copy") and #773 (test housekeeping). No `vNEXT` placeholders were outstanding (`make vnext-check` clean), and no `whatsnew.ts` entry is added -- nothing under `web/` changed this release, so the popup correctly has nothing new to show. gotchas.md: #772 reordered the device-login panel without updating the doc surface. The 0.92.0 "one-click link is conditional" gotcha quoted the old label ("Or open this link (code pre-filled):") and the old ordering, so a relay keying on either now picks the wrong line -- rewritten, plus a new entry for `press c to copy` being absent in exactly the situations an agent drives (`--json`, no TTY, no clipboard command). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mainis currently red: the CIcheckjob's "Type check (ty)" step and the Windows job's "Full test suite on Windows" both fail atf5eb4c0, so every open PR inherits a failing build. Test-only fix, no production behaviour changes.Both failures come from
tests/test_url_copy.py(shipped by #772, which was merged with its own CI already red).1. Job
check— "Type check (ty)"The tests read captured output as
console.file.getvalue(). Rich declaresConsole.fileasIO[str], which has nogetvalue— threeunresolved-attributeerrors. Added an_output()helper that narrows it withcast(io.StringIO, console.file), which is the idiomtests/test_output.pyalready uses at 23 read sites; wrapped in a helper only because this file reads the buffer from several tests.2. Windows job — two tests that could only pass in a bare Linux container
copier=Nonemeans "detect a backend", not "there is none" (_url_copy.py:123:self._copier = copier if copier is not None else detect_clipboard()). Sotest_disabled_without_backendandtest_on_prompt_silent_when_disabledasserted "disabled" — which holds only wheredetect_clipboard()finds nothing.Windows has
clip, macOS always haspbcopy, WSL hasclip.exe, a Linux desktop hasxclip/xsel/wl-copy. So these tests were green in exactly one of the three CI jobs and red for any developer on a real workstation — that is both why the Windows job failed and how this surfaced locally. Both now stage the no-backend case by monkeypatchingdetect_clipboard, so the assertion is about the code rather than about the machine.Verification
make typecheck— down to the one pre-existingscripts/hatch_build.pywarningmake check— exit 0, 6798 passed, 12 skippedtests/test_url_copy.py— 10 passed, on a machine that does have a clipboard backend (WSLclip.exe), i.e. one that reproduced the original failureDeliberately out of scope
copier=Nonebeing overloaded — "not given" and, as these tests assumed, "none exists" — is arguably the root cause, but it is production API and the documented behaviour is correct; only the tests' assumption was wrong. Left for a follow-up so this stays a minimal, test-only unblock.Found while preparing the 0.95.0 release PR (#774), which cannot go out on a red
main.🤖 Generated with Claude Code