PyCharm 4 - Go To -> Test - populates test class as unittest, not nose
Hi, I'd like to configure PyCharm to generate test stubs for nose instead of unittest.
I've searched the forum and couldn't find anyone who had already asked this, and have also checked StackOverflow.
I am developing tests using nose, and am able to tell PyCharm that it should use nosetest as my test runner, the tests are invoked correctly and all is good.
However, I would like to use the convenience helper to create a stub test class and test methods using the (Right-click on target for the tests) Go To -> Test -> Create new test facility (or CTRL+SHIFT+T).
This works, but creates a stub test class that is specific to unittest and not nose.
I've told PyCharm to use Nosetests as my Default test runner in Settings -> Tools -> Python Integrated Tools.
Is this a limitation of the feature - i.e. it only builds a unittest stub even though I've configured PyCharm to use nosetests)?
Is there a template file I can edit to populate the stub use nose-specific terminology?
Any guidance gratefully received.
Thanks.
I've searched the forum and couldn't find anyone who had already asked this, and have also checked StackOverflow.
I am developing tests using nose, and am able to tell PyCharm that it should use nosetest as my test runner, the tests are invoked correctly and all is good.
However, I would like to use the convenience helper to create a stub test class and test methods using the (Right-click on target for the tests) Go To -> Test -> Create new test facility (or CTRL+SHIFT+T).
This works, but creates a stub test class that is specific to unittest and not nose.
I've told PyCharm to use Nosetests as my Default test runner in Settings -> Tools -> Python Integrated Tools.
Is this a limitation of the feature - i.e. it only builds a unittest stub even though I've configured PyCharm to use nosetests)?
Is there a template file I can edit to populate the stub use nose-specific terminology?
Any guidance gratefully received.
Thanks.
Please sign in to leave a comment.
Thanks.
An alternative that I use so I can switch easily between the outputs is to use unittest and set the verbosity level to 2, this is the equivalent to what nose outputs. Of course, that would depend on what you are looking for from nose.
test_runner = unittest.TextTestRunner(descriptions=False, verbosity=2)
The File and Code Templates in the settings seem to change the code that is populated in the editor when you do File -> New... -> Python File. You're then asked for the filename, and you can select the type of Python file - and it's here where you can select Python Unittest.
Instead, I'm talking about the ability to generate a test stub code using the Go To -> Test context menu in the editor (CTRL+SHIFT+T). You position the cursor on the class/function and do Go To -> Test.
You can then create a new test and it brings up a dialogue like this.
It then goes on to create some stub test code for the selected methods of the class that is based around unittests: Like so...
I'd like it to generate a nosetests-specific stub, but I can't see where the template might be stored. Is it in the template and code section you mentioned? If so, can you point me to where it is?
Thanks for the suggestion.