Permalink
Browse files

graphstrategy: support a compatibility format for transitions with via

GraphStrategies have an additional 'via' keyword argument for
transitions. This change allows specifying this by using labgrid-client
-s shell:off,barebox which translates to transition('shell',
via=['off', 'barebox']).

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
  • Loading branch information...
jluebbe committed Jul 18, 2018
1 parent 29ea9be commit a986f6674c63f3a2275708c07d08249cafa7cbf6
Showing with 12 additions and 0 deletions.
  1. +5 −0 labgrid/strategy/graphstrategy.py
  2. +7 −0 tests/test_graphstrategy.py
@@ -104,6 +104,11 @@ def invalidate(self):
@step(args=['state'])
def transition(self, state, via=None):
# for use with labgrid-client -s, if only state is set, try to extract
# the via states
if ':' in state and via is None:
state, via = state.split(':')
via = via.split(',')
via = via or []
try:
# check if another transition is running
@@ -210,6 +210,13 @@ def test_transition_via(graph_strategy):
assert graph_strategy.transition('D', via=['A2']) == ['Root', 'A2', 'B', 'C1', 'D']
assert graph_strategy.path == ['Root', 'A2', 'B', 'C1', 'D']
graph_strategy.invalidate()
assert graph_strategy.transition('D:A2') == ['Root', 'A2', 'B', 'C1', 'D']
assert graph_strategy.path == ['Root', 'A2', 'B', 'C1', 'D']
assert graph_strategy.transition('D:C2,A2') == ['Root', 'A2', 'B', 'C2', 'D']
assert graph_strategy.path == ['Root', 'A2', 'B', 'C2', 'D']
@pytest.mark.dependency(depends=['api-works',
'test_transition',

0 comments on commit a986f66

Please sign in to comment.