From b564d3d2d32782ca439f9d721d01b0fe6cff25a3 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 22 Feb 2017 15:45:40 +0100 Subject: Fix cache operation update - Parcel associated with context records are not removed! --- archaeological_context_records/tests.py | 42 ++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) (limited to 'archaeological_context_records/tests.py') diff --git a/archaeological_context_records/tests.py b/archaeological_context_records/tests.py index 1c900184c..b87f3ce4d 100644 --- a/archaeological_context_records/tests.py +++ b/archaeological_context_records/tests.py @@ -147,7 +147,6 @@ class ContextRecordInit(OperationInitTest): def create_context_record(self, user=None, data={}, force=False): if not getattr(self, 'context_records', None): self.context_records = [] - default = {'label': "Context record"} if force or not data.get('operation'): data['operation'] = self.get_default_operation(force=force) @@ -200,6 +199,47 @@ class ContextRecordTest(ContextRecordInit, TestCase): cr.external_id, u"{}-{}".format(cr.parcel.external_id, cr.label)) + def test_lost_parcel_dont_delete_context_record(self): + cr = self.create_context_record(force=True)[0] + parcel = models.Parcel.objects.get(pk=cr.parcel.pk) + parcel.operation = None + parcel.save() + self.assertEqual( + models.ContextRecord.objects.filter(pk=cr.pk).count(), 1) + # associated operation is restored + self.assertEqual( + models.Parcel.objects.get(pk=parcel.pk).operation, + cr.operation + ) + + def test_cache_update(self): + cr = self.create_context_record()[0] + cr_pk = cr.pk + # OP2010 - 1 | A | 1 | CR 1 + ope_id, parcel_sec, parcel_nb, cr_label = cr.cached_label.split(' | ') + self.assertEqual(ope_id, 'OP2010-1') + self.assertEqual(parcel_sec, cr.parcel.section) + self.assertEqual(parcel_nb, cr.parcel.parcel_number) + self.assertEqual(cr_label, cr.label) + + new_lbl = "UE 2" + cr.label = new_lbl + cr.save() + cr = models.ContextRecord.objects.get(pk=cr_pk) + ope_id, parcel_sec, parcel_nb, cr_label = cr.cached_label.split(' | ') + self.assertEqual(cr_label, new_lbl) + + new_sec, new_nb = "B", "42" + parcel = cr.parcel + parcel.section = new_sec + parcel.parcel_number = new_nb + parcel.save() + cr = models.ContextRecord.objects.get(pk=cr_pk) + ope_id, parcel_sec, parcel_nb, cr_label = cr.cached_label.split(' | ') + self.assertEqual(parcel_sec, new_sec) + self.assertEqual(parcel_nb, new_nb) + + class ContextRecordSearchTest(ContextRecordInit, TestCase): fixtures = ImportContextRecordTest.fixtures -- cgit v1.2.3 From 146901b482bff1c735b6fe256e29c55740e17875 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 22 Feb 2017 16:00:17 +0100 Subject: Update context record label on parcel change --- archaeological_context_records/tests.py | 1 + archaeological_operations/models.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'archaeological_context_records/tests.py') diff --git a/archaeological_context_records/tests.py b/archaeological_context_records/tests.py index b87f3ce4d..4f0594698 100644 --- a/archaeological_context_records/tests.py +++ b/archaeological_context_records/tests.py @@ -204,6 +204,7 @@ class ContextRecordTest(ContextRecordInit, TestCase): parcel = models.Parcel.objects.get(pk=cr.parcel.pk) parcel.operation = None parcel.save() + # associated context record is not removed self.assertEqual( models.ContextRecord.objects.filter(pk=cr.pk).count(), 1) # associated operation is restored diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 225d46a53..707537fe3 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -1357,7 +1357,6 @@ class Parcel(LightHistorizedItem): def parcel_post_save(sender, **kwargs): if not kwargs['instance']: return - from archaeological_context_records.models import ContextRecord parcel = kwargs['instance'] created = kwargs.get('created', None) @@ -1377,13 +1376,17 @@ def parcel_post_save(sender, **kwargs): external_id = get_external_id('parcel_external_id', parcel) if external_id != parcel.external_id: updated = True + parcel._updated_id = True parcel.auto_external_id = True parcel.external_id = external_id if updated: - parcel._updated_id = True parcel.save() return + if parcel.context_record.count(): + for cr in parcel.context_record.all(): + cached_label_changed(cr.__class__, instance=cr) + if parcel.operation and parcel.operation.pk and \ parcel.town not in list(parcel.operation.towns.all()): parcel.operation.towns.add(parcel.town) -- cgit v1.2.3 From d3145603feb093f4b6f7c3b0a64cfff547a683fa Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 22 Feb 2017 16:13:46 +0100 Subject: Test context record label update on operation update --- archaeological_context_records/tests.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'archaeological_context_records/tests.py') diff --git a/archaeological_context_records/tests.py b/archaeological_context_records/tests.py index 4f0594698..83e013ee1 100644 --- a/archaeological_context_records/tests.py +++ b/archaeological_context_records/tests.py @@ -240,6 +240,12 @@ class ContextRecordTest(ContextRecordInit, TestCase): self.assertEqual(parcel_sec, new_sec) self.assertEqual(parcel_nb, new_nb) + cr.operation.year = 2017 + cr.operation.save() + cr = models.ContextRecord.objects.get(pk=cr_pk) + ope_id, parcel_sec, parcel_nb, cr_label = cr.cached_label.split(' | ') + self.assertEqual(ope_id, 'OP2017-1') + class ContextRecordSearchTest(ContextRecordInit, TestCase): -- cgit v1.2.3 From 0a280ab1b2a3623780b74528d67debddd891fc6c Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 24 Feb 2017 17:15:39 +0100 Subject: Wizard tests improvements. Test inappropriate parcel deletion. --- archaeological_context_records/tests.py | 12 ++- archaeological_operations/tests.py | 165 +++++++++++++++++++++++++++++++- archaeological_operations/views.py | 16 ++-- ishtar_common/tests.py | 49 ++++++---- 4 files changed, 213 insertions(+), 29 deletions(-) (limited to 'archaeological_context_records/tests.py') diff --git a/archaeological_context_records/tests.py b/archaeological_context_records/tests.py index 83e013ee1..0018aa1f3 100644 --- a/archaeological_context_records/tests.py +++ b/archaeological_context_records/tests.py @@ -148,14 +148,22 @@ class ContextRecordInit(OperationInitTest): if not getattr(self, 'context_records', None): self.context_records = [] default = {'label': "Context record"} - if force or not data.get('operation'): + if force or not data.get('operation') \ + or not models.Operation.objects.filter( + pk=data['operation'].pk).count(): data['operation'] = self.get_default_operation(force=force) - if not data.get('parcel') or not data['parcel'].pk: + if not data.get('parcel') or not data['parcel'].pk \ + or not models.Parcel.objects.filter( + pk=data['parcel'].pk).count(): data['parcel'] = self.get_default_parcel(force=force) if not data.get('history_modifier'): data['history_modifier'] = self.get_default_user() default.update(data) + data['operation'] = models.Operation.objects.get( + pk=data['operation'].pk) + data['parcel'] = models.Parcel.objects.get( + pk=data['parcel'].pk) self.context_records.append(models.ContextRecord.objects.create( **default)) return self.context_records diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 9cdeb67e6..a9fdf38cc 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -619,7 +619,11 @@ class OperationInitTest(object): def get_default_parcel(self, force=False): if force: return self.create_parcel()[-1] - return self.create_parcel()[0] + parcel = self.create_parcel()[0] + if models.Parcel.objects.filter(pk=parcel.pk).count(): + return parcel + self.parcels.pop(0) + return self.create_operation()[-1] def create_operation(self, user=None, orga=None): if not orga: @@ -634,7 +638,12 @@ class OperationInitTest(object): def get_default_operation(self, force=False): if force: return self.create_operation()[-1] - return self.create_operation()[0] + ope = self.create_operation()[0] + if models.Operation.objects.filter(pk=ope.pk).count(): + return ope + self.operations.pop(0) + return self.create_operation()[-1] + def tearDown(self): # cleanup for further test @@ -976,6 +985,158 @@ class OperationWizardCreationTest(WizardTest, OperationInitTest, TestCase): self.parcel_number + 2) +class OperationWizardModifTest(WizardTest, OperationInitTest, TestCase): + fixtures = OperationWizardCreationTest.fixtures + url_name = 'operation_modification' + wizard_name = url_name + '_wizard' + steps = views.operation_modif_wizard_steps + base_ignored_steps = ( + 'archaeologicalsite-operation_modification', + 'preventive-operation_modification', + 'preventivediag-operation_modification', + 'towns-operation_modification', + 'parcels-operation_modification', + 'remains-operation_modification', + 'periods-operation_modification', + 'relations-operation_modification', + 'abstract-operation_modification',) + form_datas = [ + FormData( + "Update an operation", + form_datas={ + 'selec-operation_modification': {}, + 'general-operation_modification': { + 'operation_type': 2, + 'year': 2017}, + 'townsgeneral-operation_modification': [], + 'parcelsgeneral-operation_modification': [], + }, + ignored=base_ignored_steps + ), + FormData( + "Operation: try to remove a parcel with attached context record", + form_datas={ + 'selec-operation_modification': {}, + 'general-operation_modification': { + 'operation_type': 2, + 'year': 2017}, + 'townsgeneral-operation_modification': [], + 'parcelsgeneral-operation_modification': [], + }, + ignored=base_ignored_steps + ), + FormData( + "Operation: remove a parcel with no attached context record", + form_datas={ + 'selec-operation_modification': {}, + 'general-operation_modification': { + 'operation_type': 2, + 'year': 2017}, + 'townsgeneral-operation_modification': [], + 'parcelsgeneral-operation_modification': [], + }, + ignored=base_ignored_steps + ), + ] + + def pre_wizard(self): + self.create_operation() + operation = self.operations[0] + init_town = self.create_towns()[0] + operation.towns.add(init_town) + init_parcel = self.create_parcel()[0] + operation.parcels.add(init_parcel) + + from archaeological_context_records.models import ContextRecord + cr_data = {'label': "Context record", "operation": operation, + 'parcel': init_parcel, + 'history_modifier': self.get_default_user()} + self.cr = ContextRecord.objects.create(**cr_data) + + data = self.form_datas[0].form_datas + data2 = self.form_datas[1].form_datas + data3 = self.form_datas[2].form_datas + + data['selec-operation_modification']['pk'] = operation.pk + data2['selec-operation_modification']['pk'] = operation.pk + data3['selec-operation_modification']['pk'] = operation.pk + + town = self.create_towns( + datas={'numero_insee': '67890', 'name': 'Twin Peaks'})[-1] + towns = [{'town': town.pk}, {'town': init_town.pk}] + data['townsgeneral-operation_modification'] = towns + data2['townsgeneral-operation_modification'] = towns + data3['townsgeneral-operation_modification'] = towns + + parcel_data = { + 'town': town.pk, 'year': 2017, 'section': 'S', + 'parcel_number': '42'} + data['parcelsgeneral-operation_modification'].append(parcel_data) + data2['parcelsgeneral-operation_modification'].append(parcel_data) + data3['parcelsgeneral-operation_modification'].append(parcel_data) + + parcel_data_2 = { + 'town': init_parcel.town.pk, 'year': init_parcel.year or '', + 'section': init_parcel.section, + 'parcel_number': init_parcel.parcel_number} + data['parcelsgeneral-operation_modification'].append(parcel_data_2) + # no init parcel for data2 and data3 + + self.operation_number = models.Operation.objects.count() + self.parcel_number = models.Parcel.objects.count() + + def post_first_wizard(test_object, final_step_response): + test_object.assertEqual(models.Operation.objects.count(), + test_object.operation_number) + operation = models.Operation.objects.get( + pk=test_object.operations[0].pk) + test_object.assertEqual(operation.operation_type.pk, 2) + test_object.assertEqual(operation.year, 2017) + test_object.assertEqual(models.Parcel.objects.count(), + test_object.parcel_number + 1) + test_object.assertEqual(operation.parcels.count(), + test_object.parcel_number + 1) + + def post_second_wizard(test_object, final_step_response): + test_object.assertEqual(models.Operation.objects.count(), + test_object.operation_number) + operation = models.Operation.objects.get( + pk=test_object.operations[0].pk) + test_object.assertEqual(operation.operation_type.pk, 2) + test_object.assertEqual(operation.year, 2017) + test_object.assertEqual(models.Parcel.objects.count(), + test_object.parcel_number + 1) + # the init parcel is not submited but have a context record + # the init parcel is not detached from the operation + test_object.assertEqual(operation.parcels.count(), + test_object.parcel_number + 1) + + def pre_third_wizard(test_object): + parcel_nb = models.Parcel.objects.count() + test_object.cr.delete() + test_object.assertEqual( + parcel_nb, models.Parcel.objects.count()) + + def post_third_wizard(test_object, final_step_response): + test_object.assertEqual(models.Operation.objects.count(), + test_object.operation_number) + operation = models.Operation.objects.get( + pk=test_object.operations[0].pk) + test_object.assertEqual(operation.operation_type.pk, 2) + test_object.assertEqual(operation.year, 2017) + # with no attach the parcel is deleted + test_object.assertEqual(operation.parcels.count(), + test_object.parcel_number) + test_object.assertEqual(models.Parcel.objects.count(), + test_object.parcel_number) + + self.form_datas[0].extra_tests = [post_first_wizard] + self.form_datas[1].extra_tests = [post_second_wizard] + self.form_datas[2].pre_tests = [pre_third_wizard] + self.form_datas[2].extra_tests = [post_third_wizard] + super(OperationWizardModifTest, self).pre_wizard() + + class OperationWizardDeleteTest(OperationWizardCreationTest): fixtures = OperationWizardCreationTest.fixtures url_name = 'operation_deletion' diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py index 005fae0db..c4e4acb5e 100644 --- a/archaeological_operations/views.py +++ b/archaeological_operations/views.py @@ -49,9 +49,9 @@ def autocomplete_patriarche(request, non_closed=True): q = request.GET.get('term') query = Q() for q in q.split(' '): - query = query & Q(code_patriarche__startswith=q) + query &= Q(code_patriarche__startswith=q) if non_closed: - query = query & Q(end_date__isnull=True) + query &= Q(end_date__isnull=True) limit = 15 operations = models.Operation.objects\ .filter(query).order_by('code_patriarche')[:limit] @@ -113,12 +113,12 @@ def autocomplete_operation(request, non_closed=True): q = q[2:] try: int(q) - extra = extra | Q(code_patriarche__contains=q) + extra |= Q(code_patriarche__contains=q) except ValueError: pass query = query & extra if non_closed: - query = query & Q(end_date__isnull=True) + query &= Q(end_date__isnull=True) limit = 15 operations = models.Operation.objects.filter(query)[:limit] data = json.dumps([{'id': operation.pk, 'value': unicode(operation)} @@ -215,7 +215,7 @@ operation_creation_wizard = OperationWizard.as_view( condition_dict=ope_crea_condition_dict, url_name='operation_creation',) -operation_modification_wizard = OperationModificationWizard.as_view([ +operation_modif_wizard_steps = [ ('selec-operation_modification', OperationFormSelection), ('general-operation_modification', OperationFormModifGeneral), ('archaeologicalsite-operation_modification', ArchaeologicalSiteFormSet), @@ -229,7 +229,11 @@ operation_modification_wizard = OperationModificationWizard.as_view([ ('periods-operation_modification', PeriodForm), ('relations-operation_modification', RecordRelationsFormSet), ('abstract-operation_modification', OperationFormAbstract), - ('final-operation_modification', FinalForm)], + ('final-operation_modification', FinalForm) +] + +operation_modification_wizard = OperationModificationWizard.as_view( + operation_modif_wizard_steps, label=_(u"Operation modification"), condition_dict={ 'preventive-operation_modification': is_preventive( diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index 42bb1860e..44d7f8275 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -102,20 +102,30 @@ class WizardTestFormData(object): """ Test set to simulate wizard steps """ - def __init__(self, name, form_datas, ignored=[], extra_tests=[]): + def __init__(self, name, form_datas, ignored=[], pre_tests=[], + extra_tests=[]): """ :param name: explicit name of the test :param form_datas: dict with data for each step - dict key are wizard step name :param ignored: steps to be ignored in wizard processing + :param pre_tests: list of function to be executed before the wizard :param extra_tests: list of extra tests. Theses tests must be functions accepting two parameters: the current test object and the final step response """ self.form_datas = form_datas self.ignored = ignored[:] + self.pre_tests = pre_tests self.extra_tests = extra_tests + def inits(self, test_object): + """ + Initialisations before the wizard. + """ + for pre in self.pre_tests: + pre(test_object) + def tests(self, test_object, final_step_response): """ Specific tests for theses datas. Raise Exception if not OK. @@ -185,6 +195,7 @@ class WizardTest(object): url = reverse(self.url_name) self.pre_wizard() for test_form_data in self.form_datas: + test_form_data.inits(self) form_data = test_form_data.form_datas ignored = test_form_data.ignored for idx, step in enumerate(self.steps): @@ -207,27 +218,27 @@ class WizardTest(object): for k in d: data['{}-{}'.format(current_step, k)] = d[k] - next_idx, next_form = idx + 1, None - while len(self.steps) > next_idx: - if self.steps[idx + 1][0] not in ignored: - next_form = self.steps[idx + 1][0] - break - next_idx += 1 - if next_form: - try: - response = self.client.post(url, data) - except ValidationError as e: - # on ManagementForm data is missing or has been tampered - # error verify the wizard_name or step name - raise ValidationError(u"Errors: {} on {}.".format( - u" - ".join(e.messages), current_step)) - self.check_response(response, current_step) + next_form_is_checked = len(self.steps) > idx + 1 and \ + self.steps[idx + 1][0] not in ignored + try: + response = self.client.post(url, data, + follow=not next_form_is_checked) + except ValidationError as e: + # on ManagementForm data is missing or has been tampered + # error verify the wizard_name or step name + raise ValidationError(u"Errors: {} on {}.".format( + u" - ".join(e.messages), current_step)) + self.check_response(response, current_step) + if next_form_is_checked: + next_form = self.steps[idx + 1][0] self.assertRedirects( response, '/{}/{}'.format(self.url_name, next_form)) - else: - response = self.client.post(url, data, follow=True) - self.check_response(response, current_step) + if idx == len(self.steps) - 1: + # last form + self.assertRedirects( + response, + '/{}/done'.format(self.url_name)) test_form_data.tests(self, response) self.post_wizard() -- cgit v1.2.3 From 33fe24b1e8bb81b8e4e2f9851d967ce86616c62b Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sat, 25 Feb 2017 19:18:20 +0100 Subject: Tests: create necessary view(s) on _pre_setup. --- archaeological_context_records/tests.py | 3 +-- archaeological_files/tests.py | 3 ++- archaeological_finds/tests.py | 4 ++-- archaeological_operations/tests.py | 5 ++--- archaeological_warehouse/tests.py | 4 ++-- ishtar_common/tests.py | 13 ++++++++++++- 6 files changed, 21 insertions(+), 11 deletions(-) (limited to 'archaeological_context_records/tests.py') diff --git a/archaeological_context_records/tests.py b/archaeological_context_records/tests.py index 0018aa1f3..2e1355572 100644 --- a/archaeological_context_records/tests.py +++ b/archaeological_context_records/tests.py @@ -22,11 +22,10 @@ import json from django.conf import settings from django.core.exceptions import ValidationError, ImproperlyConfigured from django.core.urlresolvers import reverse -from django.test import TestCase from django.test.client import Client from ishtar_common.models import IshtarSiteProfile, ImporterModel -from ishtar_common.tests import create_superuser +from ishtar_common.tests import create_superuser, TestCase from archaeological_operations.tests import OperationInitTest, \ ImportTest, ImportOperationTest from archaeological_operations import models as models_ope diff --git a/archaeological_files/tests.py b/archaeological_files/tests.py index 8a4c105c6..2b0a63af8 100644 --- a/archaeological_files/tests.py +++ b/archaeological_files/tests.py @@ -25,7 +25,8 @@ import json from django.conf import settings from django.contrib.auth.models import User -from django.test import TestCase + +from ishtar_common.tests import TestCase from ishtar_common.models import PersonType, Town, IshtarSiteProfile from archaeological_files import models diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index a1dc33dd8..cec73de8a 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -23,7 +23,6 @@ from django.conf import settings from django.contrib.auth.models import User from django.core.files.uploadedfile import SimpleUploadedFile from django.core.urlresolvers import reverse -from django.test import TestCase from django.test.client import Client from ishtar_common.models import ImporterType, IshtarUser, ImporterColumn,\ FormaterType, ImportTarget @@ -35,7 +34,8 @@ from archaeological_warehouse.models import Warehouse, WarehouseType from ishtar_common import forms_common -from ishtar_common.tests import WizardTest, WizardTestFormData as FormData +from ishtar_common.tests import WizardTest, WizardTestFormData as FormData, \ + TestCase from archaeological_operations.tests import ImportTest from archaeological_context_records.tests import ImportContextRecordTest, \ ContextRecordInit diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 18548b0b1..ab485572a 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -26,7 +26,6 @@ import datetime from django.conf import settings from django.core.files.uploadedfile import SimpleUploadedFile from django.core.urlresolvers import reverse -from django.test import TestCase from django.test.client import Client from django.contrib.auth.models import Permission @@ -41,7 +40,7 @@ from archaeological_context_records.models import Unit from ishtar_common import forms_common from ishtar_common.tests import WizardTest, WizardTestFormData as FormData, \ - create_superuser, create_user + create_superuser, create_user, TestCase class ImportTest(object): @@ -770,7 +769,7 @@ class OperationTest(TestCase, OperationInitTest): def test_cache_bulk_update(self): if settings.USE_SPATIALITE_FOR_TESTS: - # using views can only be tested with postgresql + # using views - can only be tested with postgresql return operation = self.operations[0] diff --git a/archaeological_warehouse/tests.py b/archaeological_warehouse/tests.py index 7eb3017bc..10b2318b2 100644 --- a/archaeological_warehouse/tests.py +++ b/archaeological_warehouse/tests.py @@ -18,11 +18,11 @@ # See the file COPYING for details. from django.conf import settings -from django.test import TestCase from archaeological_finds.tests import FindInit -from ishtar_common.tests import WizardTest, WizardTestFormData as FormData +from ishtar_common.tests import WizardTest, WizardTestFormData as FormData, \ + TestCase from archaeological_warehouse import models, views, forms diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index 44d7f8275..9395227b2 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -30,8 +30,9 @@ from django.core.files.base import File as DjangoFile from django.core.files.uploadedfile import SimpleUploadedFile from django.core.management import call_command from django.core.urlresolvers import reverse +from django.db import connection, transaction from django.template.defaultfilters import slugify -from django.test import TestCase +from django.test import TestCase as BaseTestCase from django.test.client import Client from django.test.simple import DjangoTestSuiteRunner @@ -39,6 +40,7 @@ from ishtar_common import models from ishtar_common import forms_common from ishtar_common.utils import post_save_point +from archaeological_context_records.models import CRBulkView """ from django.conf import settings import tempfile, datetime @@ -82,6 +84,15 @@ def create_user(): return username, password, user +class TestCase(BaseTestCase): + def _pre_setup(self): + super(TestCase, self)._pre_setup() + if not settings.USE_SPATIALITE_FOR_TESTS: + c = connection.cursor() + c.execute(CRBulkView.CREATE_SQL) + transaction.commit_unless_managed() + + class CommandsTestCase(TestCase): def test_clean_ishtar(self): """ -- cgit v1.2.3