Mercurial > piecrust2
view tests/test_sources_posts.py @ 334:b034f6f15e22
bake: Several bug taxonomy-related fixes for incorrect incremental bakes.
* Improve how the baker processes taxonomy terms and figures out what needs
to be re-baked or not.
* Create bake entries for clean taxnomy terms so they're not deleted by an
incremental bake.
* Add more information to bake records.
* Slugify taxonomy terms is now done by the route in one place.
* Fix a bug where the cache key for invalidating rendered segments was not
computed the same way as when the caching was done.
* Fix how term combinations are passed around, rendered, printed, parsed, etc.
(TODO: more word needed in the routing functions)
* Expose to the template whether a taxonomy term is a combination or not.
* Display term combinations better in the built-in theme.
* Rename `route.taxonomy` to `route.taxonomy_name` to prevent confusion.
* Add options to show bake records for previous bakes.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Fri, 03 Apr 2015 10:59:50 -0700 |
parents | cb6eadea0845 |
children | e7b865f8f335 |
line wrap: on
line source
import os import pytest from .mockutil import mock_fs, mock_fs_scope @pytest.mark.parametrize('fs, src_type, expected_paths, expected_metadata', [ (mock_fs(), 'flat', [], []), (mock_fs().withPage('test/2014-01-01_foo.md'), 'flat', ['2014-01-01_foo.md'], [(2014, 1, 1, 'foo')]), (mock_fs(), 'shallow', [], []), (mock_fs().withPage('test/2014/01-01_foo.md'), 'shallow', ['2014/01-01_foo.md'], [(2014, 1, 1, 'foo')]), (mock_fs(), 'hierarchy', [], []), (mock_fs().withPage('test/2014/01/01_foo.md'), 'hierarchy', ['2014/01/01_foo.md'], [(2014, 1, 1, 'foo')]), ]) def test_post_source_factories(fs, src_type, expected_paths, expected_metadata): fs.withConfig({ 'site': { 'sources': { 'test': {'type': 'posts/%s' % src_type}}, 'routes': [ {'url': '/%slug%', 'source': 'test'}] } }) fs.withDir('kitchen/test') with mock_fs_scope(fs): app = fs.getApp(cache=False) s = app.getSource('test') facs = list(s.buildPageFactories()) paths = [f.rel_path for f in facs] assert paths == expected_paths metadata = [ (f.metadata['year'], f.metadata['month'], f.metadata['day'], f.metadata['slug']) for f in facs] assert metadata == expected_metadata