diff options
| author | Gord Thompson <gord@gordthompson.com> | 2020-04-04 13:39:50 -0600 |
|---|---|---|
| committer | Gord Thompson <gord@gordthompson.com> | 2020-04-04 15:54:55 -0600 |
| commit | 50f1e1392a92f31f1f2d5110e6632bc5a32467e7 (patch) | |
| tree | 72e8a08ba410f3c21ed81b3c1ca40e734ed5e49a /lib/sqlalchemy | |
| parent | 139aac4aba98b170787a63f0f0ca785c1fdfc63b (diff) | |
| download | sqlalchemy-50f1e1392a92f31f1f2d5110e6632bc5a32467e7.tar.gz | |
Apply fix to ComputedReflectionFixtureTest
Avoid errors for dialects without schema support.
Also fix typo in test name.
Fixes: #5230
Change-Id: Id0f759b591a6119069b0fc5fc3b02addb85b0597
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/testing/fixtures.py | 44 | ||||
| -rw-r--r-- | lib/sqlalchemy/testing/suite/test_reflection.py | 3 |
2 files changed, 26 insertions, 21 deletions
diff --git a/lib/sqlalchemy/testing/fixtures.py b/lib/sqlalchemy/testing/fixtures.py index 4914d49ec..4f6083401 100644 --- a/lib/sqlalchemy/testing/fixtures.py +++ b/lib/sqlalchemy/testing/fixtures.py @@ -463,14 +463,16 @@ class ComputedReflectionFixtureTest(TablesTest): Column("computed_no_flag", Integer, Computed("normal + 42")), ) - t2 = Table( - "computed_column_table", - metadata, - Column("id", Integer, primary_key=True), - Column("normal", Integer), - Column("computed_no_flag", Integer, Computed("normal / 42")), - schema=config.test_schema, - ) + if testing.requires.schemas.enabled: + t2 = Table( + "computed_column_table", + metadata, + Column("id", Integer, primary_key=True), + Column("normal", Integer), + Column("computed_no_flag", Integer, Computed("normal / 42")), + schema=config.test_schema, + ) + if testing.requires.computed_columns_virtual.enabled: t.append_column( Column( @@ -479,13 +481,14 @@ class ComputedReflectionFixtureTest(TablesTest): Computed("normal + 2", persisted=False), ) ) - t2.append_column( - Column( - "computed_virtual", - Integer, - Computed("normal / 2", persisted=False), + if testing.requires.schemas.enabled: + t2.append_column( + Column( + "computed_virtual", + Integer, + Computed("normal / 2", persisted=False), + ) ) - ) if testing.requires.computed_columns_stored.enabled: t.append_column( Column( @@ -494,10 +497,11 @@ class ComputedReflectionFixtureTest(TablesTest): Computed("normal - 42", persisted=True), ) ) - t2.append_column( - Column( - "computed_stored", - Integer, - Computed("normal * 42", persisted=True), + if testing.requires.schemas.enabled: + t2.append_column( + Column( + "computed_stored", + Integer, + Computed("normal * 42", persisted=True), + ) ) - ) diff --git a/lib/sqlalchemy/testing/suite/test_reflection.py b/lib/sqlalchemy/testing/suite/test_reflection.py index 68a43feb7..51beb0973 100644 --- a/lib/sqlalchemy/testing/suite/test_reflection.py +++ b/lib/sqlalchemy/testing/suite/test_reflection.py @@ -1243,7 +1243,8 @@ class ComputedReflectionTest(fixtures.ComputedReflectionFixtureTest): data, "computed_stored", "normal-42", True, ) - def test_get_column_returns_persisted_with_schama(self): + @testing.requires.schemas + def test_get_column_returns_persisted_with_schema(self): insp = inspect(config.db) cols = insp.get_columns( |
