From 1b22d53bf67943cd193bbd6e327d955c19d2f5d2 Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Fri, 27 Feb 2026 14:43:55 -0500 Subject: [6.0.x] Fixed #36961 -- Fixed TypeError in deprecation warnings if Django is imported by namespace. Backport of c1d8646ec219b8b90ebdd463f40e5767876658a0 from main. --- tests/deprecation/tests.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/deprecation/tests.py b/tests/deprecation/tests.py index 2df9cc6fa2..ac610b4928 100644 --- a/tests/deprecation/tests.py +++ b/tests/deprecation/tests.py @@ -18,6 +18,10 @@ class DjangoFilePrefixesTests(SimpleTestCase): def test_no_file(self): orig_file = django.__file__ try: + # Depending on the cwd, Python might give a local checkout + # precedence over installed Django, producing None. + django.__file__ = None + self.assertEqual(django_file_prefixes(), ()) del django.__file__ self.assertEqual(django_file_prefixes(), ()) finally: -- cgit v1.3