Repository navigation
Conversation
|
Thanks for the PR @NaniToka . |
6d2ce9e to
1c9e7c6
Compare
|
Thanks for the review and guidance, @rht! That makes complete sense. I have scoped this PR down strictly to point 1 as suggested:
All 29 tests pass locally across |
Previously, `exit_gracefully_if_zulip_config_is_missing` and `zulip_env_vars_are_present` were defined only inside `zulip_bots`. Other tools (such as `zulip-cli` and custom scripts) could not reuse this validation logic without code duplication. This commit: - Moves `zulip_env_vars_are_present` and `exit_gracefully_if_zulip_config_is_missing` to the core `zulip` module (`zulip/__init__.py`). - Supports an optional `allow_default_config` parameter (defaulting to `True` for general tools, while `zulip_bots` passes `False` to maintain its existing explicit configuration semantics). - Retains `zulip_bots.lib.zulip_env_vars_are_present` as a delegation wrapper for backwards compatibility. - Updates `zulip_bots.run.exit_gracefully_if_zulip_config_is_missing` to delegate to `zulip`. - Adds unit tests in `zulip/tests/test_config.py` for both functions. Fixes zulip#696.
1c9e7c6 to
2c755a4
Compare
|
Hi @rht, thank you for sharing the discussion, and I completely respect and understand your perspective regarding reviewer bandwidth and effort. To respect your time, I made sure this revised commit is strictly focused on the single abstraction ( Please feel free to review it whenever you have time, with zero rush. I really appreciate your guidance and feedback! |
Fixes #696.
Overview
Abstracts
exit_gracefully_if_zulip_config_is_missingandzulip_env_vars_are_presentfromzulip_botsinto the corezuliplibrary (zulip/__init__.py), making the config checking mechanism reusable across tools (such aszulip-cliin a follow-up step).Summary of Changes
zulip_env_vars_are_present()andexit_gracefully_if_zulip_config_is_missing()tozulip/__init__.py. Included anallow_default_configparameter (defaulting toTruefor general tools, whilezulip_botspassesFalseto preserve its existing explicit-config behavior).zulip_bots.lib.zulip_env_vars_are_presentto delegate tozulip.zulip_bots.run.exit_gracefully_if_zulip_config_is_missingto delegate tozulip.zulip/tests/test_config.pycovering environment variable detection and graceful exit behavior.Verification
pytest zulip/tests/ zulip_bots/zulip_bots/tests/passed (29 passed)../tools/lint-commitspassed cleanly.