Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
我无法在 PyCharm 下运行 Django Python pytest
pytest portal test session starts platform darwin Python 3 6 0 pytest 3 0 6 py 1 4 32 pluggy 0 4 0 Django settings confi
python
django
pycharm
Pytest
pytestdjango
在参数化中传递 pytest 夹具
通过在 pytest mark parametrize 中传递 conftest py 中定义的装置 我收到以下错误 pytest alist 0220 0221 test 1 py v s NameError name alist is
python
parameterpassing
Pytest
fixtures
如何访问 pytest 夹具中的所有标记?
我正在使用 pytest 我想用标记来标记我的测试 这些标记将指定固定装置要在驱动程序中加载哪个页面 这可以轻松地与行为上下文对象一起使用 但我找不到如何使用 pytest 来做到这一点 以这段代码为例 import pytest pyte
python
Pytest
如何告诉 pytest-xdist 按顺序从一个文件夹运行测试,并并行运行其余文件夹?
想象一下我有test unit 可以安全地并行运行并且test functional 目前还不能并行运行 有没有一种简单的方法可以说服 pytest 运行functional依次 考虑到我们正在讨论大量的测试 因此改变每个测试函数 方法将会
python
Pytest
pytestxdist
sqlalchemy:无法在拆卸时删除数据库
我正在尝试使用 pytest 进行 sqlalchemy 但遇到以下问题 pytest fixture scope function def my session my db request from my models import Se
python
sqlalchemy
flasksqlalchemy
Pytest
模拟导入失败
我该如何制作import pkg失败moduleA py 我可以打补丁pkg如果从中导入某些内容则会失败 否则不会失败 test py import os import moduleA from unittest mock import p
python
python3x
mocking
Pytest
pythonunittest
如何从视图中删除单元测试的“@oidc.login_required”?
I use 烧瓶样机 questions tagged flask oidc用于用户登录和pytest questions tagged pytest供测试用 对于单元测试 我想 删除 oidc require login 我怎样才能做到这
unittesting
mocking
Pytest
flaskoidc
运行 py.test 时出现错误 ImportMismatchError
当我在本地运行测试时 它工作正常 但是在创建 docker 并在容器内运行后 我收到以下错误 usr local lib python3 5 site packages pytest config py 325 in getconftest
python
Docker
Pytest
如何在 pytest 中测试类层次结构?
我已经使用 pytest 一段时间了 并学会了喜欢参数化和固定装置 我第一次想测试一些具有分支继承结构的类 当然 我想为子类重用测试用例 假设我有以下包结构 mock pkg child py grandchild py parent py
python
inheritance
Pytest
pytest - ModuleNotFoundError - python 3.6.4
我有一个具有以下布局的项目 MANIFEST in README md init py company init py api init py auth py debug py exceptions py reporting py rest
python
python3x
Pytest
pythonunittest
sys
自定义 pytest junitxml 失败报告
我正在尝试内省测试失败并将附加数据包含到 junit xml 测试报告中 具体来说 这是对外部产品的一套功能测试 我想将产品的日志包含到故障报告中 使用找到的方法here https stackoverflow com questions
python
logging
Pytest
参数化测试也取决于 pytest 中的参数化值
我有一个测试 我有一个设置方法 应该收到一个dataset和一个测试函数 应该为每个运行data in dataset 基本上我需要类似的东西 datasetA data1 a data2 a data3 a datasetB data1
unittesting
Pytest
fixtures
在测试中检查 CLI 的退出代码
我正在为命令行工具编写自动化测试 本质上 我想使用各种选项调用 CLI 并测试退出代码和 或输出 我的测试如下所示 from mymodule cli tool import main def test args capfd with py
python
Pytest
exitcode
在 pytest 中参数化并运行单个测试
如何从配置了参数化的集合中运行单个测试 假设我有以下测试方法 pytest mark parametrize PARAMETERS LIST PARAMETERS VALUES def test my feature self param1
python
python27
Testing
automatedtests
Pytest
pytest 由于 ModuleNotFoundError 失败,但在使用“python -m pytest”时有效
类似于这个OP的问题 https stackoverflow com questions 56755761 filenotfounderror when using python m pytest vs pytest 但反过来说 pytes
python3x
unittesting
Testing
VisualStudioCode
Pytest
Pytest - 测试解析器错误:无法识别的参数
我正在尝试测试一个非常简单的函数 由于多次尝试测试使用参数解析器作为参数的更复杂的函数而失败 来自 runfile py import argparse import os def get input args parser argpars
python
Testing
Pytest
py.test 无法导入我的模块
我正在努力正确导入 python 我想要实现的是拥有一个包含多个源文件的模块和一个包含单元测试的测试文件夹 无论我做什么 我都无法让 py test 3 执行我的测试 我的目录布局如下所示 module init py testclass
python
unittesting
python3x
Pytest
Pytest 适用于旧的模拟,但不适用于 unittest.mock
我正在将一些代码从 Python 2 移植到 3 并且py test玩得不好patch装饰器来自unittest mock 当我使用patch装饰器将模拟传递到测试函数的参数中 py test相反 将该参数解释为固定装置 并且无法设置测试
python
unittesting
python3x
mocking
Pytest
使用conftest.py 与从专用模块导入装置
我最近开始熟悉 pytest 以及如何使用conftest py定义在我的测试中自动发现和导入的装置 我很清楚如何conftest py工作原理以及如何使用它 但我不确定为什么这在某些基本场景中被认为是最佳实践 假设我的测试是这样构建的 t
python
Pytest
尝试使用 pytest 在 python 3.10 上执行测试时出错
如果我尝试使用执行测试pytest使用 python 3 10 我收到以下错误 TypeError required field lineno missing from alias 谷歌说这是一个已知问题 但我找不到解决的方法 如果我用 3
python
Pytest
python310
«
1
2
3
4
5
6
...22
»