From cc14e0cce59f7aab60d16c7f0f94a2ef757788ba6085852c92aff2eb57cd4ba2 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Wed, 12 Jan 2022 14:16:45 +0000 Subject: [PATCH] - Add fix_test_custom_fields_SQLite.patch fixing issues with modern SQLite (gh#django/django#15168). OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:django/python-Django?expand=0&rev=100 --- fix_test_custom_fields_SQLite.patch | 38 +++++++++++++++++++++++++++++ python-Django.changes | 6 +++++ python-Django.spec | 5 ++++ 3 files changed, 49 insertions(+) create mode 100644 fix_test_custom_fields_SQLite.patch diff --git a/fix_test_custom_fields_SQLite.patch b/fix_test_custom_fields_SQLite.patch new file mode 100644 index 0000000..22eab80 --- /dev/null +++ b/fix_test_custom_fields_SQLite.patch @@ -0,0 +1,38 @@ +From 402ed030933ffa1af74db50f737872d48f0152bb Mon Sep 17 00:00:00 2001 +From: Mariusz Felisiak +Date: Thu, 9 Dec 2021 13:21:36 +0100 +Subject: [PATCH] Fixed inspectdb.tests.InspectDBTestCase.test_custom_fields() + on SQLite 3.37+. + +Use FlexibleFieldLookupDict which is case-insensitive mapping because +SQLite 3.37+ returns some data type names uppercased e.g. TEXT. +--- + tests/inspectdb/tests.py | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +--- a/tests/inspectdb/tests.py ++++ b/tests/inspectdb/tests.py +@@ -302,18 +302,17 @@ class InspectDBTestCase(TestCase): + Introspection of columns with a custom field (#21090) + """ + out = StringIO() +- orig_data_types_reverse = connection.introspection.data_types_reverse +- try: +- connection.introspection.data_types_reverse = { ++ with mock.patch( ++ 'django.db.connection.introspection.data_types_reverse.base_data_types_reverse', ++ { + 'text': 'myfields.TextField', + 'bigint': 'BigIntegerField', +- } ++ }, ++ ): + call_command('inspectdb', 'inspectdb_columntypes', stdout=out) + output = out.getvalue() + self.assertIn("text_field = myfields.TextField()", output) + self.assertIn("big_int_field = models.BigIntegerField()", output) +- finally: +- connection.introspection.data_types_reverse = orig_data_types_reverse + + def test_introspection_errors(self): + """ diff --git a/python-Django.changes b/python-Django.changes index c73cab1..95d3eb4 100644 --- a/python-Django.changes +++ b/python-Django.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Jan 12 14:16:23 UTC 2022 - Matej Cepl + +- Add fix_test_custom_fields_SQLite.patch fixing issues with + modern SQLite (gh#django/django#15168). + ------------------------------------------------------------------- Mon Jan 10 09:27:36 UTC 2022 - Alberto Planas Dominguez diff --git a/python-Django.spec b/python-Django.spec index 4effbcb..98b934b 100644 --- a/python-Django.spec +++ b/python-Django.spec @@ -33,6 +33,11 @@ Source: https://www.djangoproject.com/m/releases/4.0/Django-%{version}.t Source1: https://media.djangoproject.com/pgp/Django-%{version}.checksum.txt#/Django-%{version}.tar.gz.asc Source2: %{name}.keyring Source99: python-Django-rpmlintrc +# PATCH-FIX-UPSTREAM fix_test_custom_fields_SQLite.patch gh#django/django#15168 mcepl@suse.com +# Use FlexibleFieldLookupDict which is case-insensitive mapping +# because SQLite 3.37+ returns some data type names upper-cased +# e.g. TEXT. +Patch0: fix_test_custom_fields_SQLite.patch BuildRequires: %{python_module Jinja2 >= 2.9.2} BuildRequires: %{python_module Pillow >= 6.2.0} BuildRequires: %{python_module PyYAML}