From c7284ffa2a10796d1aaf089cc044ed0cf505f45a Mon Sep 17 00:00:00 2001 From: Twentysix Date: Thu, 22 Dec 2016 18:54:27 +0100 Subject: [PATCH] [Core] Added `--dry-run` flag and Travis CI boot test This should help testing the boot process right until login --- .travis.yml | 1 + cogs/utils/settings.py | 6 ++++++ red.py | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/.travis.yml b/.travis.yml index afb2a0760..f4c4d5695 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ install: script: - python -m compileall ./red.py - python -m compileall ./cogs + - python ./red.py --no-prompt --no-cogs --dry-run cache: pip notifications: email: false diff --git a/cogs/utils/settings.py b/cogs/utils/settings.py index cb1fc829b..944cace7f 100644 --- a/cogs/utils/settings.py +++ b/cogs/utils/settings.py @@ -72,6 +72,11 @@ class Settings: action="store_true", help="Arguments passed and future edits to the " "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", action="store_true", help="Enables debug mode") @@ -92,6 +97,7 @@ class Settings: self._memory_only = args.memory_only self._no_cogs = args.no_cogs self.debug = args.debug + self._dry_run = args.dry_run self.save_settings() diff --git a/red.py b/red.py index 5ca946ded..5235786e5 100644 --- a/red.py +++ b/red.py @@ -528,6 +528,10 @@ def main(bot): interactive_setup(bot.settings) load_cogs(bot) + if bot.settings._dry_run: + print("Quitting: dry run") + exit(0) + print("Logging into Discord...") bot.uptime = datetime.datetime.utcnow()