]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
Move op tests for Postgresql to test_postgresql
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 22 Aug 2016 15:22:28 +0000 (11:22 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 22 Aug 2016 15:22:28 +0000 (11:22 -0400)
This moves tests for op features specific to Postgresql.
Note this does not include tests in test_op that
make use of the postgresql backend just for "schema" support.

Change-Id: I82b4326bbc3a2c520891214c8e8254da36bd8f2a

tests/test_op.py
tests/test_postgresql.py

index 814d98e2b6dc7190b43beacdf997be48351df9a7..a4ada7bd91abecf3ee0e2f7acf2a9846752bf1c8 100644 (file)
@@ -32,16 +32,6 @@ class OpTest(TestBase):
         op.rename_table('t1', 't2', schema="foo")
         context.assert_("ALTER TABLE foo.t1 RENAME TO foo.t2")
 
-    def test_rename_table_postgresql(self):
-        context = op_fixture("postgresql")
-        op.rename_table('t1', 't2')
-        context.assert_("ALTER TABLE t1 RENAME TO t2")
-
-    def test_rename_table_schema_postgresql(self):
-        context = op_fixture("postgresql")
-        op.rename_table('t1', 't2', schema="foo")
-        context.assert_("ALTER TABLE foo.t1 RENAME TO t2")
-
     def test_create_index_no_expr_allowed(self):
         op_fixture()
         assert_raises_message(
@@ -108,29 +98,6 @@ class OpTest(TestBase):
         context.assert_(
             "CREATE INDEX geocoded ON locations (lower(coordinates))")
 
-    @config.requirements.fail_before_sqla_080
-    def test_create_index_postgresql_expressions(self):
-        context = op_fixture("postgresql")
-        op.create_index(
-            'geocoded',
-            'locations',
-            [text('lower(coordinates)')],
-            postgresql_where=text("locations.coordinates != Null"))
-        context.assert_(
-            "CREATE INDEX geocoded ON locations (lower(coordinates)) "
-            "WHERE locations.coordinates != Null")
-
-    def test_create_index_postgresql_where(self):
-        context = op_fixture("postgresql")
-        op.create_index(
-            'geocoded',
-            'locations',
-            ['coordinates'],
-            postgresql_where=text("locations.coordinates != Null"))
-        context.assert_(
-            "CREATE INDEX geocoded ON locations (coordinates) "
-            "WHERE locations.coordinates != Null")
-
     def test_add_column(self):
         context = op_fixture()
         op.add_column('t1', Column('c1', Integer, nullable=False))
index b9973c28324bd68b2c098d116e59e6580a83abf0..1724898f2dae7cb2264a915296a535d4bb957f0a 100644 (file)
@@ -19,8 +19,45 @@ from alembic.testing.env import staging_env, clear_staging_env, \
     _no_sql_testing_config, write_script
 from alembic.testing.fixtures import capture_context_buffer
 from alembic.testing.fixtures import TestBase
-
+from alembic.testing.fixtures import op_fixture
 from alembic.testing import config
+from alembic import op
+
+
+class PostgresqlOpTest(TestBase):
+
+    def test_rename_table_postgresql(self):
+        context = op_fixture("postgresql")
+        op.rename_table('t1', 't2')
+        context.assert_("ALTER TABLE t1 RENAME TO t2")
+
+    def test_rename_table_schema_postgresql(self):
+        context = op_fixture("postgresql")
+        op.rename_table('t1', 't2', schema="foo")
+        context.assert_("ALTER TABLE foo.t1 RENAME TO t2")
+
+    @config.requirements.fail_before_sqla_080
+    def test_create_index_postgresql_expressions(self):
+        context = op_fixture("postgresql")
+        op.create_index(
+            'geocoded',
+            'locations',
+            [text('lower(coordinates)')],
+            postgresql_where=text("locations.coordinates != Null"))
+        context.assert_(
+            "CREATE INDEX geocoded ON locations (lower(coordinates)) "
+            "WHERE locations.coordinates != Null")
+
+    def test_create_index_postgresql_where(self):
+        context = op_fixture("postgresql")
+        op.create_index(
+            'geocoded',
+            'locations',
+            ['coordinates'],
+            postgresql_where=text("locations.coordinates != Null"))
+        context.assert_(
+            "CREATE INDEX geocoded ON locations (coordinates) "
+            "WHERE locations.coordinates != Null")
 
 
 class PGOfflineEnumTest(TestBase):