Let's say I have an app.py file with the following contents:
def foo():
return 'bar'
Even with py.test set as a default test runner in PyCharm (Settings -> Tools -> Python Integrated Tools), PyCharm always generate unittest-like tests (right-click on a function name -> Go To -> Test -> Create New Test), eg.:
from unittest import TestCase
class TestFoo(TestCase):
def test_foo(self):
self.fail()
I can change Python Unit Test template in Setting -> Editor -> File and Code Templates, but it only has effect when creating new file (New -> Python File -> Kind: Python unit test).
I would like the generated tests to be more py.test-like:
def test_foo():
assert False
Even better would be to have proper imports already placed in:
from my_app import foo
def test_foo():
assert False