forked from rh-lab-q/rpg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented plugin engine (fix rh-lab-q#11)
- Loading branch information
Showing
7 changed files
with
117 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rpg.plugin import Plugin | ||
|
||
|
||
class TestPlugin(Plugin): | ||
|
||
def before_patches_applied(self, project_dir, spec, sack): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import rpg | ||
|
||
|
||
class A: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from support import PluginTestCase | ||
from rpg import plugin_engine as engine | ||
from tests.project.py.plugin0 import TestPlugin | ||
from unittest import mock | ||
|
||
|
||
class PluginEngineTest(PluginTestCase): | ||
|
||
def setUp(self): | ||
self.plugin_engine = engine.PluginEngine(self.spec, self.sack) | ||
|
||
def test_load_plugins(self): | ||
self.plugin_dir = self.test_project_dir / "py" | ||
self.plugin_engine.load_plugins(self.plugin_dir) | ||
self.assertEqual(len(self.plugin_engine.plugins), 1) | ||
self.assertTrue( | ||
isinstance(self.plugin_engine.plugins.pop(), TestPlugin)) | ||
|
||
def test_execute_phase(self): | ||
self.plugin_engine.plugins = [mock.MagicMock()] | ||
self.plugin_engine.execute_phase( | ||
engine.phases[0], self.test_project_dir) | ||
expected_call = [ | ||
mock.call(self.test_project_dir, self.spec, self.sack)] | ||
plugin_call = getattr( | ||
self.plugin_engine.plugins[0], engine.phases[0]).call_args_list | ||
self.assertEqual(plugin_call, expected_call) |