[Django]-TypeError: issubclass() arg 1 must be a class in Django tests

4πŸ‘

βœ…

I get this error when I don’t properly point to the test I’m trying to run.

When I tried to run a specific test method I tried the following and got the error you mention: ./manage.py test myapp.tests.test_file.MyTestCase.test_something

What I had to run to actually get it to work was: ./manage.py test myapp.tests.test_file:MyTestCase.test_something (Notice the : between the file name and the class name)

I believe this issue is specific to β€˜nose’.

πŸ‘€Tim Tisdall

0πŸ‘

To fix this in Pycharm, you need to specify your test runner with TEST_RUNNER = "django_nose.NoseTestSuiteRunner" (or whatever your runner) in the settings.py you set up in Preferences > Languages & Frameworks > Django and NOT the one set up in your test/run config.

See comments on the following:

πŸ‘€theannouncer

Leave a comment