Using plugs for sequences defined in a separate folder
The documentation for using plugs seems clear to me for sequences that are defined in a test plan.
However, in the proposed single repository structure, a separate folder for test_sequences
is described. This seems the desirable approach for re-usability of sequences, however, it is not clear to me what it would look like to instantiate a plug and use on imported sequences.
In the following example, I am would like to use the file_copier_plug in sequence_A.py
as instantiated in main.py
. Thank you!
# test_sequences/sequence_A/sequence_A.py
from spintop_openhtf import TestSequence
my_sequence = TestSequence('my-sequence')
@my_sequence.testcase('Test1')
def do_something(test, copy_plug):
# do something with copy plug here
pass
# test_tools/lib_A/tools_A1.py
import shutil
from openhtf.plugs import BasePlug
class FileCopier(BasePlug):
def copy_file(self, source_file, destination_folder):
shutil.copy(source_file, destination_folder)
# main.py
from spintop_openhtf import TestPlan
from test_sequences.sequence_A.sequence_a import my_sequence
from test_tools.lib_A.tools_A1 import FileCopier
file_copier_plug = FileCopier.as_plug('file_copier_plug')
plan = TestPlan('my-plan')
plan.append(my_sequence)