comparison tests/test_baking_baker.py @ 989:8adc27285d93

bake: Big pass on bake performance. - Reduce the amount of data passed between processes. - Make inter-process data simple objects to make it easier to test with alternatives to pickle. - Make sources have the basic requirement to be able to find a content item from an item spec (path). - Make Hoedown the default Markdown formatter.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 19 Nov 2017 14:29:17 -0800
parents
children 1857dbd4580f
comparison
equal deleted inserted replaced
988:f83ae0a5d793 989:8adc27285d93
1 import time
2 from .mockutil import get_mock_app, mock_fs, mock_fs_scope
3
4
5 def test_bake_and_add_post():
6 fs = (mock_fs()
7 .withConfig()
8 .withPage('pages/_index.html', {'layout': 'none', 'format': 'none'},
9 "{% for p in pagination.posts -%}\n"
10 "{{p.title}}\n"
11 "{% endfor %}")
12 .withPage('posts/2017-01-01_first.html', {'title': "First"},
13 "something"))
14 with mock_fs_scope(fs):
15 fs.runChef('bake')
16 structure = fs.getStructure('kitchen/_counter')
17 assert structure['index.html'] == 'First\n'
18
19 time.sleep(1)
20 fs.withPage('posts/2017-01-02_second.html', {'title': "Second"},
21 "something else")
22 fs.runChef('bake')
23 structure = fs.getStructure('kitchen/_counter')
24 assert structure['index.html'] == 'Second\nFirst\n'
25