test_run: Patch importlib.import_module last.
importlib.import_module is now used in the implementation of unittest.mock.patch. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
6b585f8b73
commit
183bb933b4
1 changed files with 5 additions and 5 deletions
|
@ -120,11 +120,11 @@ class TestDefaultArguments(TestCase):
|
||||||
with patch(
|
with patch(
|
||||||
"sys.argv", ["zulip-run-bot", "bot.module.name", "--config-file", "/path/to/config"]
|
"sys.argv", ["zulip-run-bot", "bot.module.name", "--config-file", "/path/to/config"]
|
||||||
):
|
):
|
||||||
with patch(
|
with patch("zulip_bots.run.run_message_handler_for_bot"):
|
||||||
"importlib.import_module", return_value=mock_bot_module
|
with patch("zulip_bots.run.exit_gracefully_if_zulip_config_is_missing"):
|
||||||
) as mock_import_module:
|
with patch(
|
||||||
with patch("zulip_bots.run.run_message_handler_for_bot"):
|
"importlib.import_module", return_value=mock_bot_module
|
||||||
with patch("zulip_bots.run.exit_gracefully_if_zulip_config_is_missing"):
|
) as mock_import_module:
|
||||||
zulip_bots.run.main()
|
zulip_bots.run.main()
|
||||||
mock_import_module.assert_called_once_with(bot_module_name)
|
mock_import_module.assert_called_once_with(bot_module_name)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue