-
Notifications
You must be signed in to change notification settings - Fork 19
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 #69 from stsewd/read-from-paths
LiraApp: load books from config file
- Loading branch information
Showing
13 changed files
with
147 additions
and
5 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
Empty file.
Empty file.
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,11 @@ | ||
language: en | ||
title: Intro to Lira | ||
description: Introducction to Lira and how to write a Lira book | ||
created: 24/10/2020 | ||
updated: 24/10/2020 | ||
authors: | ||
- Santos Gallegos | ||
|
||
contents: | ||
Introducction: intro.rst | ||
Showcase: showcase.rst |
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,12 @@ | ||
:level: easy | ||
:tags: lira book | ||
|
||
Lira | ||
---- | ||
|
||
Lira is an interactive tutorial. | ||
|
||
Writting a book | ||
--------------- | ||
|
||
TODO |
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,12 @@ | ||
:level: easy | ||
:tags: showcase book | ||
|
||
Basic elements | ||
-------------- | ||
|
||
This is a paragraph with *some* nodes. | ||
I'm a ``literal`` node, and I'm **strong**. | ||
|
||
.. code-block:: python | ||
print("Hello world!") |
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
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,3 @@ | ||
books: | ||
- lira.books.intro | ||
- example/ |
Empty file.
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,29 @@ | ||
from pathlib import Path | ||
from unittest import mock | ||
|
||
from lira.app import LiraApp | ||
|
||
data_dir = Path(__file__).parent / "data" | ||
config_file = data_dir / "books/config.yaml" | ||
|
||
|
||
class TestApp: | ||
@mock.patch("lira.app.CONFIG_FILE", config_file) | ||
def test_load_books(self): | ||
app = LiraApp() | ||
app.setup() | ||
|
||
books = app.books | ||
assert len(books) == 2 | ||
|
||
book_a, book_b = books | ||
book_a.parse() | ||
book_b.parse() | ||
|
||
assert book_a.metadata["title"] == "Intro to Lira" | ||
book_path = data_dir / "../../lira/books/intro" | ||
assert book_a.root == book_path.resolve() | ||
|
||
assert book_b.metadata["title"] == "Basic Introducction to Python" | ||
book_path = data_dir / "books/example" | ||
assert book_b.root == book_path |