I'm using the traceability plugin for python-sphinx: sphinx traceaility plugin
The test has the following .rst documentation:
@rst
.. item:: TST-Example
:applicable_to: PRD-ALL
@endrst
and I want to convert PRD-ALL to a list of predefined products PRD-A PRD-B.
So I was thinking to add this logic inside the traceability_callback_per_item callback which is provided by the plugin:
def traceability_callback_per_item(name, collection):
item = collection.get_item(name)
if name.startswith('TST-'):
applicable_to = list(item.iter_targets('applicable_to'))
if 'PRD-ALL' in applicable_to:
collection.add_relation(item.identifier, 'applicable_to', 'PRD-A')
collection.add_relation(item.identifier, 'applicable_to', 'PRD-B')
# remove PRD-ALL from 'applicable_to' relation:
# HOW?
I tried:
item.remove_targets('PRD-ALL', explicit=True, implicit=True, relations=['applicable_to'])
but then I get the warning:
WARNING: No automatic reverse relation: TST-Example applicable_to PRD-ALL
which fails the build as it intentionally runs with -W.
Any idea?
Found a solution eventually, possibly not the 'right' way but it works:
Note that
covered_byis specified in thetraceability_relationsglobal variable: