Only show images during tests when requested via project property (#2177)

## Description

Revision of #2164. Instead of only running headless tests during a
build, now only the images are disabled. To reenable showing images, the
`enableTestUi` project property needs to be passed to gradle.

```bash
./gradlew test -PenableTestUi
```

## Meta

Merge checklist:
- [X] Pull Request title is [short, imperative
summary](https://cbea.ms/git-commit/) of proposed changes
- [X] The description documents the _what_ and _why_
- [X] This PR has been
[linted](https://docs.photonvision.org/en/latest/docs/contributing/linting.html).
- [x] If this PR changes behavior or adds a feature, user documentation
is updated
- [ ] If this PR touches photon-serde, all messages have been
regenerated and hashes have not changed unexpectedly
- [ ] If this PR touches configuration, this is backwards compatible
with settings back to v2025.3.2
- [ ] If this PR touches pipeline settings or anything related to data
exchange, the frontend typing is updated
- [ ] If this PR addresses a bug, a regression test for it is added
This commit is contained in:
Alan Everett
2025-11-06 14:38:07 -05:00
committed by GitHub
parent 25c355ebc2
commit def3b9faa8
3 changed files with 28 additions and 24 deletions

View File

@@ -54,24 +54,14 @@ dependencies {
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
}
workingDir = new File("${rootDir}")
finalizedBy jacocoTestReport
}
tasks.register('testHeadless', Test) {
group = "verification"
systemProperty("java.awt.headless", "true")
useJUnitPlatform()
systemProperty("java.awt.headless", !project.hasProperty("enableTestUi"))
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
exceptionFormat = "full"
showStandardStreams = true
}
exclude '**/*BenchmarkTest*'
workingDir = new File("${rootDir}")
finalizedBy jacocoTestReport
}
jacoco {
@@ -80,7 +70,7 @@ jacoco {
}
jacocoTestReport {
dependsOn testHeadless
dependsOn test
reports {
xml.required = true
@@ -96,10 +86,3 @@ jacocoTestReport {
}))
}
}
// Only run headless tests from the build task
gradle.taskGraph.whenReady { graph ->
if (graph.hasTask(build)) {
test.enabled = false
}
}