Hi,
I'm developing unit tests for simple Models that interact with a MySQL 
database.

The app is configured as reusable application as indicated here:
https://docs.djangoproject.com/en/1.10/topics/testing/advanced/#testing-reusable-applications

and the tests are created according to the structure stated here using 
runtests.py:
https://docs.djangoproject.com/en/1.10/topics/testing/overview/

the admin interface is working correctly, and database is updated with the 
correct data but

when I run:

python runtests.py

I get the following error:
RuntimeError: Model class surrogate.models.Person.Person doesn't declare an 
explicit app_label and isn't in an application in INSTALLED_APPS.

any idea about the error?

here the bits of code interested by the error:

the Person test is (in myapp/tests/tests.py):
class PersonTestCase(TestCase):
 def setup(self):
 Person.objects.create(name="adam", surname="felix")

 def test_animals_can_speak(self):
 person1 = Person.objects.get(name="adam")
 self.assertEqual(person1, 'test')

Person model (myapp/models/Person/Person.py) is:


from django.db import models
from django import utils
import uuid


class Person(models.Model):
 id = models.BigAutoField(primary_key=True, editable=False)
 uuid = models.UUIDField( default=uuid.uuid4, editable=False)
 name = models.CharField(max_length=100)
 surname = models.CharField(max_length=100)
 email = models.EmailField()
 creation_date = models.DateField(default=utils.timezone.now)

 def __str__(self): # __unicode__ on Python 2
 return self.surname



cheers
D

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b61efee8-0338-449d-94ff-7ed2565305c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to