From 75c3b1a9f8480e73ebf3164ca441d61f9a0d3025 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 19 Aug 2016 14:57:21 +0200 Subject: [PATCH] Fix test for :debug-log-level with invalid level Since we're getting dictionary keys in choices=..., we need to sort them so we get a consistent message. --- qutebrowser/misc/utilcmds.py | 5 +++-- tests/end2end/features/misc.feature | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/qutebrowser/misc/utilcmds.py b/qutebrowser/misc/utilcmds.py index e192cecda..84d666c58 100644 --- a/qutebrowser/misc/utilcmds.py +++ b/qutebrowser/misc/utilcmds.py @@ -259,8 +259,9 @@ def window_only(current_win_id): @cmdutils.register(debug=True) -@cmdutils.argument('level', choices=[level.lower() - for level in log.LOG_LEVELS]) +@cmdutils.argument('level', choices=sorted( + (level.lower() for level in log.LOG_LEVELS), + key=lambda e: log.LOG_LEVELS[e.upper()])) def debug_log_level(level: str): """Change the log level for console logging. diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index 6e6f6f360..535c342aa 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -610,4 +610,4 @@ Feature: Various utility commands. Scenario: Using debug-log-level with invalid level When I run :debug-log-level hello - Then the error "Invalid value hello - expected one of: debug, error, vdebug, info, warning, critical" should be shown + Then the error "level: Invalid value hello - expected one of: vdebug, debug, info, warning, error, critical" should be shown