python-3.x - 得到“ValueError:选项名称 {'--alluredir'} 已添加”
问题描述
再会。有这样的代码:
import pytest
import requests
import json
from jsonschema import validate
class DogTest:
def test_status_code(self):
res = requests.get("https://dog.ceo/api/breeds/list/all")
assert res.status_code == 200
def test_list_all_breeds_app_j(self):
res = requests.get("https://dog.ceo/api/breeds/list/all")
assert res.headers["Content-Type"] == "application/json"
def test_list_all_breeds_schema(self):
res = requests.get("https://dog.ceo/api/breeds/list/all")
schema = {
"type": "object",
"properties": {
"message": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
}
},
"status": {
"type": "string"
}
},
"required": ["message", "status"]
}
validate(instance=res.json(), schema=schema)
@pytest.mark.parametrize("single_breed", ["zhoochka"])
def test_breed_not_exists(self, single_breed):
res = requests.get(f"https://dog.ceo/api/breed/{single_breed}/images",
params={'single_breed': single_breed})
response_body = res.json()
assert response_body["message"] == "Breed not found (master breed does not exist)"
assert response_body["status"] == "error"
assert response_body["code"] == 404
@pytest.mark.parametrize('dog, subdog', [("bulldog", ['boston', 'english', 'french']),
("mountain", ['bernese', 'swiss'])])
def test_some_subbreed(self, dog, subdog):
res = requests.get(f"https://dog.ceo/api/breed/{dog}/list",
params={'dog': dog})
response_body = res.json()
assert response_body['message'] == subdog
assert response_body['status'] == 'success'
以前,代码正在执行。但是现在,在我allure-pytest
为另一个项目安装插件后,出现以下错误:
据我了解,pytest
正在尝试conftest.py
从使用 的项目中读取allure-pytest
,但该项目位于其自己的目录中,该目录不是此代码的根目录。如何修复此错误?
解决方案
推荐阅读
- laravel - 跳过不在 Laravel 关系表中的行
- vb.net - 向 Zebra 标签打印机发送命令
- javascript - getTime() 与 Date.now() 有什么区别
- amazon-web-services - 如何将路线传送到 lightsail 实例
- flutter - 如何让flutter searchDelagate成为一个可以独立导航到的独立屏幕?
- sql - 与以前的销售额相比,每天计算销售额
- angular - 角度:等待异步数据
- linux - yum 更新显示已安装的软件包版本
- javascript - 我的 aws Lambda 函数是否有任何错误?
- sql - 当时间范围在两天之间时如何获取特定时间范围内的记录