Show More
@@ -19,8 +19,9 b' class MainKernelSpecHandler(IPythonHandler):' | |||
|
19 | 19 | ksm = self.kernel_spec_manager |
|
20 | 20 | results = [] |
|
21 | 21 | for kernel_name in ksm.find_kernel_specs(): |
|
22 | results.append(dict(name=kernel_name, | |
|
23 | display_name=ksm.get_kernel_spec(kernel_name).display_name)) | |
|
22 | d = ksm.get_kernel_spec(kernel_name).to_dict() | |
|
23 | d['name'] = kernel_name | |
|
24 | results.append(d) | |
|
24 | 25 | |
|
25 | 26 | self.set_header("Content-Type", 'application/json') |
|
26 | 27 | self.finish(jsonapi.dumps(results)) |
@@ -71,8 +71,11 b' class APITest(NotebookTestBase):' | |||
|
71 | 71 | |
|
72 | 72 | # 2: the sample kernelspec created in setUp, and the native Python kernel |
|
73 | 73 | self.assertEqual(len(specs), 2) |
|
74 | assert any(s == {'name': 'sample', 'display_name': 'Test kernel'} | |
|
75 | for s in specs), specs | |
|
74 | ||
|
75 | def is_sample_kernelspec(s): | |
|
76 | return s['name'] == 'sample' and s['display_name'] == 'Test kernel' | |
|
77 | ||
|
78 | assert any(is_sample_kernelspec(s) for s in specs), specs | |
|
76 | 79 | |
|
77 | 80 | def test_get_kernelspec(self): |
|
78 | 81 | spec = self.ks_api.kernel_spec_info('Sample').json() # Case insensitive |
@@ -48,13 +48,16 b' class KernelSpec(HasTraits):' | |||
|
48 | 48 | kernel_dict = json.load(f) |
|
49 | 49 | return cls(resource_dir=resource_dir, **kernel_dict) |
|
50 | 50 | |
|
51 |
def to_ |
|
|
52 |
return |
|
|
51 | def to_dict(self): | |
|
52 | return dict(argv=self.argv, | |
|
53 | 53 |
|
|
54 | 54 |
|
|
55 | 55 |
|
|
56 | 56 |
|
|
57 |
|
|
|
57 | ) | |
|
58 | ||
|
59 | def to_json(self): | |
|
60 | return json.dumps(self.to_dict()) | |
|
58 | 61 | |
|
59 | 62 | def _is_kernel_dir(path): |
|
60 | 63 | """Is ``path`` a kernel directory?""" |
General Comments 0
You need to be logged in to leave comments.
Login now