[Core] Added --dry-run flag and Travis CI boot test

This should help testing the boot process right until login
This commit is contained in:
Twentysix 2016-12-22 18:54:27 +01:00
parent 6f068191f1
commit c7284ffa2a
3 changed files with 11 additions and 0 deletions

View File

@ -6,6 +6,7 @@ install:
script: script:
- python -m compileall ./red.py - python -m compileall ./red.py
- python -m compileall ./cogs - python -m compileall ./cogs
- python ./red.py --no-prompt --no-cogs --dry-run
cache: pip cache: pip
notifications: notifications:
email: false email: false

View File

@ -72,6 +72,11 @@ class Settings:
action="store_true", action="store_true",
help="Arguments passed and future edits to the " help="Arguments passed and future edits to the "
"settings will not be saved to disk") "settings will not be saved to disk")
parser.add_argument("--dry-run",
action="store_true",
help="Makes Red quit with code 0 just before the "
"login. This is useful for testing the boot "
"process.")
parser.add_argument("--debug", parser.add_argument("--debug",
action="store_true", action="store_true",
help="Enables debug mode") help="Enables debug mode")
@ -92,6 +97,7 @@ class Settings:
self._memory_only = args.memory_only self._memory_only = args.memory_only
self._no_cogs = args.no_cogs self._no_cogs = args.no_cogs
self.debug = args.debug self.debug = args.debug
self._dry_run = args.dry_run
self.save_settings() self.save_settings()

4
red.py
View File

@ -528,6 +528,10 @@ def main(bot):
interactive_setup(bot.settings) interactive_setup(bot.settings)
load_cogs(bot) load_cogs(bot)
if bot.settings._dry_run:
print("Quitting: dry run")
exit(0)
print("Logging into Discord...") print("Logging into Discord...")
bot.uptime = datetime.datetime.utcnow() bot.uptime = datetime.datetime.utcnow()