Skip to content

Commit

Permalink
Merge pull request #85 from rapgenic/tests
Browse files Browse the repository at this point in the history
[Backport 4/5]: Add more tests
  • Loading branch information
rapgenic committed Dec 21, 2022
2 parents b93f13f + 248081e commit 50883e7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions test/octave/xtest_path.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Check that the xeus-octave override path is the first in the path list
assert(strcmp(strsplit(path(), pathsep()){2}, XEUS_OCTAVE_OVERRIDE_PATH))
20 changes: 19 additions & 1 deletion test/test_xoctave_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@
import platform

import jupyter_kernel_test

import os
from pathlib import Path

class KernelTests(jupyter_kernel_test.KernelTests):

kernel_name = "xoctave"
language_name = "Octave"
code_hello_world = "disp('hello, world')"
code_stderr = "fprintf(2,'this is stderr')"
code_generate_error = "garble"
completion_samples = [
{
"text": "bessel",
Expand All @@ -41,6 +44,9 @@ class KernelTests(jupyter_kernel_test.KernelTests):
"end\n",
]
code_inspect_sample = "plot"
code_display_data = [
{'code': 'x = [0 1 2]', 'mime': 'text/html'},
]

def test_pager(self):
"""Reimplementation of KernelTests.code_page_something.
Expand Down Expand Up @@ -110,3 +116,15 @@ def test_plot_plotly(self):
self.assertTrue(app1["layout"]["width"] > 0)

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

def test_octave_scripts(self):
directory = Path(__file__).parent / 'octave'

for file in directory.iterdir():
if file.name.endswith(".m"):
self.flush_channels()
with file.open() as script:
code = script.read()
reply, output_msgs = self.execute_helper(code)

assert reply['content']['status'] == 'ok', code

0 comments on commit 50883e7

Please sign in to comment.