Skip to content

Commit 9508577

Browse files
authored
Merge pull request #215 from tkoolen/tk/nbinclude-tests
Use NBInclude to test notebooks.
2 parents 09807fb + df1a38a commit 9508577

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

test/REQUIRE

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ julia 0.4
22
Compat 0.8.0
33
BaseTestNext
44
IJulia
5+
NBInclude
6+
Colors
7+
Compose

test/runtests.jl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,24 @@ module HygieneTest2
2828
2 * i, j * " hello"
2929
end
3030
end
31+
32+
# Notebooks
33+
# notebookdirs = [joinpath(@__DIR__, "notebooks"), joinpath(@__DIR__, "..", "doc", "notebooks")]
34+
notebookdirs = [joinpath(@__DIR__, "..", "doc", "notebooks")] # Interact Manual Tests.ipynb is broken (flatten call)
35+
excludes = [joinpath(@__DIR__, "..", "doc", "notebooks", "03-Interactive Diagrams and Plots.ipynb")]
36+
for notebookdir in notebookdirs
37+
for file in readdir(notebookdir)
38+
path = joinpath(notebookdir, file)
39+
path in excludes && continue
40+
name, ext = splitext(file)
41+
lowercase(ext) == ".ipynb" || continue
42+
@eval module $(gensym()) # Each notebook is run in its own module.
43+
using Base.Test
44+
using NBInclude
45+
@testset "$($name)" begin
46+
nbinclude($path, regex = r"^((?!\#NBSKIP).)*$"s) # Use #NBSKIP in a cell to skip it during tests.
47+
end
48+
end # module
49+
end
50+
end
51+

0 commit comments

Comments
 (0)