Commit 0b69e8b2 authored by Matthieu Boileau's avatar Matthieu Boileau

test NbCourse build

parent b41ecb80
......@@ -8,3 +8,4 @@ __pycache__/
.env/
build/
notebooks/
tests/notebooks
......@@ -55,8 +55,11 @@ class HomePage:
chapters = []
for nbfile in self.notebooks:
chapter = self._get_chapter(nbfile)
chapter['preview_only'] = chapter['number'] in \
self.variables['chapter_preview_only']
try:
chapter['preview_only'] = chapter['number'] in \
self.variables['chapter_preview_only']
except KeyError:
chapter['preview_only'] = False
chapters.append(chapter)
chapters.sort(key=lambda chapter: chapter['number'])
self.variables.update({'chapters': chapters})
......
from nbcourse.initialize import initialize
from nbcourse.nbcourse import NbCourse
from nbcourse.nbcourse import NbCourse, MyDoitMain, ClassTaskLoader
import pytest
from pathlib import Path
import os
from distutils.dir_util import copy_tree
TESTS_PATH = Path(__file__).parent.absolute()
@pytest.fixture(scope="session")
def create_project(tmpdir_factory):
"""Create a temporary nbcourse project skeleton"""
p = tmpdir_factory.mktemp("test_project")
@pytest.fixture
def create_project(tmpdir):
"""Create a sample nbcourse project"""
p = tmpdir.mkdir("test_project")
os.chdir(p)
initialize()
# Create a link to notebooks sample
nb = Path('notebooks')
nb.symlink_to(TESTS_PATH / 'notebooks')
return p
def test_minimal_nbcourse():
def test_minimal_nbcourse(create_project):
"""Only test nbcourse object instantiation"""
NbCourse()
def test_minimal_nbcourse_build(create_project):
"""Only test nbcourse object instantiation"""
course = NbCourse()
loader = ClassTaskLoader(course)
MyDoitMain(loader).run(["-n 4"])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment