Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration testing Jupyter notebook support #270

Closed
breandan opened this issue May 30, 2021 · 9 comments
Closed

Integration testing Jupyter notebook support #270

breandan opened this issue May 30, 2021 · 9 comments
Labels
Milestone

Comments

@breandan
Copy link
Contributor

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.

@ileasile
Copy link
Contributor

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:
Kotlin/dataframe@d3f29fa

I think, there are no related examples in other places

breandan added a commit to breandan/galoisenne that referenced this issue May 30, 2021
breandan added a commit to breandan/kotlingrad that referenced this issue May 30, 2021
@breandan
Copy link
Contributor Author

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.

@ileasile
Copy link
Contributor

Please set the BP here and check if your library classes pass the test:
breandan/kotlingrad@e7875f1#r51486386

@breandan
Copy link
Contributor Author

breandan commented Jul 9, 2021

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.

@ileasile
Copy link
Contributor

ileasile commented Jul 9, 2021

@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"
  }

@ileasile
Copy link
Contributor

ileasile commented Jul 9, 2021

@breandan I found that it's because you use Before from another version of JUnit) I've fixed your test in this PR:
breandan/kotlingrad#23

breandan added a commit to breandan/galoisenne that referenced this issue Jul 9, 2021
@ileasile
Copy link
Contributor

@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)

@ileasile
Copy link
Contributor

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.

breandan added a commit to breandan/galoisenne that referenced this issue Jul 13, 2021
@ileasile ileasile added this to the 0.11.0 milestone Jul 16, 2021
@ileasile
Copy link
Contributor

ileasile commented Aug 4, 2021

See example of switching to the new testing kit in this commit:
Kotlin/dataframe@6d43287

breandan added a commit to breandan/galoisenne that referenced this issue Aug 5, 2021
breandan added a commit to breandan/kotlingrad that referenced this issue Aug 5, 2021
ileasile added a commit that referenced this issue Aug 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants