CLI: Udev related fixes and improvements (#10736)
This commit is contained in:
parent
94e94ffb5b
commit
b337ba798e
3 changed files with 141 additions and 116 deletions
|
@ -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'
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue