test(datagrid): restore the shared clipboard after every test that installs one - #3165
Merged
Merged
Conversation
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.
Summary
mainhas failed Unit tests since #3160 (29ed299). Every PR that merges main in inherits the failure: #3150, #3153, #3154, #3155 and #3161 are red on it now.The failing suite is
RowOperationsManagerBinaryCopyTests, where every copy reads back as"".Cause
ClipboardService.sharedis process-wide, and 15 test installs in three files replaced it without putting the real provider back:RowOperationsFieldAbsenceTests(1, added in fix(plugin-mongodb): store Set NULL as null, tell a missing field from null, and add Remove Field #3160)RowOperationsManagerCopyTests(6)CellPasteRoutingTests(8)The one #3160 added installs a fake whose
writeTextdoes nothing, and the suite runs beforeRowOperationsManagerBinaryCopyTests. That suite asserted onNSPasteboard.general. With the fake still installed, the copy never reached the system pasteboard, so all five expectations read an empty string.Reading
NSPasteboard.generalin a test is its own defect: the system pasteboard is not reliable on a headless runner.Changes
defer { ClipboardService.shared = NSPasteboardClipboardProvider() }, the shape the other suites already use.RowOperationsManagerBinaryCopyTestsinstalls a capturing clipboard for each copy and asserts on the TSV it received, never on the system pasteboard.ClipboardInstallGuardTestsscansTableProTestsand fails on anyClipboardService.shared = …without a restoringdeferwithin three lines. Run against main's test tree, it names exactly the 15 sites above.Tests only. No app code changes, so no CHANGELOG entry.
Testing
verify.sh testwith every suite that touchesClipboardService.sharedplus the source-scan guard suites: 273 executed, 273 passed.copyWritesAbsenceand the new guard ran by name in the log.swiftlint lint --stricton the five files: 0 violations.