Closed breandan closed 3 years ago
Hi! Yes, it's reasonable, thanks for filing the issue. ATM you may use a whole kernel to write your tests. See related commit in dataframe: https://github.com/JetBrains/dataframe/commit/d3f29fa1e79f037ba3fb2556a914c84ac1d624b8
I think, there are no related examples in other places
Thanks! It seems to be working locally, although for some reason execHtml
was not detecting the automated import functionality and I had to add import
manually. Probably I am doing something incorrectly.
Please set the BP here and check if your library classes pass the test: https://github.com/breandan/kotlingrad/commit/e7875f1d5e36039e44bb7a9d779d14a82f97510a#r51486386
I can confirm that the library classes pass through the filter and are included on the classpath
(i.e. specifying the imports explicitly in the Code
snippet works), but for some reason, the automated import functionality from the library's JupyterIntegration
does not.
@breandan I've checked your setup in kotlingrad, and it seems that @Before
function isn't executed before the test. If you add initRepl()
in the test, everything works:
@Test
fun `circuit is rendered to html`() {
initRepl()
@Language("kts")
val html = execHtml(
"""
val x by SVar(DReal)
val y by SVar(DReal)
val z by SVar(DReal)
val t = (1 + x * 2 - 3 + y + z / y).d(y).d(x) + z / y * 3 - 2; t
""".trimIndent()
)
html shouldContain "polygon"
}
@breandan I found that it's because you use Before from another version of JUnit) I've fixed your test in this PR: https://github.com/breandan/kotlingrad/pull/23
@breandan regarding your commit in kaliningraph - have you checked that initRepl()
is executed? In my setup, after deleting a preamble this test works fine, but maybe something is going wrong in your one (i.e. Junit 4 that doesn't understand BeforeEach
is used for running tests)
By the way, thank you a lot for trying this ugly scheme, it will help me when I will add support for testing to Gradle plugin.
See example of switching to the new testing kit in this commit: https://github.com/Kotlin/dataframe/commit/6d43287d8e91312dd108bc65b3fe34420354ae0e
Does the Gradle plugin provide a way to mock a Jupyter notebook? If not, it would be convenient to provide a way for libraries to integration test their Jupyter notebook support on some sample notebooks. I could not find any examples of this on GitHub.