我正在尝试从单元测试更改为PyTests。在Python集成工具下将默认测试运行器从Unittest更改为py.test之后,我在创建新测试时仍然获得了Unittest框架:
而不是这样:
from unittest import TestCase
class Test<selected function>(TestCase):
pass
我希望是这样的:
import pytest
class Test< selected function >:
def test_<selected function>:
pass
我尝试在Preferences>Editor>File和Code templates下更改Python Unit Test Code模板。
不走运。在哪里更改默认测试模板?
发布于 2016-10-19 13:17:57
在我的例子中,我想到的最好的解决方案是创建一个新的模板。我将其命名为Python Test
,模板如下。
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import pytest
def test():
pass
这足以加快我的测试创建速度。在某种程度上,他们可能会添加测试功能。
https://stackoverflow.com/questions/39901920
复制相似问题