mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-09-02 11:22:41 +01:00
Fix Plugin and tests
WA2 Extensions had two features that have proven more trouble then they are worth, and so they were removed from WA3 Plugins: - Virtual methods (methods that automatically invoked super's version without having to explicitly do that). - It used to be possible to use strings or tuples to specify parameters for extensions, and those were automatically "promoted" to Parameter instances by the metaclass. This feature was never actually used. This commit cleans up residual code for these features from Plugin implementations and removes tests that used to exercise them.
This commit is contained in:
@@ -23,7 +23,6 @@ class TestDevice(Plugin):
|
||||
kind = 'device'
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.modules = []
|
||||
self.boot_called = 0
|
||||
self.push_file_called = 0
|
||||
self.pull_file_called = 0
|
||||
|
@@ -44,15 +44,8 @@ class PluginLoaderTest(TestCase):
|
||||
|
||||
|
||||
|
||||
class MyMeta(PluginMeta):
|
||||
|
||||
virtual_methods = ['validate', 'virtual1', 'virtual2']
|
||||
|
||||
|
||||
class MyBasePlugin(Plugin):
|
||||
|
||||
__metaclass__ = MyMeta
|
||||
|
||||
name = 'base'
|
||||
kind = 'test'
|
||||
|
||||
@@ -166,43 +159,6 @@ class PluginMetaTest(TestCase):
|
||||
7,
|
||||
]
|
||||
|
||||
def test_virtual_methods(self):
|
||||
acid = MyAcidPlugin()
|
||||
acid.virtual1()
|
||||
assert_equal(acid.v1, 1)
|
||||
assert_equal(acid.vv1, 1)
|
||||
assert_equal(acid.v2, 0)
|
||||
assert_equal(acid.vv2, 0)
|
||||
assert_equal(acid.v3, 'acid')
|
||||
acid.virtual2()
|
||||
acid.virtual2()
|
||||
assert_equal(acid.v1, 1)
|
||||
assert_equal(acid.vv1, 1)
|
||||
assert_equal(acid.v2, 2)
|
||||
assert_equal(acid.vv2, 2)
|
||||
|
||||
def test_initialization(self):
|
||||
class MyExt(Plugin):
|
||||
name = 'myext'
|
||||
kind = 'test'
|
||||
values = {'a': 0}
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(MyExt, self).__init__(*args, **kwargs)
|
||||
self.instance_init = 0
|
||||
def initialize(self, context):
|
||||
self.values['a'] += 1
|
||||
|
||||
class MyChildExt(MyExt):
|
||||
name = 'mychildext'
|
||||
def initialize(self, context):
|
||||
self.instance_init += 1
|
||||
|
||||
ext = MyChildExt()
|
||||
ext.initialize(None)
|
||||
|
||||
assert_equal(MyExt.values['a'], 1)
|
||||
assert_equal(ext.instance_init, 1)
|
||||
|
||||
|
||||
class ParametersTest(TestCase):
|
||||
|
||||
|
Reference in New Issue
Block a user