jupyter-xeus / xeus-r

Jupyter kernel for the R programming language
Other
42 stars 5 forks source link

Test/fix `clear_output()` #64

Closed romainfrancois closed 9 months ago

romainfrancois commented 10 months ago

clear_output() is implemented already, and just relays back to interpreter->clear_output() but that does not seem to work. So need to investigate. Here's the test case for future reference:

    code_clear_output = ""

    def test_clear_output(self) -> None:
        if not self.code_clear_output:
            raise SkipTest("No code clear output")  # noqa

        self.flush_channels()
        reply, output_msgs = self.execute_helper(code=self.code_clear_output)
        self.assertEqual(reply["content"]["status"], "ok")
        self.assertGreaterEqual(len(output_msgs), 1)

        found = False
        for msg in output_msgs:
            if msg["msg_type"] == "clear_output":
                found = True
            else:
                continue
        if not found:
            emsg = "clear_output message not found"
            raise AssertionError(emsg)