Hello Aymeric, To be clear, I don't contest in any way that design choice. I understand and approve it. I'm just pointing to this unwanted side-effect, wondering if anyone has ideas how to circumvent it, as I think it's a legitimate use case. I'm also aware that we have not much control over test discovery and importing process.
The workaround for me will probably to write a custom test management command to define test labels dynamically based on current settings. Claude On Wednesday, November 18, 2015 at 9:29:08 PM UTC+1, Aymeric Augustin wrote: > > Hello Claude, > > Generally speaking, you cannot safely use a model that isn't defined in an > application that is in INSTALLED_APPS. Django raises a warning when you > import such a model. > > This restriction prevents situations where relations between models aren't > set up correctly. There’s a string of such bugs in Trac. I discussed this > in my DjangoCon Europe 2014 talk. > > Best regards, > > -- > Aymeric. > > > > On 18 nov. 2015, at 21:04, Claude Paroz <[email protected] <javascript:>> > wrote: > > Hello, > > I have a Django project with different apps and settings. Let's say > settings A have A in INSTALLED_APPS but not B, and settings B have B in > INSTALLED_APPS but not A. Note also that I cannot have both apps installed, > for some reason. > In that configuration and from Django 1.9, ./manage.py test will always > fail with the message : > RuntimeError: Model class <myapp.models.MyModel> doesn't declare an > explicit app_label and either isn't in an application in INSTALLED_APPS or > else was imported before its application was loaded. > > Do we admit that for such type of projects, you always have to specify > your app labels starting from Django 1.9? > Or did I miss some hidden trick to avoid that? > > Claude > > > > -- > You received this message because you are subscribed to the Google Groups > "Django developers (Contributions to Django itself)" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] <javascript:>. > To post to this group, send email to [email protected] > <javascript:>. > Visit this group at http://groups.google.com/group/django-developers. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-developers/b7d021c5-bc44-48e6-8441-b57a40758c53%40googlegroups.com > > <https://groups.google.com/d/msgid/django-developers/b7d021c5-bc44-48e6-8441-b57a40758c53%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > > > -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/6181711b-1ec2-4fbe-a4c1-29e5bbac8fa5%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
