def account_test(ctx, type, case): # master_proc = subprocess.Popen(("yarn dev -l trace master &").split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE, preexec_fn=os.setsid) # time.sleep(2) # os.system("yarn dev -l trace watcher &"); time.sleep(2) # os.system("yarn dev -l trace md -s passive &"); time.sleep(2) # os.system("yarn dev -l trace td -s passive -a test &"); time.sleep(5) pass_ctx_from_parent(ctx) test_io_location = pyyjj.location(pyyjj.mode.LIVE, pyyjj.category.SYSTEM, "test", "test", ctx.locator) io_device = pyyjj.io_device_client(test_io_location, False) click.echo('account test') td_location = pyyjj.location(pyyjj.mode.LIVE, pyyjj.category.TD, 'passive', 'test', ctx.locator) td_passive_rep_sock = ctx.io_device.connect_socket(td_location, pyyjj.protocol.REQUEST) # send_to_passive(ctx, td_passive_rep_sock, td_location, {'msg_type': 401,'state': 3}) watcher_location = pyyjj.location(pyyjj.mode.LIVE, pyyjj.category.SYSTEM, "watcher", "watcher", ctx.locator) watcher_pub_sock = io_device.connect_socket(watcher_location, pyyjj.protocol.SUBSCRIBE, 30 * 1000) watcher_pub_sock.setsockopt(nn.SUB, nn.SUB_SUBSCRIBE, '') if type == 1: login_test(case, watcher_pub_sock, ctx, td_passive_rep_sock, td_location) if type == 2: trade_test(case, watcher_pub_sock, ctx, td_passive_rep_sock, td_location)
def account(ctx): pass_ctx_from_parent(ctx) click.echo('account test') td_location = pyyjj.location(pyyjj.mode.LIVE, pyyjj.category.TD, 'passive', 'test', ctx.locator) td_passive_rep_sock = ctx.io_device.connect_socket(td_location, pyyjj.protocol.REQUEST) send_to_passive(ctx, td_passive_rep_sock, td_location, { 'msg_type': 401, 'state': 3 })