Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
如何在 python 单元测试脚本中抑制 ImportWarning
我当前正在运行一个单元测试脚本 该脚本成功通过了各种指定的测试 并在控制台中显示了一条烦人的 ImportWarning 消息 lib python3 6 importlib bootstrap py 219 ImportWarning c
python3x
pythonimport
pythonunittest
编写需要用户名和密码的 Python 功能测试
我有一个 API 包装类WfcAPI用 Python 3 编写 我想使用它进行测试PyUnit https docs python org 3 library unittest html The setUpClass for WfcAPI涉
python
python3x
security
functionaltesting
pythonunittest
如何模拟 pyunit 的 stdin 输入?
我正在尝试测试一个从以下位置获取输入的函数stdin 我目前正在用这样的东西进行测试 cat usr share dict words spellchecker py 以测试自动化的名义 有什么办法可以pyunit可以伪造输入raw inp
python
Linux
pythonunittest
如何重用使用unittest.testcase编写的测试
我已经使用单元测试编写了一些测试 如下所示 我想在另一个我遇到困难并需要帮助的类中重用它们 代码片段如下 MyTestClass py Class MyTestClass unittest TestCase classmethod def
python
pythonunittest
Python unittest:如何临时将标准输出消息重定向到缓冲区并测试其内容?
我想捕获发送到的消息stdout our stderr 在测试期间暂时断言这些消息中是否出现某些字符串模式 import unittest class SomeTest unittest TestCase def test stdout s
python
pythonunittest
Python单元测试中setUp()和setUpClass()有什么区别?
有什么区别setUp and setUpClass 在Python中unittest框架 为什么要使用一种方法而不是另一种方法来处理设置 我想了解设置的哪一部分是在setUp and setUpClass 函数 以及tearDown and
python
unittesting
pythonunittest
如何在`mock.Mock().call_args`中获取`self`实例?
在修补虚拟类时 我观察到不一致的行为 class A def f self args kwargs pass 如果我手动修补该功能 call args list def mock fn args kwargs call args list
python
unittesting
mocking
pythonunittest
断言 __init__ 是用正确的参数调用的
我使用 python 模拟来断言特定对象是使用正确的参数创建的 这就是我的代码的样子 class Installer def init foo bar version Init stuff pass def enter self retur
python
Testing
mocking
pythonunittest
Python:为控制台打印编写单元测试
功能foo打印到控制台 我想测试控制台打印 我怎样才能在Python中实现这一点 需要测试这个函数 没有 return 语句 def foo inStr print hi inStr 我的测试 def test foo cmdProcess
python
python27
unittesting
Console
pythonunittest
unittest,在本地工作,但不在远程服务器上,没有名为 x.__main__ 的模块; 'x'是一个包,不能直接执行
我正在为我的 Python 包开发 Jenkins CI CD 管道 我的项目文件层次结构如下 project package name file1 py file2 py etc tests unit main py init py te
python
unittesting
jenkins
module
pythonunittest
使用 Pyspark 进行单元测试:未关闭的套接字警告
我想使用 PySpark 进行单元测试 测试本身有效 但是对于我得到的每个测试 ResourceWarning unclosed
python
python3x
PySpark
pythonunittest
apachesparksql
在具有多个目录的项目结构中使用 Python 单元测试
我需要使用unittestpython 库来执行有关 3 个函数的测试src arithmetics py文件 这是我的项目结构 src arithmetics py test lcm init py test lcm exception
python
python3x
unittesting
pythonunittest
如何测试 Django 测试用例中是否记录了特定日志消息?
我想确保代码中的某个条件会导致日志消息写入 django 日志 我如何使用 Django 单元测试框架来做到这一点 是否有地方可以检查记录的消息 类似于检查已发送的电子邮件 我的单元测试扩展了django test TestCase 使用m
python
django
unittesting
Testing
pythonunittest
python 中的 Selenium 单元测试是什么?
用 突出显示的第 3 16 17 18 和 19 行的含义是什么 有人可以解释一下他们是做什么的吗 我是 python 和编程新手 import unittest from selenium import webdriver class I
python
selenium
seleniumwebdriver
webdriver
pythonunittest
如何使用 python 列出可用的测试?
如何列出所有发现的测试 我发现这个命令 python3 4 m unittest discover s 但这并不完全是我想要的 因为上面的命令执行测试 我的意思是让我们有一个包含大量测试的项目 执行时间为几分钟 这迫使我必须等到测试完成 我
python
pythonunittest
testsuite
如果我在一个类中有多个测试并且前面的测试失败,我如何让它跳过或退出该类而不是测试其余的测试?
我将 Python 与 Selenium 和 unittest 结合使用 我在一堂课中有四个测试 因为它们都是相关的单元测试 如果前面的测试失败 如何让它跳过下一个测试 我已经阅读了unittest的skip方法的所有文档 但没有一个正是我
python3x
selenium
Pytest
pythonunittest
如何捕获 Python Unittest 测试用例失败的屏幕截图
我使用 Python 3 6 5 和以下库 Appium Python 客户端 0 26 单元测试2 1 1 0 硒 3 5 0 pytest 3 6 3 现在我需要截图以防测试失败 所以我故意做了一个错误的陈述self driver fi
python
seleniumwebdriver
python36
Pytest
pythonunittest
在 Python 中模拟子进程调用
我有一个方法 run script 我想测试一下 具体来说 我想测试一下调用subprocess Popen https docs python org 3 library subprocess html subprocess Popen发
python
mocking
subprocess
pythonunittest
如何模拟任何未直接调用的函数?
TL DR 我如何修补或模拟 任何未被直接调用 使用的函数 设想 我有一个简单的单元测试片段 utils functions py def get user agents sends requests to a private networ
python
unittesting
mocking
pythonunittest
pythonmock
如何使用 FTPS/TLS 1.2 版模拟 FTP 连接?
我有一个 Python 代码 使用 HTTPS 和 TLS 版本 1 2 从 FTP 读取一些文件 这是函数 凭证是从 AWS 秘密管理器读取的 def ftp connection host username password try f
python
unittesting
SSL
pythonunittest
ftplib
«
1
2
3
4
5
»