I am trying to dynamically create a valueset in the suite setup according to an example I found here: New keyword: "Add Value To Set" · nestoracunablanco/pabot@ea50f30 · GitHub
from pabot import pabotlib
...
@library(scope='GLOBAL', version='1.0')
class MyLib(DynamicCore):
...
def start_suite(self, data, result):
"""
Robot listener called when a test suite starts.
"""
lib = pabotlib.PabotLib()
my_value_set_1 = {"key": "someVal1", "tags": "valueset1,common"}
my_value_set_2 = {"key": "someVal2", "tags": "valueset2,common"}
lib.add_value_to_set("MyValueSet1", my_value_set_1)
lib.add_value_to_set("MyValueSet2", my_value_set_2)
log(f"{lib._values=}")
lib.acquire_value_set("common")
...
And then running my test set with
pabot --pabotlib --processes 2 --variablefile myvars.py tests/suite1 tests/suite2
But this results in an error: Value set cannot be aquired. It was never imported or all are disabled. Use --resourcefile option to import.
The log line correctly logs the new value sets. But if I add this log line in _PabotLib, then I get an empty dict.
class _PabotLib(object):
...
def acquire_value_set(self, caller_id, *tags):
log(f"In _PabotLib {self._values=}")
...
What am I doing wrong? Why is the self._values
not correctly updated when acquire_value_set
in _PabotLib
uses it?