1 Star 0 Fork 0

SpaceInvader/MugenGccTest

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
combination_parser.py 2.93 KB
一键复制 编辑 原始数据 按行查看 历史
SpaceInvader 提交于 2024-03-05 01:39 +08:00 . add
import json
class combination:
def __init__(self):
self.env = [
{
"type": "host",
"name": "host_1",
"ip": "127.0.0.1",
"password": "openEuler12#$",
"port": "22",
"user": "root",
}
]
self.combinations = [
{
"name": "mugen_test",
"testcases": [
]
}
]
self.execute = [
{
"env":["host_1"],
"combination":"mugen_test"
}
]
def add_case(self , testsuite , testcase):
flag = False
for suite in self.combinations[0]['testcases']:
if suite['testsuite'] == testsuite:
if testcase not in suite['add']:
suite['add'].append(testcase)
flag = True
break
if not flag:
self.combinations[0]['testcases'].append(
{
"testsuite":testsuite ,
"add":[testcase]
}
)
def export_json(self):
dicts = {
'env' : self.env ,
'combination' : self.combinations ,
'execute' : self.execute
}
with open('test.json' , 'w') as f:
f.write(json.dumps(dicts , indent=4))
def export_one_json(self , testsuite , path='.' , id=0):
dicts = {
'env' : self.env ,
'combination' : [
{
"name": "mugen_test",
"testcases": [
]
}
],
'execute' : self.execute
}
for testcase in self.combinations[0]['testcases']:
if testcase['testsuite'] == testsuite:
dicts['combination'][0]['testcases'].append(testcase)
if not dicts['combination'][0]['testcases']:
print('no such testsuite: ',testsuite)
exit(-1)
with open(path+'/'+testsuite+'_'+str(id)+'.json' , 'w') as f:
f.write(json.dumps(dicts , indent=4))
def export_every_json(self):
for testsuite in self.combinations[0]['testcases']:
dicts = {
'env' : self.env ,
'combination' : [
{
"name": "mugen_test",
"testcases": [
testsuite
]
}
] ,
}
with open(testsuite['testsuite']+'_test.json' , 'w') as f:
f.write(json.dumps(dicts , indent=4))
def clear_one_testsuite(self , testsuite):
for testsuite1 in combination[0]['testcases']:
if testsuite1['testsuite'] == testsuite:
combination['testcases'].remove(testsuite1)
break
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Paged/mugen-gcc-test.git
git@gitee.com:Paged/mugen-gcc-test.git
Paged
mugen-gcc-test
MugenGccTest
master

搜索帮助