ashb commented on code in PR #29714:
URL: https://github.com/apache/airflow/pull/29714#discussion_r1115775048


##########
tests/cli/commands/test_scheduler_command.py:
##########
@@ -73,6 +73,23 @@ def test_skip_serve_logs(self, mock_process, 
mock_scheduler_job, executor):
             scheduler_command.scheduler(args)
             with pytest.raises(AssertionError):
                 mock_process.assert_has_calls([mock.call(target=serve_logs)])
+    @mock.patch.dict(
+        "os.environ",
+        {
+            "AIRFLOW__DATABASE__CHECK_MIGRATIONS": "False",
+        },
+    )
+    @mock.patch("airflow.utils.db.check_and_run_migrations")
+    @mock.patch("airflow.utils.db.synchronize_log_template")
+    @mock.patch("airflow.cli.commands.scheduler_command.SchedulerJob")
+    @mock.patch("airflow.cli.commands.scheduler_command.Process")
+    @pytest.mark.parametrize("executor", ["LocalExecutor"])
+    def test_check_migrations_is_false(self, mock_process, mock_scheduler_job, 
mock_log, mock_run_migration, executor):
+        args = self.parser.parse_args(["scheduler"])
+        with conf_vars({("core", "executor"): "SequentialExecutor", 
("database", "check_migrations"): "False"}):
+            scheduler_command.scheduler(args)
+            assert mock_run_migration.assert_not_called()
+            assert mock_log.assert_called_once()

Review Comment:
   Mocks don't return anything (they return None) -- they instead validate 
themselves:
   
   ```suggestion
               mock_run_migration.assert_not_called()
               mock_log.assert_called_once()
   ```



-- 
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]

Reply via email to