我正在尝试使用 pycharm 运行以下简单测试用例,当我运行这些测试用例时,我看到了输出
Process finished with exit code 0
取而代之的是通过/失败。
我正在运行的测试用例:
import pytest
from pytest1 import can_p1
msg=0
@pytest.fixture(scope = "module")
def msgFraming():
print ("I'm inside FIXTURE")
nchannel = 686
FuncID = 144
opType = 8
FuncID = FuncID * 2
msg = nchannel+FuncID+opType
return msg
def test_cansendMsg(msgFraming):
res= can_p1.canMsgsend(msg)
assert res == msg
def test_canrecvMsg(msgFraming):
res = can_p1.canMdgrcv(msg)
assert res == msg
我在 IDE 中编辑了如下设置:
1)文件->设置->工具->python集成工具->设置默认为py.test
当我运行其他程序(pytest 除外)时,我可以看到 o/p。
最佳答案
- 您需要按照 this guide 编辑/创建新配置
- 您需要选择 python 测试并在列表中选择 pytest:
关于python - 使用 Pycharm(IDE) 运行 Pytest,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46529920/