Filename_test 没有被pytest执行

Filename_test is not executed by pytest

我正在学习 pytest 并尝试创建一个以 _test 结尾的 py 文件以及以 _test 结尾的方法名称。但是当我 运行 pytest 命令时,我的测试方法没有被收集。

当我重新命名以 test_ 开头的方法名称时,pytest 就能够收集测试。

任何人都可以帮助我了解这里可能存在的问题吗?

pytest 默认使用 test_*。如果你想要 *_test 那么你已经在 pytest.ini 文件

中编写了规则