This is an automated email from the ASF dual-hosted git repository.
paulk-asert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new be8ddfc4aa minor refactor: improve test robustness for groovysh on CI
(cont'd)
be8ddfc4aa is described below
commit be8ddfc4aab840d95cc436235ff543ca11a07846
Author: Paul King <[email protected]>
AuthorDate: Sun May 24 21:26:43 2026 +1000
minor refactor: improve test robustness for groovysh on CI (cont'd)
---
.../groovysh/commands/SystemTestSupport.groovy | 30 ++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git
a/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/SystemTestSupport.groovy
b/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/SystemTestSupport.groovy
index 3c32761692..15a3edca38 100644
---
a/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/SystemTestSupport.groovy
+++
b/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/SystemTestSupport.groovy
@@ -22,7 +22,12 @@ import org.apache.groovy.groovysh.jline.GroovySystemRegistry
import org.jline.terminal.Size
import org.jline.terminal.Terminal
import org.jline.terminal.TerminalBuilder
+import org.jline.terminal.impl.SixelGraphics
+import org.jline.terminal.impl.TerminalGraphics
+import org.jline.terminal.impl.TerminalGraphicsManager
+import org.junit.jupiter.api.AfterAll
import org.junit.jupiter.api.AfterEach
+import org.junit.jupiter.api.BeforeAll
import org.junit.jupiter.api.BeforeEach
import java.nio.charset.StandardCharsets
@@ -61,6 +66,31 @@ abstract class SystemTestSupport extends ConsoleTestSupport {
protected Terminal terminal
private ByteArrayOutputStream terminalBytes
+ // Force JLine's graphics-protocol detection off for the test lifetime.
+ // {@link TerminalGraphicsManager#isGraphicsSupported} would otherwise read
+ // host env vars (TERM_PROGRAM, KITTY_WINDOW_ID, ITERM_SESSION_ID,
+ // GHOSTTY_RESOURCES_DIR) and probe the underlying PTY, returning true when
+ // Gradle is launched from a graphics-capable terminal
(WezTerm/Kitty/iTerm2/
+ // Ghostty). When true, /img bypasses its summary-line fallback and writes
+ // graphics bytes to the terminal directly, which our dumb-terminal capture
+ // can't surface — breaking ImgTest assertions.
+ //
+ // The combo {@code forceProtocol(SIXEL)} + {@code
setSixelSupportOverride(false)}
+ // narrows {@code getBestProtocol(...)} to only consider Sixel, then forces
+ // Sixel to report unsupported — so {@code isGraphicsSupported} returns
false
+ // regardless of any env-var-driven Kitty/iTerm2 detection.
+ @BeforeAll
+ static void disableGraphicsProtocolDetection() {
+ TerminalGraphicsManager.forceProtocol(TerminalGraphics.Protocol.SIXEL)
+ SixelGraphics.setSixelSupportOverride(Boolean.FALSE)
+ }
+
+ @AfterAll
+ static void restoreGraphicsProtocolDetection() {
+ TerminalGraphicsManager.forceProtocol(null)
+ SixelGraphics.setSixelSupportOverride(null)
+ }
+
@BeforeEach
@Override
void setUp() {