Skip to content

Commit 77c792e

Browse files
committed
TST: refactoring of test IOC to enable interactive mode
1 parent 9243d66 commit 77c792e

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

ioc/sim_ioc.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Import the basic framework components.
1+
import argparse
2+
23
from softioc import asyncio_dispatcher, builder, softioc
34

45
# Create an asyncio dispatcher, the event loop is now running
@@ -24,6 +25,21 @@
2425
builder.LoadDatabase()
2526
softioc.iocInit(dispatcher)
2627

27-
# Finally leave the IOC running with an interactive shell.
28-
# softioc.interactive_ioc(globals())
29-
softioc.non_interactive_ioc()
28+
if __name__ == "__main__":
29+
parser = argparse.ArgumentParser(
30+
description="Simulated IOC for testing save-and-restore service",
31+
)
32+
33+
parser.add_argument(
34+
"--interactive",
35+
"-i",
36+
dest="interactive",
37+
action="store_true",
38+
help="Start the IOC with interactive shell",
39+
)
40+
41+
args = parser.parse_args()
42+
if args.interactive:
43+
softioc.interactive_ioc(globals())
44+
else:
45+
softioc.non_interactive_ioc()

0 commit comments

Comments
 (0)