Pycharm生成测试,奇怪的代码模板使用Python的pytest框架的测试时,

问题描述 投票:3回答:1

为什么PyCharm生成下面的代码模板,当点击“创建新的测试..:”即使我有pytest作为我的默认测试运行?

如果我的功能是create_training_data,然后PyCharm将生成此下面的代码:

from unittest import TestCase

class TestCreate_training_data(TestCase):
    def test_create_training_data(self):
    self.fail()

然而pytest既不需要进口,也不是子类,有

class TestCreate_training_data(object):
    def test_create_training_data(self):
    self.fail()

作为已经在入门页面显示就足够了:https://docs.pytest.org/en/latest/getting-started.html

python unit-testing pycharm pytest
1个回答
0
投票

PyCharm只知道此刻创建unittest测试。请投票选出相应的功能要求:PY-15021

© www.soinside.com 2019 - 2024. All rights reserved.