Last active
August 29, 2015 14:24
-
-
Save stevengj/7d6af1bf87433ec9b805 to your computer and use it in GitHub Desktop.
draft runtests for IJulia
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
for (repo,tag) in (("ipython/traitlets","master"), ("ipython/ipython_genutils","master"), ("jupyter/jupyter_core","master"), ("jupyter/jupyter_client","master"), ("jupyter/jupyter_kernel_test","master")) | |
if !isdir(basename(repo)) | |
run(`git clone https://github.com/$repo`) | |
end | |
cd(basename(repo)) do | |
run(`git checkout $tag`) | |
end | |
end | |
jupyter=joinpath(pwd(), "jupyter") | |
julib=joinpath(jupyter, "julib") | |
for repo in ("traitlets", "ipython_genutils", "jupyter_core", "jupyter_client") | |
cd(repo) do | |
run(`python setup.py install --prefix=$jupyter --install-lib=$julib`) | |
end | |
end | |
ktest = joinpath(julib, "kerneltest") | |
if islink(ktest) | |
rm(ktest) | |
end | |
symlink(joinpath(pwd(),"jupyter_kernel_test","jupyter_kernel_test"), ktest) | |
kernel="julia-$(VERSION.major).$(VERSION.minor)" | |
println("\nRunning kernel tests...") | |
open(`python -`, "w", STDOUT) do io | |
print(io, """ | |
import sys | |
sys.path.append('$julib') | |
import unittest | |
import IPython | |
import kerneltest | |
class MyKernelTests(kerneltest.KernelTests): | |
# The name identifying an installed kernel to run the tests against | |
kernel_name = "$kernel" | |
# language_info.name in a kernel_info_reply should match this | |
language_name = "julia" | |
# Code in the kernel's language to write "hello, world" to stdout | |
code_hello_world = 'println("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': 'zi', | |
'matches': {'zip'}, | |
}, | |
] | |
# Code completeness: samples grouped by expected result | |
complete_code_samples = ['println("hi")'] | |
incomplete_code_samples = ['function foo( ->', '"in a string'] | |
invalid_code_samples = ['import = 7q'] | |
if __name__ == '__main__': | |
unittest.main() | |
""") | |
end | |
println("SUCCESS!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment