summaryrefslogtreecommitdiffstats
path: root/lib/python/qmk/tests/test_cli_commands.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python/qmk/tests/test_cli_commands.py')
-rw-r--r--lib/python/qmk/tests/test_cli_commands.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/python/qmk/tests/test_cli_commands.py b/lib/python/qmk/tests/test_cli_commands.py
index df5f047da7..dd0c572a7d 100644
--- a/lib/python/qmk/tests/test_cli_commands.py
+++ b/lib/python/qmk/tests/test_cli_commands.py
@@ -13,14 +13,14 @@ def check_subcommand(command, *args):
return result
-def check_returncode(result, expected=0):
+def check_returncode(result, expected=[0]):
"""Print stdout if `result.returncode` does not match `expected`.
"""
- if result.returncode != expected:
+ if result.returncode not in expected:
print('`%s` stdout:' % ' '.join(result.args))
print(result.stdout)
print('returncode:', result.returncode)
- assert result.returncode == expected
+ assert result.returncode in expected
def test_cformat():
@@ -45,7 +45,7 @@ def test_flash():
def test_flash_bootloaders():
result = check_subcommand('flash', '-b')
- check_returncode(result, 1)
+ check_returncode(result, [1])
def test_config():
@@ -62,7 +62,7 @@ def test_kle2json():
def test_doctor():
result = check_subcommand('doctor', '-n')
- check_returncode(result)
+ check_returncode(result, [0, 1])
assert 'QMK Doctor is checking your environment.' in result.stdout
assert 'QMK is ready to go' in result.stdout
@@ -89,43 +89,43 @@ def test_list_keyboards():
def test_list_keymaps():
result = check_subcommand('list-keymaps', '-kb', 'handwired/onekey/pytest')
- check_returncode(result, 0)
+ check_returncode(result)
assert 'default' and 'test' in result.stdout
def test_list_keymaps_long():
result = check_subcommand('list-keymaps', '--keyboard', 'handwired/onekey/pytest')
- check_returncode(result, 0)
+ check_returncode(result)
assert 'default' and 'test' in result.stdout
def test_list_keymaps_kb_only():
result = check_subcommand('list-keymaps', '-kb', 'niu_mini')
- check_returncode(result, 0)
+ check_returncode(result)
assert 'default' and 'via' in result.stdout
def test_list_keymaps_vendor_kb():
result = check_subcommand('list-keymaps', '-kb', 'ai03/lunar')
- check_returncode(result, 0)
+ check_returncode(result)
assert 'default' and 'via' in result.stdout
def test_list_keymaps_vendor_kb_rev():
result = check_subcommand('list-keymaps', '-kb', 'kbdfans/kbd67/mkiirgb/v2')
- check_returncode(result, 0)
+ check_returncode(result)
assert 'default' and 'via' in result.stdout
def test_list_keymaps_no_keyboard_found():
result = check_subcommand('list-keymaps', '-kb', 'asdfghjkl')
- check_returncode(result, 1)
+ check_returncode(result, [1])
assert 'does not exist' in result.stdout
def test_json2c():
result = check_subcommand('json2c', 'keyboards/handwired/onekey/keymaps/default_json/keymap.json')
- check_returncode(result, 0)
+ check_returncode(result)
assert result.stdout == '#include QMK_KEYBOARD_H\nconst uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {\t[0] = LAYOUT_ortho_1x1(KC_A)};\n\n'