MCPcopy
hub / github.com/eudicots/Cactus / test_call

Method test_call

cactus/tests/test_plugins.py:47–74  ·  view source on GitHub ↗

Check that plugins get called

(self)

Source from the content-addressed store, hash-verified

45 self.assertEqual(-1, plugin.ORDER)
46
47 def test_call(self):
48 """
49 Check that plugins get called
50 """
51 self._load_test_plugin('test.py', 'call.py')
52 plugins = self.site.plugin_manager.plugins
53
54 plugin = plugins[0]
55
56 self.assertEqual('plugin_call', plugin.plugin_name) # Just to check we're looking at the right one.
57
58 self.site.build()
59
60 # preBuild
61 self.assertEqual(1, len(plugin.preBuild.calls))
62 self.assertEqual((self.site,), plugin.preBuild.calls[0]['args'])
63
64 # preBuildPage
65 self.assertEqual(len(self.site.pages()), len(plugin.preBuildPage.calls))
66 for call in plugin.preBuildPage.calls:
67 self.assertIn(len(call['args']), (3, 4))
68
69 # postBuildPage
70 self.assertEqual(len(self.site.pages()), len(plugin.postBuildPage.calls))
71
72 #postBuild
73 self.assertEqual(1, len(plugin.postBuild.calls))
74 self.assertEqual((self.site,), plugin.postBuild.calls[0]['args'])

Callers

nothing calls this directly

Calls 3

_load_test_pluginMethod · 0.95
pagesMethod · 0.80
buildMethod · 0.45

Tested by

no test coverage detected