#20483: Reduce the set of apps seen by individual tests --------------------------------------+------------------------------------ Reporter: akaariai | Owner: nobody Type: Cleanup/optimization | Status: new Component: Testing framework | Version: master Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 1 Easy pickings: 0 | UI/UX: 0 --------------------------------------+------------------------------------
Comment (by akaariai): I did some more hacking. This time I tried to use override_settings(INSTALLED_APPS). The result is maybe a bit cleaner, but then again, maybe not... It is now evident that we can't get fully rid of global state. The problem is table truncation and the need to cascade into applications not in current available_apps set. For example you might have app1 and app2 that don't know about each other, but both contain foreign key to auth.user. Now when app1 does flush, it will flush also auth.user, and that flush needs to cascade to app2. This is impossible to do unless we want to use TRUNCATE CASCADE (which could cascade to unmanaged models etc), or we have global installed apps and models available somewhere (likely in global app-cache). So, end result doesn't look much cleaner. (Fundamental problem here is that the database schema itself is global state that is extremely hard to get rid of). Patch at https://github.com/akaariai/django/tree/pull_1240. We might still try how things look when instantiating multiple app-caches. But I am not sure if that will result in anything truly cleaner. -- Ticket URL: <https://code.djangoproject.com/ticket/20483#comment:21> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/066.50f8411f4a7868d7d86eb7d5fe171b24%40djangoproject.com?hl=en. For more options, visit https://groups.google.com/groups/opt_out.