Ticket #24290: 24290-exploration.diff

File 24290-exploration.diff, 2.6 KB (added by Tim Graham, 10 years ago)
  • tests/postgres_tests/migrations/0001_setup_extensions.py

    diff --git a/tests/postgres_tests/migrations/0001_setup_extensions.py b/tests/postgres_tests/migrations/0001_setup_extensions.py
    index 0915b74..d5ee4ee 100644
    a b from __future__ import unicode_literals  
    44from django.contrib.postgres.operations import (
    55    HStoreExtension, UnaccentExtension,
    66)
    7 from django.db import migrations
     7from django.db import connection, migrations
    88
    99
    1010class Migration(migrations.Migration):
    class Migration(migrations.Migration):  
    1515    operations = [
    1616        HStoreExtension(),
    1717        UnaccentExtension(),
    18     ]
     18    ] if connection.vendor == 'postgresql' else ''
  • tests/postgres_tests/migrations/0002_create_test_models.py

    diff --git a/tests/postgres_tests/migrations/0002_create_test_models.py b/tests/postgres_tests/migrations/0002_create_test_models.py
    index c4f031f..2ec910e 100644
    a b from __future__ import unicode_literals  
    33
    44import django.contrib.postgres.fields
    55import django.contrib.postgres.fields.hstore
    6 from django.db import migrations, models
     6from django.db import connection, migrations, models
    77
    88
    99class Migration(migrations.Migration):
    class Migration(migrations.Migration):  
    105105            options=None,
    106106            bases=None,
    107107        ),
    108     ]
     108    ] if connection.vendor == 'postgresql' else []
    109109
    110110    pg_92_operations = [
    111111        migrations.CreateModel(
    class Migration(migrations.Migration):  
    125125    ]
    126126
    127127    def apply(self, project_state, schema_editor, collect_sql=False):
    128         PG_VERSION = schema_editor.connection.pg_version
    129         if PG_VERSION >= 90200:
    130             self.operations = self.operations + self.pg_92_operations
     128        if connection.vendor == 'postgresql':
     129            PG_VERSION = schema_editor.connection.pg_version
     130            if PG_VERSION >= 90200:
     131                self.operations = self.operations + self.pg_92_operations
    131132        return super(Migration, self).apply(project_state, schema_editor, collect_sql)
  • tests/runtests.py

    diff --git a/tests/runtests.py b/tests/runtests.py
    index b1cbed4..a7f5019 100755
    a b def get_test_modules():  
    8484                    os.path.isfile(f) or
    8585                    not os.path.exists(os.path.join(dirpath, f, '__init__.py'))):
    8686                continue
    87             if not connection.vendor == 'postgresql' and f == 'postgres_tests' or f == 'postgres':
    88                 continue
    8987            modules.append((modpath, f))
    9088    return modules
    9189
Back to Top