summaryrefslogtreecommitdiff
path: root/tests/postgres_tests
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2022-07-20 07:34:21 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-07-26 11:41:19 +0200
commita1e9e9abc592b8f44fa798c6e4e225b1a04f757c (patch)
tree7c0713759aa50f55b639433675015e385c434e04 /tests/postgres_tests
parentc773d5794eb425c4836c726bdf6e1e742c94e9c0 (diff)
downloaddjango-a1e9e9abc592b8f44fa798c6e4e225b1a04f757c.tar.gz
Refs #27236 -- Reverted "Refs #27236 -- Added generic mechanism to handle the deprecation of migration operations."
This reverts commit 41019e48bbf082c985e6ba3bad34d118b903bff1.
Diffstat (limited to 'tests/postgres_tests')
-rw-r--r--tests/postgres_tests/migrations/0001_setup_extensions.py33
1 files changed, 11 insertions, 22 deletions
diff --git a/tests/postgres_tests/migrations/0001_setup_extensions.py b/tests/postgres_tests/migrations/0001_setup_extensions.py
index 3edeff7b82..090abf9649 100644
--- a/tests/postgres_tests/migrations/0001_setup_extensions.py
+++ b/tests/postgres_tests/migrations/0001_setup_extensions.py
@@ -1,17 +1,6 @@
-from django.db import connection, migrations
-from django.db.migrations.operations.base import Operation
-
-
-class DummyOperation(Operation):
- def state_forwards(self, app_label, state):
- pass
-
- def database_forwards(self, app_label, schema_editor, from_state, to_state):
- pass
-
- def database_backwards(self, app_label, schema_editor, from_state, to_state):
- pass
+from unittest import mock
+from django.db import connection, migrations
try:
from django.contrib.postgres.operations import (
@@ -26,14 +15,14 @@ try:
UnaccentExtension,
)
except ImportError:
- BloomExtension = DummyOperation
- BtreeGinExtension = DummyOperation
- BtreeGistExtension = DummyOperation
- CITextExtension = DummyOperation
- CreateExtension = DummyOperation
- HStoreExtension = DummyOperation
- TrigramExtension = DummyOperation
- UnaccentExtension = DummyOperation
+ BloomExtension = mock.Mock()
+ BtreeGinExtension = mock.Mock()
+ BtreeGistExtension = mock.Mock()
+ CITextExtension = mock.Mock()
+ CreateExtension = mock.Mock()
+ HStoreExtension = mock.Mock()
+ TrigramExtension = mock.Mock()
+ UnaccentExtension = mock.Mock()
needs_crypto_extension = False
else:
needs_crypto_extension = (
@@ -52,7 +41,7 @@ class Migration(migrations.Migration):
# dash in its name.
CreateExtension("uuid-ossp"),
# CryptoExtension is required for RandomUUID() on PostgreSQL < 13.
- CryptoExtension() if needs_crypto_extension else DummyOperation(),
+ CryptoExtension() if needs_crypto_extension else mock.Mock(),
HStoreExtension(),
TrigramExtension(),
UnaccentExtension(),