Commit 3e534e84 authored by Matthieu Boileau's avatar Matthieu Boileau
Browse files

Add test with yaml file

parent 0ef43661
Pipeline #5487 passed with stage
in 29 seconds
......@@ -41,7 +41,7 @@ class Book:
self.output_path = conf['output_path']
self.project_path = conf['project_path']
self.titlepage_path = conf['pages']['path'] / conf['book']['titlepage']
self.book_title = conf['book']['title']
self.book_title = conf['book']['file']
self.template_path = conf['template_path'].as_posix()
def build(self):
......
......@@ -42,7 +42,7 @@ class NbCourse:
},
'book': {
'titlepage': 'titlepage.tex',
'title': None,
'file': None,
},
'local_reveal': False,
'slug_title': 'course',
......@@ -76,10 +76,10 @@ class NbCourse:
self.conf['reveal_path'] = libdir / Path('reveal.js')
self.notebooks = tuple(self.conf['nb']['path'].glob('*-*.ipynb'))
if self.conf['book']['title']:
if self.conf['book']['file']:
self.titlepage_path = self.conf['pages']['path'] / \
self.conf['book']['titlepage']
self.book = self.conf['output_path'] / self.conf['book']['title']
self.book = self.conf['output_path'] / self.conf['book']['file']
else:
self.titlepage_path = None
self.book = None
......
......@@ -3,11 +3,11 @@ slug_title: cours-python
subtitle: Master Communication Scientifique, 2019-2020
favicon: fig/favicon.ico
book:
title: cours-python.pdf
picture:
path: fig/python-logo_full.png
width: 300px
alt: Logo Python
file: cours-python.pdf
picture:
path: fig/python-logo_full.png
width: 300px
alt: Logo Python
authors:
- name: Matthieu Boileau
email: matthieu.boileau@math.unistra.fr
......
......@@ -29,15 +29,22 @@ def test_minimal_nbcourse(create_project):
NbCourse()
def test_minimal_nbcourse_build_pages(create_project):
course = NbCourse(MINI_CONF)
with pytest.raises(SystemExit):
course.build(["build_pages"])
@pytest.mark.parametrize('task', get_functions(NbCourse, 'task_(.*)'))
def test_minimal_nbcourse_build(create_project, task):
"""test nbcourse on list of doit tasks returned by get_functions"""
course = NbCourse(MINI_CONF)
with pytest.raises(SystemExit):
course.build(["-n 4", task])
def test_nbcourse(create_project):
"""Test sample with nbcourse.yml example file"""
NbCourse(Path('nbcourse.yml'))
def test_nbcourse_build(create_project):
"""Test sample build with nbcourse.yml example file"""
course = NbCourse(Path('nbcourse.yml'))
course.conf['book']
with pytest.raises(SystemExit):
course.build(["-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