Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
为什么 Pytest 对夹具参数执行嵌套循环
使用 Pytest 我想编写一个测试函数 该函数接受多个装置作为参数 每个灯具都有几个参数 例如 test demo py 中是一个函数test squared is less than 10需要固定装置 negative integer
python
Pytest
fixtures
从 PYCHARM 运行时使 PYTEST 更安静
更新 下面显示的消息不受 pytest 各种 q 安静选项控制 它们来自 TeamCity 插件 请参阅下面我的回答 原文 我已经阅读了用于沉默 pytest 的现有堆栈溢出答案 但没有人告诉我如何沉默我收到的大量冗余 测试通过 消息 我有
python
pycharm
Pytest
GET 错误:ModuleNotFoundError:没有名为“api”的模块
当我尝试运行 pytest 命令时出现错误 错误是当我在 docker 上运行应用程序时 当我在本地执行时 它可以工作 还有另一个好奇心 swagger 和 de requests 工作正常 只是测试文件不行 我已经尝试过 python m
python
Docker
dockercompose
Pytest
FastAPI
pytest:同一接口的不同实现的可重用测试
想象一下我已经实现了一个名为的实用程序 可能是一个类 Bar在一个模块中foo 并为其编写了以下测试 测试 foo py from foo import Bar as Implementation from pytest import ma
python
unittesting
Pytest
pytest 与 setup.py 测试
我使用说明 描述了here https pytest org latest goodpractices html integrating with setuptools python setup py test pytest runner
python
Pytest
如何在 pytest 中将单元测试和集成测试分开
根据维基百科 https en wikipedia org wiki Unit testing Description和各种articles https techbeacon com devops 6 best practices inte
python
unittesting
Testing
integrationtesting
Pytest
Pytest报告摘要显示错误信息
我对 pytest 挂钩和插件相对较新 我无法弄清楚如何让我的 pytest 代码为我提供测试执行摘要以及失败原因 考虑代码 class Foo def init self val self val val def test compare
python
Pytest
模拟pytest中的异常终止
我的多线程应用程序遇到了一个错误 主线程的任何异常终止 例如 未捕获的异常或某些信号 都会导致其他线程之一死锁 并阻止进程干净退出 我解决了这个问题 但我想添加一个测试来防止回归 但是 我不知道如何在 pytest 中模拟异常终止 如果我只
python
Multithreading
Testing
Pytest
falcon,AttributeError:“API”对象没有属性“create”
我正在尝试测试我的猎鹰路线 但测试总是失败 而且看起来我把所有事情都做对了 my app py import falcon from resources static import StaticResource api falcon API
python
python3x
Pytest
falconframework
使用 Pytest 的参数化添加测试功能的描述
当其中一个测试失败时 可以在测试正在测试的内容的参数化中添加描述 快速了解测试失败的原因 有时您不知道测试失败的原因 您必须查看代码 通过每个测试的描述 您就可以知道 例如 pytest mark parametrize num1 num2
python
Pytest
Pytest 固定装置的范围“类”在每个方法上运行
我正在尝试使用 Pytest 创建一个测试环境 这个想法是将测试方法分组到类中 对于每个班级 小组 我想附上config将要参数化的夹具 这样我就可以使用 配置 A 运行所有测试 然后使用 配置 B 运行所有测试 依此类推 但同时 我也想要
python
Pytest
如何全局安装 Python(开发)依赖项,以便我不必在每个 venv 中重新安装它们?
我希望在为每个项目创建的每个 venv 虚拟环境 中都可以使用一些 Python 依赖项 例如 black flake8 和 pytest 这可能吗 如果可以 如何实现 我想安装这三个once在我的主要 Python 安装下 我必须在启动新
python
Pytest
GLOBAL
pythonvenv
flake8
如何将脚本作为 pytest 测试运行
假设我有一个用简单脚本表示的测试assert 陈述 请参阅背景了解原因 例如 import foo assert foo 3 4 我如何以一种好的方式将该脚本包含在我的 pytest 测试套件中 我尝试了两种有效但不太好的方法 一种方法是将
python
Testing
Pytest
pytest.raises(Error) 如何工作?
对 Python 来说是新手 但我试图理解这段代码 with pytest raises ValueError group adjust vals grps 1 grps 2 weights 看完之后本教程与 http effbot org
python
Pytest
Django Channels Postgres InterfaceError:连接已关闭
我似乎无法理解这里的问题 我正在为我的渠道消费者编写测试文档中的描述 https channels readthedocs io en latest topics testing html 我通常会使用 Django 默认的单元测试 但由于
django
postgresql
Pytest
pythonasyncio
djangochannels
如何在“python setup.py test”中运行 py.test 和 linter
我有一个项目setup py文件 我用pytest作为测试框架 我还在我的代码上运行各种 linter pep8 pylint pydocstyle pyflakes ETC 我用tox在多个 Python 版本中运行它们 并使用以下命令构
python
python27
Pytest
setuppy
Pytest:如何使用从夹具返回的列表来参数化测试?
我想使用由固定装置动态创建的列表来参数化测试 如下所示 pytest fixture def my list returning fixture depends on other fixtures return a dynamically
python
Pytest
使用 pytest 动态控制测试顺序
我想使用逻辑来控制测试的顺序 该逻辑将在它们已经运行时动态地重新排序它们 我的用例是这样的 我使用 xdist 并行化我的测试 每个测试都使用来自公共且有限池的外部资源 某些测试比其他测试使用更多的资源 因此在任何给定时间 当只有一小部分资
Pytest
xdist
如何将 pytest 装置与 django TestCase 一起使用
我如何在TestCase方法 类似问题的几个答案似乎暗示我的例子应该有效 import pytest from django test import TestCase from myapp models import Category py
python
django
Pytest
djangotests
pytestdjango
将固定装置传递给 pytest 中的测试类
考虑以下伪代码来演示我的问题 import pytest pytest fixture def param1 return smth yield wilma pytest fixture def param2 return smth yie
python
Pytest
1
2
3
4
5
6
...22
»