diff options
author | Tim Graham <timograham@gmail.com> | 2016-12-31 11:32:50 -0500 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2017-01-17 20:52:03 -0500 |
commit | 5139832398624be75ee5361a6fac9348fdb61093 (patch) | |
tree | 8db4c3d5f8c075c5b8c4a22f8845a1219d517485 /tests/lookup | |
parent | bfe0d54514bf4f03bc4a956452541f0103134ba3 (diff) | |
download | django-5139832398624be75ee5361a6fac9348fdb61093.tar.gz |
Refs #26285 -- Removed MySQL __search lookup per deprecation timeline.
Diffstat (limited to 'tests/lookup')
-rw-r--r-- | tests/lookup/models.py | 13 | ||||
-rw-r--r-- | tests/lookup/tests.py | 32 |
2 files changed, 2 insertions, 43 deletions
diff --git a/tests/lookup/models.py b/tests/lookup/models.py index e8479f11d1..cfc0cecb99 100644 --- a/tests/lookup/models.py +++ b/tests/lookup/models.py @@ -75,19 +75,6 @@ class Player(models.Model): return self.name -# To test __search lookup a fulltext index is needed. This -# is only available when using MySQL 5.6, or when using MyISAM -# tables. As 5.6 isn't common yet, lets use MyISAM table for -# testing. The table is manually created by the test method. -# RemovedInDjango20Warning -class MyISAMArticle(models.Model): - headline = models.CharField(max_length=100) - - class Meta: - db_table = 'myisam_article' - managed = False - - class Product(models.Model): name = models.CharField(max_length=80) qty_target = models.DecimalField(max_digits=6, decimal_places=2) diff --git a/tests/lookup/tests.py b/tests/lookup/tests.py index 1c8dd986fc..78e68dfc4a 100644 --- a/tests/lookup/tests.py +++ b/tests/lookup/tests.py @@ -3,16 +3,11 @@ from __future__ import unicode_literals import collections from datetime import datetime from operator import attrgetter -from unittest import skipUnless from django.core.exceptions import FieldError -from django.db import connection -from django.test import ( - TestCase, TransactionTestCase, ignore_warnings, skipUnlessDBFeature, -) -from django.utils.deprecation import RemovedInDjango20Warning +from django.test import TestCase, skipUnlessDBFeature -from .models import Article, Author, Game, MyISAMArticle, Player, Season, Tag +from .models import Article, Author, Game, Player, Season, Tag class LookupTests(TestCase): @@ -775,26 +770,3 @@ class LookupTests(TestCase): '<Article: Article 7>'], ordered=False ) - - -class LookupTransactionTests(TransactionTestCase): - available_apps = ['lookup'] - - @ignore_warnings(category=RemovedInDjango20Warning) - @skipUnless(connection.vendor == 'mysql', 'requires MySQL') - def test_mysql_lookup_search(self): - # To use fulltext indexes on MySQL either version 5.6 is needed, or one must use - # MyISAM tables. Neither of these combinations is currently available on CI, so - # lets manually create a MyISAM table for Article model. - with connection.cursor() as cursor: - cursor.execute( - "CREATE TEMPORARY TABLE myisam_article (" - " id INTEGER PRIMARY KEY AUTO_INCREMENT, " - " headline VARCHAR(100) NOT NULL " - ") ENGINE MYISAM") - dr = MyISAMArticle.objects.create(headline='Django Reinhardt') - MyISAMArticle.objects.create(headline='Ringo Star') - # NOTE: Needs to be created after the article has been saved. - cursor.execute( - 'CREATE FULLTEXT INDEX myisam_article_ft ON myisam_article (headline)') - self.assertSequenceEqual(MyISAMArticle.objects.filter(headline__search='Reinhardt'), [dr]) |