1
0
forked from pool/python-Django

- 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
This commit is contained in:
Matej Cepl 2022-01-12 14:16:45 +00:00 committed by Git OBS Bridge
parent d4f3e90ca0
commit cc14e0cce5
3 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,38 @@
From 402ed030933ffa1af74db50f737872d48f0152bb Mon Sep 17 00:00:00 2001
From: Mariusz Felisiak <felisiak.mariusz@gmail.com>
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):
"""

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Jan 12 14:16:23 UTC 2022 - Matej Cepl <mcepl@suse.com>
- 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 <aplanas@suse.com>

View File

@ -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}