Mercurial > piecrust2
comparison tests/test_baking_baker.py @ 991:1857dbd4580f
bake: Fix bugs introduced by bake optimizations, of course.
- Make the execution stats JSON-serializable.
- Re-add ability to differentiate between sources used during segment rendering
and during layout rendering. Fixes problems with cache invalidation of
pages that use other sources.
- Make taxonomy-related stuff JSON-serializable.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 20 Nov 2017 23:06:47 -0800 |
parents | 8adc27285d93 |
children | 298b07a899b5 |
comparison
equal
deleted
inserted
replaced
990:22cf13b86cc3 | 991:1857dbd4580f |
---|---|
21 "something else") | 21 "something else") |
22 fs.runChef('bake') | 22 fs.runChef('bake') |
23 structure = fs.getStructure('kitchen/_counter') | 23 structure = fs.getStructure('kitchen/_counter') |
24 assert structure['index.html'] == 'Second\nFirst\n' | 24 assert structure['index.html'] == 'Second\nFirst\n' |
25 | 25 |
26 | |
27 def test_bake_four_times(): | |
28 fs = (mock_fs() | |
29 .withConfig({'site': { | |
30 'default_format': 'none', | |
31 'default_page_layout': 'none', | |
32 'default_post_layout': 'none', | |
33 }}) | |
34 .withPage('pages/_index.html', {'layout': 'none', 'format': 'none'}, | |
35 "{% for p in pagination.posts -%}\n" | |
36 "{{p.title}}\n" | |
37 "{% endfor %}") | |
38 .withPage('posts/2017-01-01_first.html', {'title': "First"}, | |
39 "something 1") | |
40 .withPage('posts/2017-01-02_second.html', {'title': "Second"}, | |
41 "something 2")) | |
42 with mock_fs_scope(fs): | |
43 fs.runChef('bake') | |
44 structure = fs.getStructure('kitchen/_counter') | |
45 assert structure['index.html'] == 'Second\nFirst\n' | |
46 assert structure['2017']['01']['01']['first.html'] == 'something 1' | |
47 assert structure['2017']['01']['02']['second.html'] == 'something 2' | |
48 | |
49 fs.runChef('bake') | |
50 structure = fs.getStructure('kitchen/_counter') | |
51 assert structure['index.html'] == 'Second\nFirst\n' | |
52 assert structure['2017']['01']['01']['first.html'] == 'something 1' | |
53 assert structure['2017']['01']['02']['second.html'] == 'something 2' | |
54 | |
55 fs.runChef('bake') | |
56 structure = fs.getStructure('kitchen/_counter') | |
57 assert structure['index.html'] == 'Second\nFirst\n' | |
58 assert structure['2017']['01']['01']['first.html'] == 'something 1' | |
59 assert structure['2017']['01']['02']['second.html'] == 'something 2' | |
60 | |
61 fs.runChef('bake') | |
62 structure = fs.getStructure('kitchen/_counter') | |
63 assert structure['index.html'] == 'Second\nFirst\n' | |
64 assert structure['2017']['01']['01']['first.html'] == 'something 1' | |
65 assert structure['2017']['01']['02']['second.html'] == 'something 2' | |
66 |