Skip to content
This repository was archived by the owner on Jul 15, 2019. It is now read-only.

Commit c96e710

Browse files
author
Anders Eurenius
committed
Command line changes for graph combining
1 parent e823c9a commit c96e710

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

graphwalker/cli.py

+16-7
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@
2121
[--test-name=some_random_name]
2222
[--debug]
2323
[--debugger=mod.class:a,b,ka=va,kb=vb]
24-
<model> [<actor>]
24+
<model/actor>...
2525
graphwalker -h|--help
2626
27-
Model is normally a graph file
27+
Model is the graph file
2828
29-
Actor is the code module or class
29+
Actor is the code module or class.
30+
The default is 'graphwalker.dummy.Mute', which does nothing.
3031
3132
Built-in stopconds, defaults:
3233
Never
@@ -60,29 +61,37 @@
6061
graphwalker \\
6162
--reporter=Print:output=stderr --reporter=Log \\
6263
--planner=Goto:wake,happy,sad --planner=Interactive \\
63-
--stop=Coverage:edges=100
64+
--stop=Coverage:edges=100 \\
6465
model.dot fleb.Fleb
6566
"""
6667

6768

6869
def run(args):
6970
sys.path.append('')
71+
modact = args['<model/actor>']
72+
assert len(modact) > 1
7073

7174
reporter = reporting.build(args.get('--reporter') or [])
7275
suite_name = args.get('--suite-name') or 'graphwalker'
7376

7477
test_name = args.get('--test-name') or (
75-
args['<model>'].rsplit('/', 1)[-1].split('.')[0] + '-' +
78+
modact[0].rsplit('/', 1)[-1].split('.')[0] + '-' +
7679
time.strftime('%Y%m%d%H%M%S'))
7780

7881
reporter.start_suite(suite_name)
7982

8083
plan = planning.build(args.get('--planner') or ['Random'])
8184
stop = stopcond.build(args.get('--stopcond') or 'Coverage')
8285

83-
model = graph.Graph.read(args['<model>'])
86+
model = graph.Graph.read(modact[0])
87+
for n in modact[1:-1]:
88+
model = model.combine(graph.Graph.read(n))
8489

85-
actor = args.get('<actor>') or 'graphwalker.dummy.Mute'
90+
try:
91+
model = model.combine(graph.Graph.read(modact[-1]))
92+
actor = 'graphwalker.dummy.Mute'
93+
except:
94+
actor = modact[-1]
8695

8796
debugger = args.get('--debug') and args.get('--debugger')
8897

0 commit comments

Comments
 (0)