如何解决在PythonV- 3.8中使用PyTest运行测试用例时出现“ Empty Suite”错误
下面是conftest.py
和test_1.py
文件的代码。知道为什么我会收到错误“ Empty Suite”。
-
conftest.py
import pytest @pytest.fixture() def setup(): print("hi") yield print("end")
-
test_1.py
import pytest @pytest.mark.usefixtures("setup") class Abc: def test_demo(self): print("hello") def test_demo1(self): print("Hey")
运行test_1.py
后出现以下消息:
Testing started at 15:15 ...
C:\Users\Lenovo\AppData\Local\Programs\Python\Python38-32\python.exe "C:\Program Files\PyCharm\PyCharm Community Edition 2020.2\plugins\python-ce\helpers\pycharm\_jb_pytest_runner.py" --path C:/Users/Lenovo/PycharmProjects/pythonProject1/famework-pytest/test_1.py
Launching pytest with arguments C:/Users/Lenovo/PycharmProjects/pythonProject1/famework-pytest/test_1.py in C:\Users\Lenovo\PycharmProjects\pythonProject1\famework-pytest
============================= test session starts =============================
platform win32 -- Python 3.8.5,pytest-6.0.1,py-1.9.0,pluggy-0.13.1 -- C:\Users\Lenovo\AppData\Local\Programs\Python\Python38-32\python.exe
cachedir: .pytest_cache
rootdir: C:\Users\Lenovo\PycharmProjects\pythonProject1\famework-pytest
collecting ... collected 0 items
============================ no tests ran in 0.01s ============================
Process finished with exit code 5
Empty suite
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。