-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
82 lines (63 loc) · 1.95 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 24 10:23:11 2021
@author: 皓
"""
import os.path as osp
import sys
import platform
from argparse import ArgumentParser
from subprocess import call
# from rpcpy32.server import PYTHON
DIR = osp.dirname(__file__)
if DIR not in sys.path:
sys.path.append(DIR)
# PY32 = PYTHON
def argument_parse():
parser = ArgumentParser()
parser.add_argument("--call", '-c', action='store_true')
return parser.parse_args()
def test_chrapi():
from pychariot.const import CHR_DETAIL_LEVEL
from pychariot.chrapi import LocalCHRAPI
chrapis = LocalCHRAPI()
# chrapis = CHRAPI(r'D:\Users\皓\Desktop\IxChariot')
print(chrapis.CHR_api_initialize(CHR_DETAIL_LEVEL.CHR_DETAIL_LEVEL_ALL))
print(chrapis.CHR_api_get_version())
print(chrapis.CHR_api_get_return_msg(113))
print(chrapis.CHR_api_get_port_mgmt_ip_list())
def test_chariot():
from pychariot import Chariot
chariot = Chariot()
chariot.connect('localhost')
print(chariot.api_initialize())
print(chariot.api_get_version())
def test_new_api():
from pychariot32.wrapper import CHR, Test
from typing import get_type_hints
chariot = CHR()
print('-------------------------')
print(chariot.initialize(0) == '')
print(chariot.get_return_msg(118))
print('-------------------------')
print(chariot.aptixia_version)
print(get_type_hints(chariot.get_pair_type))
test = Test()
print(test)
# print(chariot.build_level, type(chariot.build_level))
def test_win32():
arch = platform.architecture()[0]
if '64bit' == arch:
args = argument_parse()
if args.call:
print('请勿循环启动')
return
cmd = [PY32, __file__, '-c']
call(cmd)
else:
test_chrapi()
def main():
# test_chariot()
test_new_api()
if __name__ == '__main__':
main()