问题描述
这是项目的路径
D:\QA\test-framework\python-client
这是一个python实现的测试框架
这是包含测试的python文件
D:\QA\test-framework\python-client\tests\test_pytest.py
import os
import aiclub
# from aiclub import AiService
import random,string
import pandas as pd
import pytest
import json
import logging
import allure
#import gsheets_utils
from pytest_steps import test_steps,depends_on
import time
from conftest import initialize_ai_service
exec_log = logging.getLogger('ML_workflow')
logs_dir = 'test_data/logs'
filePath = 'test_data/'
aiservice = initialize_ai_service('https://apigateway.navigator.pyxeda.ai')
@pytest.fixture(autouse=True)
def configure_logging(request,caplog):
log_file = filePath + 'log'
request.config.pluginmanager.get_plugin("logging-plugin").set_log_path(log_file)
caplog.set_level(logging.INFO)
def randomword(length):
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for i in range(length))
def login():
# username and password to login to aiclub
os.environ['username'] = 'pyxeda-test'
os.environ['password'] = 'welcome@123'
response = aiservice.auth()
assert response == True
return response
@depends_on(login)
def create_ai_service():
ai_service_name = randomword(5)
response = aiservice.createService(ai_service_name)
assert len(response) > 0
return response,ai_service_name
def listFiles1(root):
allFiles = []; walk = [root]
while walk:
folder = walk.pop(0)+"/"; items = os.listdir(folder)
for i in items: i=folder+i; (walk if os.path.isdir(i) else allFiles).append(i)
return allFiles
def load_test_params():
json_path = filePath + '/tests/'
json_list = listFiles1(json_path)
test_params = {}
for i in json_list:
with open(i) as json_file:
data = json.load(json_file)
test_params.update(data)
return test_params
TEST_ParaMS = load_test_params()
........
这是我需要运行的测试用例的路径
D:\QA\test-framework\python-client\test_data\tests\curve.json
这是curve.json文件的开头。
{
"Sklearn - Sklearn - Regression - Curve M2" : [
{
"dataimport": {
"
"
"
]
}
这是 tox.ini 文件
[tox]
envlist = py38
[testenv]
deps =
pytest
pytest-html
pytest-sugar
pytest-logger
allure-pytest
pytest-xdist
pytest_steps
datetime
oauth2client
gspread
aiclub
commands =
pytest -s -v -k _workflow --html=test_report.html --alluredir=allure-
results/ -n auto --dist=loadfile
allure serve allure-results
pytest {posargs}
我只需要使用 tox 命令运行这个curve.json
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)