2020-11-02 09:41:01 +01:00
|
|
|
import platform
|
2021-05-20 00:24:46 +02:00
|
|
|
from subprocess import DEVNULL
|
2020-11-02 09:41:01 +01:00
|
|
|
|
2021-05-20 00:24:46 +02:00
|
|
|
from milc import cli
|
2019-09-22 22:25:33 +02:00
|
|
|
|
2020-11-02 09:41:01 +01:00
|
|
|
is_windows = 'windows' in platform.platform().lower()
|
|
|
|
|
2019-09-22 22:25:33 +02:00
|
|
|
|
|
|
|
def check_subcommand(command, *args):
|
2021-03-08 04:10:03 +01:00
|
|
|
cmd = ['qmk', command, *args]
|
2021-05-20 00:24:46 +02:00
|
|
|
result = cli.run(cmd, stdin=DEVNULL, combined_output=True)
|
2020-05-26 22:05:41 +02:00
|
|
|
return result
|
|
|
|
|
|
|
|
|
2020-12-29 20:34:48 +01:00
|
|
|
def check_subcommand_stdin(file_to_read, command, *args):
|
|
|
|
"""Pipe content of a file to a command and return output.
|
|
|
|
"""
|
2021-02-27 21:00:50 +01:00
|
|
|
with open(file_to_read, encoding='utf-8') as my_file:
|
2021-03-08 04:10:03 +01:00
|
|
|
cmd = ['qmk', command, *args]
|
2021-05-20 00:24:46 +02:00
|
|
|
result = cli.run(cmd, stdin=my_file, combined_output=True)
|
2020-12-29 20:34:48 +01:00
|
|
|
return result
|
|
|
|
|
|
|
|
|
2020-11-16 22:09:32 +01:00
|
|
|
def check_returncode(result, expected=[0]):
|
2020-05-26 22:05:41 +02:00
|
|
|
"""Print stdout if `result.returncode` does not match `expected`.
|
|
|
|
"""
|
2020-11-16 22:09:32 +01:00
|
|
|
if result.returncode not in expected:
|
2020-05-26 22:05:41 +02:00
|
|
|
print('`%s` stdout:' % ' '.join(result.args))
|
|
|
|
print(result.stdout)
|
|
|
|
print('returncode:', result.returncode)
|
2020-11-16 22:09:32 +01:00
|
|
|
assert result.returncode in expected
|
2019-09-22 22:25:33 +02:00
|
|
|
|
|
|
|
|
2021-07-23 22:41:33 +02:00
|
|
|
def test_format_c():
|
|
|
|
result = check_subcommand('format-c', '-n', 'quantum/matrix.c')
|
2020-05-26 22:05:41 +02:00
|
|
|
check_returncode(result)
|
2019-09-22 22:25:33 +02:00
|
|
|
|
|
|
|
|
2021-07-23 22:41:33 +02:00
|
|
|
def test_format_c_all():
|
|
|
|
result = check_subcommand('format-c', '-n', '-a')
|
2021-05-10 20:18:44 +02:00
|
|
|
check_returncode(result, [0, 1])
|
|
|
|
|
|
|
|
|
2019-09-22 22:25:33 +02:00
|
|
|
def test_compile():
|
2021-01-05 01:52:31 +01:00
|
|
|
result = check_subcommand('compile', '-kb', 'handwired/pytest/basic', '-km', 'default', '-n')
|
2020-05-26 22:05:41 +02:00
|
|
|
check_returncode(result)
|
2019-09-22 22:25:33 +02:00
|
|
|
|
2019-11-16 08:10:19 +01:00
|
|
|
|
2020-10-07 02:10:19 +02:00
|
|
|
def test_compile_json():
|
2021-01-05 01:52:31 +01:00
|
|
|
result = check_subcommand('compile', '-kb', 'handwired/pytest/basic', '-km', 'default_json', '-n')
|
2020-10-07 02:10:19 +02:00
|
|
|
check_returncode(result)
|
|
|
|
|
|
|
|
|
2019-10-05 08:38:34 +02:00
|
|
|
def test_flash():
|
2021-01-05 01:52:31 +01:00
|
|
|
result = check_subcommand('flash', '-kb', 'handwired/pytest/basic', '-km', 'default', '-n')
|
2020-05-26 22:05:41 +02:00
|
|
|
check_returncode(result)
|
|
|
|
|
|
|
|
|
|
|
|
def test_flash_bootloaders():
|
|
|
|
result = check_subcommand('flash', '-b')
|
2020-11-16 22:09:32 +01:00
|
|
|
check_returncode(result, [1])
|
2019-09-22 22:25:33 +02:00
|
|
|
|
2019-11-16 08:10:19 +01:00
|
|
|
|
2019-11-13 05:55:41 +01:00
|
|
|
def test_kle2json():
|
2020-10-07 01:46:10 +02:00
|
|
|
result = check_subcommand('kle2json', 'lib/python/qmk/tests/kle.txt', '-f')
|
2020-05-26 22:05:41 +02:00
|
|
|
check_returncode(result)
|
2020-10-07 01:46:10 +02:00
|
|
|
assert 'Wrote out' in result.stdout
|
2019-09-22 22:25:33 +02:00
|
|
|
|
2019-11-13 06:24:56 +01:00
|
|
|
|
2019-09-22 22:25:33 +02:00
|
|
|
def test_doctor():
|
2020-02-08 13:43:55 +01:00
|
|
|
result = check_subcommand('doctor', '-n')
|
2020-11-16 22:09:32 +01:00
|
|
|
check_returncode(result, [0, 1])
|
2020-05-26 22:05:41 +02:00
|
|
|
assert 'QMK Doctor is checking your environment.' in result.stdout
|
|
|
|
assert 'QMK is ready to go' in result.stdout
|
2019-09-22 22:25:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_hello():
|
|
|
|
result = check_subcommand('hello')
|
2020-05-26 22:05:41 +02:00
|
|
|
check_returncode(result)
|
|
|
|
assert 'Hello,' in result.stdout
|
2019-09-22 22:25:33 +02:00
|
|
|
|
|
|
|
|
2021-07-23 22:41:33 +02:00
|
|
|
def test_format_python():
|
2021-11-18 00:02:45 +01:00
|
|
|
result = check_subcommand('format-python', '-n', '-a')
|
2020-05-26 22:05:41 +02:00
|
|
|
check_returncode(result)
|
2021-11-18 00:02:45 +01:00
|
|
|
assert 'Successfully formatted the python code.' in result.stdout
|
2020-05-26 22:05:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_list_keyboards():
|
|
|
|
result = check_subcommand('list-keyboards')
|
|
|
|
check_returncode(result)
|
|
|
|
# check to see if a known keyboard is returned
|
2021-01-05 01:52:31 +01:00
|
|
|
# this will fail if handwired/pytest/basic is removed
|
|
|
|
assert 'handwired/pytest/basic' in result.stdout
|
2019-10-07 20:32:30 +02:00
|
|
|
|
|
|
|
|
2020-05-16 22:47:07 +02:00
|
|
|
def test_list_keymaps():
|
2021-01-05 01:52:31 +01:00
|
|
|
result = check_subcommand('list-keymaps', '-kb', 'handwired/pytest/basic')
|
2020-11-16 22:09:32 +01:00
|
|
|
check_returncode(result)
|
2022-07-23 18:42:19 +02:00
|
|
|
assert 'default' in result.stdout
|
|
|
|
assert 'default_json' in result.stdout
|
2019-10-13 19:16:19 +02:00
|
|
|
|
2020-01-07 21:54:21 +01:00
|
|
|
|
2020-05-16 22:47:07 +02:00
|
|
|
def test_list_keymaps_long():
|
2021-01-05 01:52:31 +01:00
|
|
|
result = check_subcommand('list-keymaps', '--keyboard', 'handwired/pytest/basic')
|
2020-11-16 22:09:32 +01:00
|
|
|
check_returncode(result)
|
2022-07-23 18:42:19 +02:00
|
|
|
assert 'default' in result.stdout
|
|
|
|
assert 'default_json' in result.stdout
|
2021-01-05 01:52:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
def test_list_keymaps_community():
|
|
|
|
result = check_subcommand('list-keymaps', '--keyboard', 'handwired/pytest/has_community')
|
|
|
|
check_returncode(result)
|
|
|
|
assert 'test' in result.stdout
|
2020-05-16 22:47:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_list_keymaps_kb_only():
|
2022-02-02 05:44:42 +01:00
|
|
|
result = check_subcommand('list-keymaps', '-kb', 'contra')
|
2020-11-16 22:09:32 +01:00
|
|
|
check_returncode(result)
|
2022-07-23 18:42:19 +02:00
|
|
|
assert 'default' in result.stdout
|
|
|
|
assert 'via' in result.stdout
|
2020-05-16 22:47:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_list_keymaps_vendor_kb():
|
|
|
|
result = check_subcommand('list-keymaps', '-kb', 'ai03/lunar')
|
2020-11-16 22:09:32 +01:00
|
|
|
check_returncode(result)
|
2022-07-23 18:42:19 +02:00
|
|
|
assert 'default' in result.stdout
|
|
|
|
assert 'via' in result.stdout
|
2020-05-16 22:47:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_list_keymaps_vendor_kb_rev():
|
|
|
|
result = check_subcommand('list-keymaps', '-kb', 'kbdfans/kbd67/mkiirgb/v2')
|
2020-11-16 22:09:32 +01:00
|
|
|
check_returncode(result)
|
2022-07-23 18:42:19 +02:00
|
|
|
assert 'default' in result.stdout
|
|
|
|
assert 'via' in result.stdout
|
2020-01-07 21:54:21 +01:00
|
|
|
|
|
|
|
|
|
|
|
def test_list_keymaps_no_keyboard_found():
|
2020-05-16 22:47:07 +02:00
|
|
|
result = check_subcommand('list-keymaps', '-kb', 'asdfghjkl')
|
2021-03-24 17:26:38 +01:00
|
|
|
check_returncode(result, [2])
|
|
|
|
assert 'invalid keyboard_folder value' in result.stdout
|
2020-05-26 17:43:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_json2c():
|
2021-01-05 01:52:31 +01:00
|
|
|
result = check_subcommand('json2c', 'keyboards/handwired/pytest/has_template/keymaps/default_json/keymap.json')
|
2020-11-16 22:09:32 +01:00
|
|
|
check_returncode(result)
|
2023-05-22 08:03:59 +02:00
|
|
|
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\n'
|
2020-05-26 22:05:41 +02:00
|
|
|
|
|
|
|
|
2021-11-22 20:11:35 +01:00
|
|
|
def test_json2c_macros():
|
|
|
|
result = check_subcommand("json2c", 'keyboards/handwired/pytest/macro/keymaps/default/keymap.json')
|
|
|
|
check_returncode(result)
|
2022-11-05 13:22:11 +01:00
|
|
|
assert 'LAYOUT_ortho_1x1(QK_MACRO_0)' in result.stdout
|
|
|
|
assert 'case QK_MACRO_0:' in result.stdout
|
2021-11-22 20:11:35 +01:00
|
|
|
assert 'SEND_STRING("Hello, World!"SS_TAP(X_ENTER));' in result.stdout
|
|
|
|
|
|
|
|
|
2020-12-29 20:34:48 +01:00
|
|
|
def test_json2c_stdin():
|
2021-01-05 01:52:31 +01:00
|
|
|
result = check_subcommand_stdin('keyboards/handwired/pytest/has_template/keymaps/default_json/keymap.json', 'json2c', '-')
|
2020-12-29 20:34:48 +01:00
|
|
|
check_returncode(result)
|
2023-05-22 08:03:59 +02:00
|
|
|
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\n'
|
2020-12-29 20:34:48 +01:00
|
|
|
|
|
|
|
|
2022-02-28 21:02:39 +01:00
|
|
|
def test_json2c_wrong_json():
|
|
|
|
result = check_subcommand('json2c', 'keyboards/handwired/pytest/info.json')
|
|
|
|
check_returncode(result, [1])
|
|
|
|
assert 'Invalid JSON keymap' in result.stdout
|
|
|
|
|
|
|
|
|
|
|
|
def test_json2c_no_json():
|
2023-05-06 15:00:27 +02:00
|
|
|
result = check_subcommand('json2c', 'keyboards/handwired/pytest/basic/keymaps/default/keymap.c')
|
2022-02-28 21:02:39 +01:00
|
|
|
check_returncode(result, [1])
|
|
|
|
assert 'Invalid JSON encountered' in result.stdout
|
|
|
|
|
|
|
|
|
2020-05-26 22:05:41 +02:00
|
|
|
def test_info():
|
2021-01-05 01:52:31 +01:00
|
|
|
result = check_subcommand('info', '-kb', 'handwired/pytest/basic')
|
2020-05-26 22:05:41 +02:00
|
|
|
check_returncode(result)
|
2021-11-04 22:08:52 +01:00
|
|
|
assert 'Keyboard Name: pytest' in result.stdout
|
2021-01-05 01:52:31 +01:00
|
|
|
assert 'Processor: atmega32u4' in result.stdout
|
2020-05-26 22:05:41 +02:00
|
|
|
assert 'Layout:' not in result.stdout
|
|
|
|
assert 'k0' not in result.stdout
|
|
|
|
|
|
|
|
|
|
|
|
def test_info_keyboard_render():
|
2021-01-05 01:52:31 +01:00
|
|
|
result = check_subcommand('info', '-kb', 'handwired/pytest/basic', '-l')
|
2020-05-26 22:05:41 +02:00
|
|
|
check_returncode(result)
|
2021-11-04 22:08:52 +01:00
|
|
|
assert 'Keyboard Name: pytest' in result.stdout
|
2021-01-05 01:52:31 +01:00
|
|
|
assert 'Processor: atmega32u4' in result.stdout
|
2020-06-18 20:37:47 +02:00
|
|
|
assert 'Layouts:' in result.stdout
|
2023-04-29 17:51:45 +02:00
|
|
|
|
|
|
|
if is_windows:
|
|
|
|
assert '| |' in result.stdout
|
|
|
|
else:
|
|
|
|
assert '│ │' in result.stdout
|
2020-05-26 22:05:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_info_keymap_render():
|
2021-01-05 01:52:31 +01:00
|
|
|
result = check_subcommand('info', '-kb', 'handwired/pytest/basic', '-km', 'default_json')
|
2020-05-26 22:05:41 +02:00
|
|
|
check_returncode(result)
|
2021-11-04 22:08:52 +01:00
|
|
|
assert 'Keyboard Name: pytest' in result.stdout
|
2021-01-05 01:52:31 +01:00
|
|
|
assert 'Processor: atmega32u4' in result.stdout
|
2020-11-02 09:41:01 +01:00
|
|
|
|
|
|
|
if is_windows:
|
|
|
|
assert '|A |' in result.stdout
|
|
|
|
else:
|
|
|
|
assert '│A │' in result.stdout
|
2020-05-26 22:05:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_info_matrix_render():
|
2021-01-05 01:52:31 +01:00
|
|
|
result = check_subcommand('info', '-kb', 'handwired/pytest/basic', '-m')
|
2020-05-26 22:05:41 +02:00
|
|
|
check_returncode(result)
|
2021-11-04 22:08:52 +01:00
|
|
|
assert 'Keyboard Name: pytest' in result.stdout
|
2021-01-05 01:52:31 +01:00
|
|
|
assert 'Processor: atmega32u4' in result.stdout
|
2020-06-18 20:37:47 +02:00
|
|
|
assert 'LAYOUT_ortho_1x1' in result.stdout
|
2020-11-02 09:41:01 +01:00
|
|
|
|
|
|
|
if is_windows:
|
|
|
|
assert '|0A|' in result.stdout
|
|
|
|
else:
|
|
|
|
assert '│0A│' in result.stdout
|
|
|
|
|
2020-06-18 20:37:47 +02:00
|
|
|
assert 'Matrix for "LAYOUT_ortho_1x1"' in result.stdout
|
2020-10-07 02:10:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_c2json():
|
2021-01-05 01:52:31 +01:00
|
|
|
result = check_subcommand("c2json", "-kb", "handwired/pytest/has_template", "-km", "default", "keyboards/handwired/pytest/has_template/keymaps/default/keymap.c")
|
2020-10-07 02:10:19 +02:00
|
|
|
check_returncode(result)
|
2021-01-05 01:52:31 +01:00
|
|
|
assert result.stdout.strip() == '{"keyboard": "handwired/pytest/has_template", "documentation": "This file is a keymap.json file for handwired/pytest/has_template", "keymap": "default", "layout": "LAYOUT_ortho_1x1", "layers": [["KC_A"]]}'
|
2020-10-07 02:10:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_c2json_nocpp():
|
2021-01-05 01:52:31 +01:00
|
|
|
result = check_subcommand("c2json", "--no-cpp", "-kb", "handwired/pytest/has_template", "-km", "default", "keyboards/handwired/pytest/has_template/keymaps/nocpp/keymap.c")
|
2020-10-07 02:10:19 +02:00
|
|
|
check_returncode(result)
|
2021-01-05 01:52:31 +01:00
|
|
|
assert result.stdout.strip() == '{"keyboard": "handwired/pytest/has_template", "documentation": "This file is a keymap.json file for handwired/pytest/has_template", "keymap": "default", "layout": "LAYOUT", "layers": [["KC_ENTER"]]}'
|
2020-11-04 20:18:47 +01:00
|
|
|
|
|
|
|
|
2020-12-29 20:34:48 +01:00
|
|
|
def test_c2json_stdin():
|
2021-01-05 01:52:31 +01:00
|
|
|
result = check_subcommand_stdin("keyboards/handwired/pytest/has_template/keymaps/default/keymap.c", "c2json", "-kb", "handwired/pytest/has_template", "-km", "default", "-")
|
2020-12-29 20:34:48 +01:00
|
|
|
check_returncode(result)
|
2021-01-05 01:52:31 +01:00
|
|
|
assert result.stdout.strip() == '{"keyboard": "handwired/pytest/has_template", "documentation": "This file is a keymap.json file for handwired/pytest/has_template", "keymap": "default", "layout": "LAYOUT_ortho_1x1", "layers": [["KC_A"]]}'
|
2020-12-29 20:34:48 +01:00
|
|
|
|
|
|
|
|
|
|
|
def test_c2json_nocpp_stdin():
|
2021-01-05 01:52:31 +01:00
|
|
|
result = check_subcommand_stdin("keyboards/handwired/pytest/has_template/keymaps/nocpp/keymap.c", "c2json", "--no-cpp", "-kb", "handwired/pytest/has_template", "-km", "default", "-")
|
2020-12-29 20:34:48 +01:00
|
|
|
check_returncode(result)
|
2021-01-05 01:52:31 +01:00
|
|
|
assert result.stdout.strip() == '{"keyboard": "handwired/pytest/has_template", "documentation": "This file is a keymap.json file for handwired/pytest/has_template", "keymap": "default", "layout": "LAYOUT", "layers": [["KC_ENTER"]]}'
|
2020-12-29 20:34:48 +01:00
|
|
|
|
|
|
|
|
2020-11-04 20:18:47 +01:00
|
|
|
def test_clean():
|
|
|
|
result = check_subcommand('clean', '-a')
|
|
|
|
check_returncode(result)
|
2024-06-24 04:29:30 +02:00
|
|
|
assert (result.stdout.count('done') == 2 and 'userspace' not in result.stdout) or (result.stdout.count('done') == 3 and 'userspace' in result.stdout)
|
2020-12-16 04:24:42 +01:00
|
|
|
|
|
|
|
|
2021-05-10 20:18:44 +02:00
|
|
|
def test_generate_api():
|
2022-02-27 12:28:51 +01:00
|
|
|
result = check_subcommand('generate-api', '--dry-run', '--filter', 'handwired/pytest')
|
2021-05-10 20:18:44 +02:00
|
|
|
check_returncode(result)
|
|
|
|
|
|
|
|
|
2020-12-16 04:24:42 +01:00
|
|
|
def test_generate_rgb_breathe_table():
|
|
|
|
result = check_subcommand("generate-rgb-breathe-table", "-c", "1.2", "-m", "127")
|
|
|
|
check_returncode(result)
|
|
|
|
assert 'Breathing center: 1.2' in result.stdout
|
|
|
|
assert 'Breathing max: 127' in result.stdout
|
2021-01-31 21:46:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
def test_generate_config_h():
|
|
|
|
result = check_subcommand('generate-config-h', '-kb', 'handwired/pytest/basic')
|
|
|
|
check_returncode(result)
|
2022-09-21 19:31:57 +02:00
|
|
|
assert '# define DEVICE_VER 0x0001' in result.stdout
|
|
|
|
assert '# define DIODE_DIRECTION COL2ROW' in result.stdout
|
|
|
|
assert '# define MANUFACTURER "none"' in result.stdout
|
|
|
|
assert '# define PRODUCT "pytest"' in result.stdout
|
|
|
|
assert '# define PRODUCT_ID 0x6465' in result.stdout
|
|
|
|
assert '# define VENDOR_ID 0xFEED' in result.stdout
|
|
|
|
assert '# define MATRIX_COLS 1' in result.stdout
|
|
|
|
assert '# define MATRIX_COL_PINS { F4 }' in result.stdout
|
|
|
|
assert '# define MATRIX_ROWS 1' in result.stdout
|
|
|
|
assert '# define MATRIX_ROW_PINS { F5 }' in result.stdout
|
2021-01-31 21:46:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
def test_generate_rules_mk():
|
|
|
|
result = check_subcommand('generate-rules-mk', '-kb', 'handwired/pytest/basic')
|
|
|
|
check_returncode(result)
|
|
|
|
assert 'BOOTLOADER ?= atmel-dfu' in result.stdout
|
|
|
|
assert 'MCU ?= atmega32u4' in result.stdout
|
|
|
|
|
|
|
|
|
2021-06-26 18:29:02 +02:00
|
|
|
def test_generate_version_h():
|
|
|
|
result = check_subcommand('generate-version-h')
|
|
|
|
check_returncode(result)
|
|
|
|
assert '#define QMK_VERSION' in result.stdout
|
|
|
|
|
|
|
|
|
2021-03-25 12:38:10 +01:00
|
|
|
def test_format_json_keyboard():
|
|
|
|
result = check_subcommand('format-json', '--format', 'keyboard', 'lib/python/qmk/tests/minimal_info.json')
|
|
|
|
check_returncode(result)
|
2023-03-13 13:20:54 +01:00
|
|
|
assert result.stdout == '{\n "keyboard_name": "tester",\n "maintainer": "qmk",\n "layouts": {\n "LAYOUT": {\n "layout": [\n {"label": "KC_A", "matrix": [0, 0], "x": 0, "y": 0}\n ]\n }\n }\n}\n'
|
2021-03-25 12:38:10 +01:00
|
|
|
|
|
|
|
|
|
|
|
def test_format_json_keymap():
|
|
|
|
result = check_subcommand('format-json', '--format', 'keymap', 'lib/python/qmk/tests/minimal_keymap.json')
|
|
|
|
check_returncode(result)
|
|
|
|
assert result.stdout == '{\n "version": 1,\n "keyboard": "handwired/pytest/basic",\n "keymap": "test",\n "layout": "LAYOUT_ortho_1x1",\n "layers": [\n [\n "KC_A"\n ]\n ]\n}\n'
|
|
|
|
|
|
|
|
|
|
|
|
def test_format_json_keyboard_auto():
|
|
|
|
result = check_subcommand('format-json', '--format', 'auto', 'lib/python/qmk/tests/minimal_info.json')
|
|
|
|
check_returncode(result)
|
2023-03-13 13:20:54 +01:00
|
|
|
assert result.stdout == '{\n "keyboard_name": "tester",\n "maintainer": "qmk",\n "layouts": {\n "LAYOUT": {\n "layout": [\n {"label": "KC_A", "matrix": [0, 0], "x": 0, "y": 0}\n ]\n }\n }\n}\n'
|
2021-03-25 12:38:10 +01:00
|
|
|
|
|
|
|
|
|
|
|
def test_format_json_keymap_auto():
|
|
|
|
result = check_subcommand('format-json', '--format', 'auto', 'lib/python/qmk/tests/minimal_keymap.json')
|
|
|
|
check_returncode(result)
|
|
|
|
assert result.stdout == '{\n "keyboard": "handwired/pytest/basic",\n "keymap": "test",\n "layers": [\n ["KC_A"]\n ],\n "layout": "LAYOUT_ortho_1x1",\n "version": 1\n}\n'
|