Description: Update keepcontext_context_manager test to support Django 4
 To get the full django-crispy-forms test suite to work with Django 4, the
 keepcontext_context_manager must be provided with overriden template
 settings, since the default settings do not provide the necessary
 filesystem and app_directories loaders. This patch is created from a
 partial upstream commit, excluding CI, README, and setup.py changes.
Author: David Smith <smithdc@gmail.com>
Origin: backport, https://github.com/django-crispy-forms/django-crispy-forms/commit/0d13c6c9d326ba2690bc57da0aba7fd178b732a4
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/python-django-crispy-forms/+bug/2022089
Forwarded: not-needed
Last-Update: 2023-08-31
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/crispy_forms/tests/test_layout.py
+++ b/crispy_forms/tests/test_layout.py
@@ -5,6 +5,7 @@
 from django.middleware.csrf import _get_new_csrf_string
 from django.shortcuts import render
 from django.template import Context, Template
+from django.test.utils import override_settings
 from django.urls import reverse
 from django.utils.translation import gettext_lazy as _
 
@@ -28,6 +29,7 @@
     SampleForm6,
     SelectSampleForm,
 )
+from .test_settings import TEMPLATE_DIRS
 from .utils import contains_partial, parse_expected, parse_form
 
 
@@ -560,7 +562,20 @@
     assert 'class="customdivs"' in html
     assert 'test-markup="123"' in html
 
-
+@override_settings(
+    TEMPLATES=[
+        {
+            "BACKEND": "django.template.backends.django.DjangoTemplates",
+            "DIRS": TEMPLATE_DIRS,
+            "OPTIONS": {
+                "loaders": [
+                    "django.template.loaders.filesystem.Loader",
+                    "django.template.loaders.app_directories.Loader",
+                ],
+            },
+        }
+    ]
+)
 @only_bootstrap
 def test_keepcontext_context_manager(settings):
     # Test case for issue #180
