I’m implementing support for some measurement equipment in OpenTAP and I’d like to have the following structure:
-
MyBasePlugin that contains
MyBaseInstrument
class and a test step that accepts instruments ofMyBaseInstrument
type -
MyPlugin1 that contains
MyInstrument1
class derived fromMyBaseInstrument
-
MyPlugin2 that contains
MyInstrument2
class derived fromMyBaseInstrument
That works fine in case all classes are located in the same plugin, but if I try to do it as described above, I’m facing some issues. They can be reproduced using PluginExample:
clr.AddReference("Python.PluginExample")
import Python.PluginExample as PluginExample
BasicInstrument = PluginExample.BasicInstrument
@Attribute(BrowsableAttribute, True)
class MyInstrument1(BasicInstrument):
pass
Building causes the following error:
The type or namespace name 'BasicInstrument' does not exist in the namespace 'Python' (are you missing an assembly reference?)
'MyInstrument1.load_instance()': no suitable method found to override
The name 'load' does not exist in the current context
'MyInstrument1' does not contain a definition for 'getValue' and the best extension method overload 'PythonWrapperExtensions.getValue(IPythonWrapper, string, Type)' requires a receiver of type 'IPythonWrapper'
'MyInstrument1' does not contain a definition for 'setValue' and the best extension method overload 'PythonWrapperExtensions.setValue(IPythonWrapper, string, object)' requires a receiver of type 'IPythonWrapper'
'MyInstrument1' does not contain a definition for 'getValue' and the best extension method overload 'PythonWrapperExtensions.getValue(IPythonWrapper, string, Type)' requires a receiver of type 'IPythonWrapper'
'MyInstrument1' does not contain a definition for 'setValue' and the best extension method overload 'PythonWrapperExtensions.setValue(IPythonWrapper, string, object)' requires a receiver of type 'IPythonWrapper'
'MyInstrument1' does not contain a definition for 'Call' and the best extension method overload 'PythonWrapperExtensions.Call<double>(IPythonWrapper, string, params object[])' requires a receiver of type 'IPythonWrapper'
Just as an experiment, if I do BasicInstrument = TapPlugin(PluginExample.BasicInstrument)
instead, it builds successfully and MyInstrument1
can be added in the Editor. Although it shows some errors and the properties of BasicInstrument
are of course gone.
Is there a way to do what I’m trying to do?