[英]Pycharm generating weird code template for a test, when using Python's pytest framework for testing
Why is PyCharm generating the following code template, when clicking "Create New Test..:", even though I have pytest
as my default test runner? 为什么PyCharm在单击“Create New Test ..:”时生成以下代码模板,即使我有
pytest
作为我的默认测试运行器?
If my function is create_training_data
, then PyCharm will generate the following code for this: 如果我的函数是
create_training_data
,那么PyCharm将为此生成以下代码:
from unittest import TestCase
class TestCreate_training_data(TestCase):
def test_create_training_data(self):
self.fail()
Yet pytest
neither needs the import, nor the subclassing, having 然而,
pytest
既不需要导入,也不需要子类化
class TestCreate_training_data(object):
def test_create_training_data(self):
self.fail()
would be enough as already the getting started page shows: https://docs.pytest.org/en/latest/getting-started.html 已经足够的入门页面显示: https : //docs.pytest.org/en/latest/getting-started.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.