Skip to content

Commit

Permalink
Add Plotly tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoinePrv committed Oct 13, 2022
1 parent f13ca98 commit d24afe0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ jobs:
run: cmake --install build/cmake/conda-debug-osmesa
- name: Test
run: python -m pytest ./test -k 'not plot'
- name: Graphical Test
- name: Plotly toolkit test
run: python -m pytest ./test -k 'plot_plotly'
- name: Notebook toolkit test
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install libgl1-mesa-dev xvfb
xvfb-run python -m pytest ./test -k 'plot'
xvfb-run python -m pytest ./test -k 'plot_notebook'
static-analysis:
runs-on: "ubuntu-latest"
Expand Down
20 changes: 20 additions & 0 deletions test/test_xoctave_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,23 @@ def test_plot_notebook(self):
content0["transient"]["display_id"],
content1["transient"]["display_id"]
)

def test_plot_plotly(self):
self.flush_channels()
reply, output_msgs = self.execute_helper(code="graphics_toolkit plotly; plot([])")

content0 = output_msgs[0]["content"]
self.assertEqual(output_msgs[0]["msg_type"], "display_data")

content1 = output_msgs[1]["content"]
self.assertEqual(output_msgs[1]["msg_type"], "update_display_data")
app1 = content1["data"]["application/vnd.plotly.v1+json"]
self.assertTrue(len(app1) > 0)
self.assertTrue(len(app1["layout"]) > 0)
self.assertTrue(app1["layout"]["height"] > 0)
self.assertTrue(app1["layout"]["width"] > 0)

self.assertEqual(
content0["transient"]["display_id"],
content1["transient"]["display_id"]
)

0 comments on commit d24afe0

Please sign in to comment.