Added a module for shared test utils - #2010
Conversation
4fccc04 to
4aa3f8b
Compare
|
Seems like a good idea! These helpers could also be beneficial there, I think: I'd also consider adding the |
There was a problem hiding this comment.
Pull request overview
Introduces a new internal Gradle submodule (:common-test-utils) to host shared test helper utilities, and wires it into existing modules’ test classpaths to reduce duplicated test code.
Changes:
- Added
:common-test-utilsmodule and included it in the build. - Moved common debug/assertion helpers into
common-test-utilsand updated tests to import them. - Added
testImplementation(projects.commonTestUtils)across multiple modules’ test dependencies and removed duplicated helpers fromcoretests.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| settings.gradle.kts | Registers the new common-test-utils subproject. |
| dataframe-json/src/test/kotlin/org/jetbrains/kotlinx/dataframe/io/JsonTests.kt | Switches to shared alsoDebug import and removes local duplicate implementation. |
| dataframe-json/build.gradle.kts | Adds commonTestUtils as a test dependency. |
| dataframe-jdbc/build.gradle.kts | Adds commonTestUtils as a test dependency. |
| dataframe-geo/build.gradle.kts | Adds commonTestUtils as a test dependency. |
| dataframe-excel/build.gradle.kts | Adds commonTestUtils as a test dependency. |
| dataframe-csv/build.gradle.kts | Adds commonTestUtils as a test dependency. |
| dataframe-arrow/build.gradle.kts | Adds commonTestUtils as a test dependency. |
| core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/Utils.kt | Removes duplicated debug/assertion helpers now hosted in common-test-utils. |
| core/build.gradle.kts | Adds commonTestUtils as a test dependency for core tests that use the helpers. |
| common-test-utils/src/main/kotlin/org/jetbrains/kotlinx/dataframe/DebugUtils.kt | New shared debug/assertion utilities (alsoDebug, toDebugString, shouldHaveColumn*). |
| common-test-utils/README.md | Adds brief documentation for the internal test utils module. |
| common-test-utils/build.gradle.kts | Defines the new module’s build and dependencies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| public fun <T : DataFrame<*>> T.alsoDebug(println: String? = null, rowsLimit: Int = 20): T = | ||
| apply { | ||
| println?.let { println(it) } | ||
| print(borders = true, title = true, columnTypes = true, valueLimit = -1, rowsLimit = rowsLimit) | ||
| schema().print() | ||
| } |
| @@ -0,0 +1,3 @@ | |||
| ## :common-test-utils | |||
|
|
|||
| This internal module contains shared test utilities | |||
This will be our first convention plugin that also adds dependencies. Seems like a new approach to me, a bit different from JDK/etc - although i'm not sure why. Would you like to have it? For example Kotlin also has a lot of shared build conventions. But from what i can see all dependencies are still declared explicitly |
It will be just be test dependencies, though, so it probably will never hurt. In #1661 I also mentioned the idea of having an "io-source" convention plugin, which could add |
It will be internal, and doesn't really change much - only one instance of code duplication is removed. But we'll have a capacity to use common code for all tests. For example, i'd like to later use those "shouldHaveColumn", etc in Arrow tests