mardi 14 juillet 2020

How to run tests in django project in PyCharm?

I created a test and I am trying to run in with PyCharm. Unfortunately, it fails with the following error:

RuntimeError: Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

django.contrib.contenttypes is presented in INSTALLED_APPS and is on the top of the list. Can anybody help me to fix this issue and run my test through PyCharm?

from django.test import TestCase

from yorn.profile.models import Profile


class FunctionsTest(TestCase):
    fixtures = ["profile"]


def test_get_yorn_ids_for_profile(self):
    profile = Profile.objects.filter(id=1)
    # assert something when it will run normally

Aucun commentaire:

Enregistrer un commentaire