Mercurial > piecrust2
changeset 145:dce37d1d4f05
Fix unit tests.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 29 Nov 2014 20:55:41 -0800 |
parents | 8d16ca75075f |
children | 0609739169bd |
files | tests/test_baking_baker.py |
diffstat | 1 files changed, 13 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test_baking_baker.py Sat Nov 29 20:51:30 2014 -0800 +++ b/tests/test_baking_baker.py Sat Nov 29 20:55:41 2014 -0800 @@ -50,11 +50,12 @@ def test_empty_bake(): fs = mock_fs() with mock_fs_scope(fs): - assert not os.path.isdir(fs.path('kitchen/_counter')) + out_dir = fs.path('kitchen/_counter') + assert not os.path.isdir(out_dir) app = fs.getApp() - baker = Baker(app) + baker = Baker(app, out_dir) baker.bake() - assert os.path.isdir(fs.path('kitchen/_counter')) + assert os.path.isdir(out_dir) structure = fs.getStructure('kitchen/_counter') assert list(structure.keys()) == ['index.html'] @@ -64,8 +65,9 @@ .withPage('posts/2010-01-01_post1.md', {'layout': 'none', 'format': 'none'}, 'post one') .withPage('pages/_index.md', {'layout': 'none', 'format': 'none'}, "something")) with mock_fs_scope(fs): + out_dir = fs.path('kitchen/_counter') app = fs.getApp() - baker = Baker(app) + baker = Baker(app, out_dir) baker.bake() structure = fs.getStructure('kitchen/_counter') assert structure == { @@ -77,8 +79,9 @@ .withPage('pages/foo.md', {'layout': 'none', 'format': 'none'}, 'a foo page') .withPage('pages/_index.md', {'layout': 'none', 'format': 'none'}, "something")) with mock_fs_scope(fs): + out_dir = fs.path('kitchen/_counter') app = fs.getApp() - baker = Baker(app) + baker = Baker(app, out_dir) baker.bake() structure = fs.getStructure('kitchen/_counter') assert structure == { @@ -87,7 +90,7 @@ os.remove(fs.path('kitchen/pages/foo.md')) app = fs.getApp() - baker = Baker(app) + baker = Baker(app, out_dir) baker.bake() structure = fs.getStructure('kitchen/_counter') assert structure == { @@ -97,20 +100,21 @@ fs = (mock_fs() .withPage('pages/foo.md', {'layout': 'none', 'format': 'none'}, 'a foo page')) with mock_fs_scope(fs): + out_dir = fs.path('kitchen/_counter') app = fs.getApp() - baker = Baker(app) + baker = Baker(app, out_dir) baker.bake() mtime = os.path.getmtime(fs.path('kitchen/_counter/foo.html')) app = fs.getApp() - baker = Baker(app) + baker = Baker(app, out_dir) baker.bake() assert mtime == os.path.getmtime(fs.path('kitchen/_counter/foo.html')) BakeRecord.RECORD_VERSION += 1 try: app = fs.getApp() - baker = Baker(app) + baker = Baker(app, out_dir) baker.bake() assert mtime < os.path.getmtime(fs.path('kitchen/_counter/foo.html')) finally: