Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure pycharm to use nose2 instead of nose

According to the http://nose.readthedocs.io/en/latest all tests

... should consider using Nose2, py.test, or just plain unittest/unittest2.

However, I can't seem to make Pycharm use it instead of nose. Is there some setting I can configure so that it uses nose2 to do its testing instead of nose?

EDIT: Nose2 is included in my Project Interpreter's list of packages enter image description here

However, I can't run any tests (which is why I asked this question) enter image description here

like image 737
Craig Avatar asked Feb 21 '18 18:02

Craig


People also ask

How do you use Nosetests in Pycharm?

In the current version of Pycharm (2.6) there should be a context menu "run Nosetests in ..." on a test file. If this is missing, go to file->settings->Project Settings->python integrated tools and ensure the Default Test Runner is Nosetests.

How do I set the default test runner in Pycharm?

To set a test runner, press Ctrl+Alt+S to open the IDE settings and select Tools | Python Integrated Tools, and then select the target test runner from the Default test runner list.


1 Answers

I went to run -> run... -> edit configurations and then setup a new python (not python test) config that ran module name: nose2 and my test package name for the parameters. That is parameters: tests.test_my_fun_test

Make sure that the python interpreter is set to the one you intended to use. (Like the project default) and that that interpreter has nose2 installed.

Also, in the pycharm editor window when looking at the code for a unittest class, right clicking on a test class name brings up a menu with "run unittests for..." which seems to do the correct thing. ( I have no idea if it is running nose2 or not but it works nicely)

like image 160
Brian C. Avatar answered Sep 29 '22 02:09

Brian C.