Django unittests not automatically detected

Just getting started with Fleet so forgive my ignorance.

I have configured my run.json file correctly to handle setting up a run server and added a python interpreter via the "Configure a Python interpreter for the workspace" panel in settings (https://www.jetbrains.com/help/fleet/getting-started-with-python.html#configure_settings_for_the_workspace) this gets me a runserver and a debugger without any issues.

Now I'm trying to get unit tests working, according to the documentation (https://www.jetbrains.com/help/fleet/using-unittest.html) smart mode should automatically pick these up and allow me to run them but I am not getting the arrow in my IDE to do so.

My setup is as following:
OS: Windows 10 10.0.19044 running WSL install of Ubuntu 20.04
Python: 3.6.15 installed via virtualenvwrapper
Django: 1.11.12
Fleet: 1.9.231 Public Preview

0
4 comments

Peter Dermott,

Hey, can you share your `run.json` for Django runserver run and debug config. It will help me a lot.

0

Arnav Agyeya

Sure thing

{
    "configurations": [
      {
        "name": "ms",
        "type": "python",
        "arguments": ["manage.py", "runserver", "0.0.0.0:8000"],
      "pythonInterpreterPath": "home/ubuntu/.virtualenvs/myproject/bin/",
        "environment": {
        "DJANGO_SETTINGS_MODULE": "myproject.settings.local"
          }
      },
      {
        "name": "m1",
        "type": "python",
        "arguments": ["manage.py", "runserver", "0.0.0.0:8001"],
      "pythonInterpreterPath": "home/ubuntu/.virtualenvs/myproject/bin/",
        "environment": {
        "DJANGO_SETTINGS_MODULE": "myproject.settings.local",
          "MODE": "module_manager"
        }
      },
      {
        "name": "tests",
        "type": "python-tests",
        "testFramework": "unittest",
      "target": "lxp.tests.test_action_plan",
        "arguments": [],
      }
    ]
}
1

but I am not getting the arrow in my IDE to do so.

Can you please provide a sample project/code to reproduce? It works for me with a simple class like so:

from unittest import TestCase


class TestSampleDjAppConfig(TestCase):
  pass

 

Though there is an issue with pytest: FL-15724 Pytest tests are not automatically detected

0

Thanks Peter Dermott.

Andrey Dernov, can you try with django tests. Something like

from django.test import TestCase

class TestConfigService(TestCase):
    @classmethod
  def setUpTestData(cls):
pass

    def test_get_latest_iteration_for_test(self):
      pass




I am able to run it with the following config in run.json, but it does run in debug mode:

{
        "name": "test1",
        "type": "python",
        "environment": {
          "PYTHONUNBUFFERED": "1",
        },
        "file": "$PROJECT_DIR$/manage.py",
      "arguments": ["test", "-k", "system_setup.tests.test_services.test_ConfigService"],
      }
0

Please sign in to leave a comment.