view tests/test_plugins_base.py @ 1051:971b4d67e82a

serve: Fix problems with assets disappearing between servings. When an asset file changes, its source's pipeline is re-run. But that created a bake record that only had that pipeline's output, so the other outputs were incorrectly considered empty and therefore any stray files were removed. Now we copy over bake records for the pipelines we don't run.
author Ludovic Chabant <ludovic@chabant.com>
date Fri, 26 Jan 2018 18:05:02 -0800
parents c1e062843464
children
line wrap: on
line source

from .mockutil import mock_fs, mock_fs_scope


def test_no_plugins():
    fs = (mock_fs()
          .withConfig())
    with mock_fs_scope(fs):
        app = fs.getApp()
        assert len(app.plugin_loader.plugins) == 1
        assert app.plugin_loader.plugins[0].name == '__builtin__'


testplug_code = """from piecrust.plugins.base import PieCrustPlugin

class TestPlugPlugin(PieCrustPlugin):
    name = 'just a test plugin'

__piecrust_plugin__ = TestPlugPlugin
"""

def test_loose_file():
    fs = (mock_fs()
          .withConfig({'site': {'plugins': 'testplug'}})
          .withFile('kitchen/plugins/testplug.py', testplug_code))
    with mock_fs_scope(fs):
        app = fs.getApp()
        assert sorted([p.name for p in app.plugin_loader.plugins]) == \
          sorted(['__builtin__', 'just a test plugin'])