Wrong django test target when using context menu to run specific unit tests;

I'm new with Django, I'm new with Pycharm. My problem is as follows:

When I add a new test, I want to right click on it and run it from context menu to go fast but it doesn't work as the appname is not correct. Let me explain :
here is the structure to my test folder.
MyProjectName(basically the root) –> myAppName –>tests (the test folder)

Let's imagine i have a "mytest.py" containing a "class MyClassTest(Testcase)" and a "my_function_test(self)"

if i create a specific configuration myself, it will work when the target is set as follows:

the problem is that I don't want to waste time creating configuration manually for every test function so I want to use the context menu run/debug test but it doesn't work. Indeed, when I want to use the context menu, it tries to run
tests.MyClassTest.my_function_test. And I get the message "ImproperlyConfigured: App with label tests could not be found".

Basically, it acts like tests (which is just the test folder) is the appName. This is for a huge project already in live production and where I have no control to change folder or appnames. I was just wondering if something could be done to change the "tests" in "myAppName" somewhere.

Thanks in advance for any help you might give!
Comment actions Permalink

Almost the same happens here and it would be great if it could be fixed somehow.

In my case I have the following project structure:


  |- app






When running all tests (Django test configuration without specific target) all tests are found and run. However, when I then right click one of those tests a new run configuration gets added with the wrong target (e.g. app.TestClassName.test_name instead of app.tests.tests1.TestClassName.test_name)

Comment actions Permalink

Same problem. But I don't think it's a bug, seems to be a configuration problem, but I can't understand where to look to fix this.

Comment actions Permalink

Please see the related issue: https://youtrack.jetbrains.com/issue/PY-35793

And the workaround: https://youtrack.jetbrains.com/issue/PY-35793#focus=streamItem-27-3518366.0-0

Let me know if your case is different. Or better yet, leave a comment in that ticket.


Please sign in to leave a comment.