You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
openjdk version "11.0.13" 2021-10-19 LTS
OpenJDK Runtime Environment Corretto-11.0.13.8.1 (build 11.0.13+8-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.13.8.1 (build 11.0.13+8-LTS, mixed mode)
Buildtool version
------------------------------------------------------------
Gradle 7.3.3
------------------------------------------------------------
Build time: 2021-12-22 12:37:54 UTC
Revision: 6f556c80f945dc54b50e0be633da6c62dbe8dc71
Kotlin: 1.5.31
Groovy: 3.0.9
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 11.0.13 (Amazon.com Inc. 11.0.13+8-LTS)
OS: Mac OS X 12.1 x86_64
What operating system are you using
Mac
Dependencies
N/A - test created in Spock codebase
Additional context
This approach using a trait with a temporary directory previously worked in Spock 1.x using a JUnit @Rule TemporaryFolder. I am updating my test utils library for Spock 2 and I'd like to use the same approach if possible.
This issue is similar to the one here (#1229) for using @TempDir in a base class, which was solved.
The text was updated successfully, but these errors were encountered:
Unfortunately field extensions don't work in traits, as Groovy doesn't support traits with AST some necessary metadata isn't generated for fields contributed by traits.
Describe the bug
The
@TempDir
annotation does not work when defined in a trait.To Reproduce
Adding the following trait and test class in TempDirExtensionSpec reproduces the problem:
Expected behavior
The temporary directory is initialized and the above tests pass.
Actual behavior
Java version
Buildtool version
What operating system are you using
Mac
Dependencies
N/A - test created in Spock codebase
Additional context
This approach using a
trait
with a temporary directory previously worked in Spock 1.x using a JUnit@Rule TemporaryFolder
. I am updating my test utils library for Spock 2 and I'd like to use the same approach if possible.This issue is similar to the one here (#1229) for using
@TempDir
in a base class, which was solved.The text was updated successfully, but these errors were encountered: