-
Notifications
You must be signed in to change notification settings - Fork 505
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #291 from scrapinghub/notebook-tests
TST basic tests for splash.kernel
- Loading branch information
Showing
4 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,6 @@ requests >= 1.0 | |
jsonschema >= 2.0 | ||
strict-rfc3339 | ||
pytest-cov | ||
jupyter_kernel_test | ||
nose | ||
ipython[notebook] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import absolute_import | ||
|
||
import pytest | ||
jupyter_kernel_test = pytest.importorskip("jupyter_kernel_test") | ||
lupa = pytest.importorskip("lupa") | ||
|
||
|
||
class SplashKernelTest(jupyter_kernel_test.KernelTests): | ||
|
||
@classmethod | ||
def setUpClass(cls): | ||
# XXX: this installs kernel spec to global user environment, | ||
# not to a virtualenv. | ||
from splash.kernel import kernel | ||
kernel.install() | ||
|
||
super(SplashKernelTest, cls).setUpClass() | ||
|
||
# The name identifying an installed kernel to run the tests against | ||
kernel_name = "splash" | ||
|
||
# language_info.name in a kernel_info_reply should match this | ||
language_name = "Splash" | ||
|
||
# Optional -------------------------------------- | ||
# Code in the kernel's language to write "hello, world" to stdout | ||
# code_hello_world = "print 'hello, world'" | ||
|
||
# Tab completions: in each dictionary, text is the input, which it will | ||
# try to complete from the end of. matches is the collection of results | ||
# it should expect. | ||
completion_samples = [ | ||
{ | ||
'text': 'spl', | ||
'matches': {'splash'}, | ||
}, | ||
{ | ||
'text': 'splash:eva', | ||
'matches': {'evaljs'}, | ||
}, | ||
{ | ||
'text': 'splash.ar', | ||
'matches': {'args'}, | ||
}, | ||
] | ||
|
||
# Code completeness: samples grouped by expected result | ||
# complete_code_samples = ['x=2'] | ||
# incomplete_code_samples = ['function foo(', '"""in a string'] | ||
# invalid_code_samples = ['x=2a'] | ||
|
||
# # Pager: code that should display something (anything) in the pager | ||
# code_page_something = "help('foldl')" |