首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么pytest会显示跳过测试的错误通知?

问为什么pytest会显示跳过测试的错误通知?
EN

Stack Overflow用户
提问于 2016-05-18 23:15:38
回答 1查看 150关注 0票数 0

我通过pytest运行以下测试文件

代码语言:javascript
复制
import pytest
@pytest.mark.skip(reason="no way of currently testing this")
def test_1():
    pass

并获得以下输出:

代码语言:javascript
复制
/PROJECTS/Pytest_example/env/bin/python2.7 /usr/local/pycharm-5.0.3/helpers/pycharm/pytestrunner.py -p pytest_teamcity /PROJECTS/Pytest_example/test_example.py
Testing started at 17:57 ...
============================= test session starts ==============================
platform linux2 -- Python 2.7.10, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
rootdir: /PROJECTS/Pytest_example, inifile: 
collected 1 items

../../PROJECTS/Pytest_example/test_example.py s
Test ignored.

========================== 1 skipped in 0.01 seconds ===========================

Process finished with exit code 0

为什么我没有收到通知

代码语言:javascript
复制
"no way of currently testing this"?

如何在输出中获取此通知?

EN

回答 1

Stack Overflow用户

发布于 2016-05-20 18:52:09

这看起来像是来自其他东西的输出(因为您没有直接运行pytest ),而不是来自pytest。您可以使用-rs告诉pytest显示跳过原因

代码语言:javascript
复制
$ py.test test_example.py -rs
====================== test session starts ======================
platform linux -- Python 3.5.1, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
rootdir: /home/florian/tmp/so, inifile: 
plugins: mock-0.11.0
collected 1 items 

test_example.py s
==================== short test summary info ====================
SKIP [1] test_example.py:1: no way of currently testing this

=================== 1 skipped in 0.00 seconds ===================
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37303754

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档