ephraimbuddy commented on code in PR #38876:
URL: https://github.com/apache/airflow/pull/38876#discussion_r1566875191
##########
tests/utils/test_db.py:
##########
@@ -143,23 +143,29 @@ def test_offline_upgrade_wrong_order(self, from_revision,
to_revision):
],
)
def test_offline_upgrade_revision_nothing(self, from_revision,
to_revision):
- with mock.patch("airflow.utils.db.settings.engine.dialect"):
- with mock.patch("alembic.command.upgrade"):
- with redirect_stdout(StringIO()) as temp_stdout:
- upgradedb(to_revision=to_revision,
from_revision=from_revision, show_sql_only=True)
- stdout = temp_stdout.getvalue()
- assert "nothing to do" in stdout
-
+ with mock.patch("alembic.command.upgrade"):
+ with redirect_stdout(StringIO()) as temp_stdout:
+ upgradedb(to_revision=to_revision,
from_revision=from_revision, show_sql_only=True)
+ stdout = temp_stdout.getvalue()
+ assert "nothing to do" in stdout
+
+ @pytest.mark.skipif(
+ conf.get_mandatory_value("database",
"sql_alchemy_conn").lower().startswith("sqlite"),
+ reason="Offline migration not supported for SQLite.",
+ )
@pytest.mark.parametrize(
"from_revision, to_revision",
[("90d1635d7b86", "54bebd308c5f"), ("e959f08ac86c", "587bdf053233")],
)
def test_offline_upgrade_revision(self, from_revision, to_revision):
- with mock.patch("airflow.utils.db.settings.engine.dialect"):
- with mock.patch("alembic.command.upgrade") as mock_alembic_upgrade:
- upgradedb(from_revision=from_revision,
to_revision=to_revision, show_sql_only=True)
+ with mock.patch("alembic.command.upgrade") as mock_alembic_upgrade:
+ upgradedb(from_revision=from_revision, to_revision=to_revision,
show_sql_only=True)
mock_alembic_upgrade.assert_called_once_with(mock.ANY,
f"{from_revision}:{to_revision}", sql=True)
+ @pytest.mark.skipif(
+ conf.get_mandatory_value("database",
"sql_alchemy_conn").lower().startswith("sqlite"),
+ reason="Offline migration not supported for SQLite.",
Review Comment:
Why do we now have this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]