Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added non-zero exit code to run_bots if there is no bots to actually run #78

Merged
merged 7 commits into from
Feb 10, 2022

Conversation

NecroKote
Copy link
Contributor

@NecroKote NecroKote commented Jan 30, 2022

Nice addition to #76

  • bot registration now raises BotRegistrationFailed if there are dependencies missing.
  • at launch, the user can see all the configured bots that failed to register as log warning
  • run_bots now exits with code 1 if were were no actual bots to run. this way systemd (or supervisord) status will show whether there is something wrong with bots on the start
  • renamed test_bots to test_bot_telegram and made it conditional on the required package. this helps to pass tests on build servers without installing additional dependencies.

(duplicate of #77, as for some reason it didn't pull latest commit)

also, renamed `test_bots` to `test_bot_telegram` and make it a conditional test, based on `python-telegram-bot` module installed
@coveralls
Copy link

coveralls commented Jan 30, 2022

Pull Request Test Coverage Report for Build 1800466733

  • 17 of 18 (94.44%) changed or added relevant lines in 4 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+1.6%) to 69.258%

Changes Missing Coverage Covered Lines Changed/Added Lines %
torrt/toolbox.py 12 13 92.31%
Files with Coverage Reduction New Missed Lines %
torrt/utils.py 1 87.21%
Totals Coverage Status
Change from base Build 1798299692: 1.6%
Covered Lines: 1158
Relevant Lines: 1672

💛 - Coveralls

torrt/bots/telegram_bot.py Outdated Show resolved Hide resolved
tests/conftest.py Outdated Show resolved Hide resolved
@NecroKote
Copy link
Contributor Author

@idlesign I think this one is done. Please review it again.

I've added a bunch of tests for new logic:

  • magic-mock for everything telegram-lib related
  • basic run_bots cycle (basically same test as before)
  • test_no_bots_to_run_exists checks that in deed, sys.exit(1) occurs on torrt run_bots without having a single configured bot
  • test_telegram_without_plugin_raises_exception basic check, that telegram behaves as we expect (raises BotRegistrationFailed)
  • test_bot_configured_but_unregistered checks that the user sees a new warning, about configured, but unregistered bot (for example - forgot to install plugin. this happens to me all the time)

PS: Python 3.6 failing because of dependency shift. I'll prepare basic 'housekeeping' PR - shifting dates to 2022, removing 3.6 support etc..

@NecroKote NecroKote mentioned this pull request Feb 5, 2022
@idlesign idlesign merged commit 296f378 into idlesign:master Feb 10, 2022
@idlesign
Copy link
Owner

Thank you. Merged.

@NecroKote NecroKote deleted the bots_exit_code branch February 10, 2022 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants