Skip to content

Added a module for shared test utils - #2010

Open
koperagen wants to merge 1 commit into
masterfrom
common-test-utils
Open

Added a module for shared test utils#2010
koperagen wants to merge 1 commit into
masterfrom
common-test-utils

Conversation

@koperagen

Copy link
Copy Markdown
Collaborator

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

@koperagen koperagen self-assigned this Jul 28, 2026
@koperagen koperagen changed the title Add a module for shared test utils Added a module for shared test utils Jul 28, 2026
@koperagen
koperagen force-pushed the common-test-utils branch from 4fccc04 to 4aa3f8b Compare July 28, 2026 16:09
@Jolanrensen

Copy link
Copy Markdown
Collaborator

Seems like a good idea! These helpers could also be beneficial there, I think:

I'd also consider adding the testImplementation dependency in the dfbuild.kotlinJvmCommon convention plugin so we have less duplication and the utils will be available everywhere automatically.

@Jolanrensen Jolanrensen added tests Something related to the JUnit tests, integration tests or testing infrastructure infrastructure GitHub actions, Gradle Scripts, Writerside, etc. labels Jul 29, 2026
@zaleslaw
zaleslaw requested a review from Copilot July 29, 2026 11:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-utils module and included it in the build.
  • Moved common debug/assertion helpers into common-test-utils and updated tests to import them.
  • Added testImplementation(projects.commonTestUtils) across multiple modules’ test dependencies and removed duplicated helpers from core tests.

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.

Comment on lines +23 to +28
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
@koperagen

Copy link
Copy Markdown
Collaborator Author

I'd also consider adding the testImplementation dependency in the dfbuild.kotlinJvmCommon convention plugin so we have less duplication and the utils will be available everywhere automatically.

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

@Jolanrensen

Copy link
Copy Markdown
Collaborator

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 dependencies { api(projects.core) } etc. which is a step further and could be discussed later.
(There are also some external plugins that add dependencies, so it's not too uncommon)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infrastructure GitHub actions, Gradle Scripts, Writerside, etc. tests Something related to the JUnit tests, integration tests or testing infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants