1030
|
1 from .mockutil import mock_fs, mock_fs_scope
|
|
2
|
|
3
|
|
4 def test_no_plugins():
|
|
5 fs = (mock_fs()
|
|
6 .withConfig())
|
|
7 with mock_fs_scope(fs):
|
|
8 app = fs.getApp()
|
|
9 assert len(app.plugin_loader.plugins) == 1
|
|
10 assert app.plugin_loader.plugins[0].name == '__builtin__'
|
|
11
|
|
12
|
|
13 testplug_code = """from piecrust.plugins.base import PieCrustPlugin
|
|
14
|
|
15 class TestPlugPlugin(PieCrustPlugin):
|
|
16 name = 'just a test plugin'
|
|
17
|
|
18 __piecrust_plugin__ = TestPlugPlugin
|
|
19 """
|
|
20
|
|
21 def test_loose_file():
|
|
22 fs = (mock_fs()
|
|
23 .withConfig({'site': {'plugins': 'testplug'}})
|
|
24 .withFile('kitchen/plugins/testplug.py', testplug_code))
|
|
25 with mock_fs_scope(fs):
|
|
26 app = fs.getApp()
|
|
27 assert sorted([p.name for p in app.plugin_loader.plugins]) == \
|
|
28 sorted(['__builtin__', 'just a test plugin'])
|