diff options
author | Ryan <[email protected]> | 2024-08-04 01:55:02 +1000 |
---|---|---|
committer | GitHub <[email protected]> | 2024-08-03 16:55:02 +0100 |
commit | 9f387f525cb7f9099c4a90ad42d1195c1901c2a3 (patch) | |
tree | cb12307a24ad221609158a33684ba0a0351def68 /lib/python/qmk | |
parent | 807ba71c897cae04ed3191267545636858404438 (diff) | |
download | qmk_firmware-9f387f525cb7f9099c4a90ad42d1195c1901c2a3.tar.gz qmk_firmware-9f387f525cb7f9099c4a90ad42d1195c1901c2a3.zip |
Remove `handwired/pytest/has_template` (#24232)
Diffstat (limited to 'lib/python/qmk')
-rw-r--r-- | lib/python/qmk/tests/test_cli_commands.py | 78 | ||||
-rw-r--r-- | lib/python/qmk/tests/test_qmk_keymap.py | 45 |
2 files changed, 87 insertions, 36 deletions
diff --git a/lib/python/qmk/tests/test_cli_commands.py b/lib/python/qmk/tests/test_cli_commands.py index 8b50d1c340..674bb54be2 100644 --- a/lib/python/qmk/tests/test_cli_commands.py +++ b/lib/python/qmk/tests/test_cli_commands.py @@ -142,9 +142,34 @@ def test_list_keymaps_no_keyboard_found(): def test_json2c(): - result = check_subcommand('json2c', 'keyboards/handwired/pytest/has_template/keymaps/default_json/keymap.json') + result = check_subcommand('json2c', 'keyboards/handwired/pytest/basic/keymaps/default_json/keymap.json') 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\n' + assert result.stdout == """#include QMK_KEYBOARD_H +#if __has_include("keymap.h") +# include "keymap.h" +#endif + + +/* THIS FILE WAS GENERATED! + * + * This file was generated by qmk json2c. You may or may not want to + * edit it directly. + */ +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +\t[0] = LAYOUT_ortho_1x1(KC_A) +}; + +#if defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + +}; +#endif // defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE) + + + + + +""" def test_json2c_macros(): @@ -156,9 +181,34 @@ def test_json2c_macros(): def test_json2c_stdin(): - result = check_subcommand_stdin('keyboards/handwired/pytest/has_template/keymaps/default_json/keymap.json', 'json2c', '-') + result = check_subcommand_stdin('keyboards/handwired/pytest/basic/keymaps/default_json/keymap.json', 'json2c', '-') 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\n' + assert result.stdout == """#include QMK_KEYBOARD_H +#if __has_include("keymap.h") +# include "keymap.h" +#endif + + +/* THIS FILE WAS GENERATED! + * + * This file was generated by qmk json2c. You may or may not want to + * edit it directly. + */ +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +\t[0] = LAYOUT_ortho_1x1(KC_A) +}; + +#if defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + +}; +#endif // defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE) + + + + + +""" def test_json2c_wrong_json(): @@ -223,27 +273,15 @@ def test_info_matrix_render(): def test_c2json(): - result = check_subcommand("c2json", "-kb", "handwired/pytest/has_template", "-km", "default", "keyboards/handwired/pytest/has_template/keymaps/default/keymap.c") + result = check_subcommand("c2json", "-kb", "handwired/pytest/basic", "-km", "default", "keyboards/handwired/pytest/basic/keymaps/default/keymap.c") check_returncode(result) - 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"]]}' - - -def test_c2json_nocpp(): - result = check_subcommand("c2json", "--no-cpp", "-kb", "handwired/pytest/has_template", "-km", "default", "keyboards/handwired/pytest/has_template/keymaps/nocpp/keymap.c") - check_returncode(result) - 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"]]}' + assert result.stdout.strip() == '{"keyboard": "handwired/pytest/basic", "keymap": "default", "layout": "LAYOUT_ortho_1x1", "layers": [["KC_A"]]}' def test_c2json_stdin(): - result = check_subcommand_stdin("keyboards/handwired/pytest/has_template/keymaps/default/keymap.c", "c2json", "-kb", "handwired/pytest/has_template", "-km", "default", "-") - check_returncode(result) - 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"]]}' - - -def test_c2json_nocpp_stdin(): - result = check_subcommand_stdin("keyboards/handwired/pytest/has_template/keymaps/nocpp/keymap.c", "c2json", "--no-cpp", "-kb", "handwired/pytest/has_template", "-km", "default", "-") + result = check_subcommand_stdin("keyboards/handwired/pytest/basic/keymaps/default/keymap.c", "c2json", "-kb", "handwired/pytest/basic", "-km", "default", "-") check_returncode(result) - 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"]]}' + assert result.stdout.strip() == '{"keyboard": "handwired/pytest/basic", "keymap": "default", "layout": "LAYOUT_ortho_1x1", "layers": [["KC_A"]]}' def test_clean(): diff --git a/lib/python/qmk/tests/test_qmk_keymap.py b/lib/python/qmk/tests/test_qmk_keymap.py index 5e2efc1232..b4b8f4bbe0 100644 --- a/lib/python/qmk/tests/test_qmk_keymap.py +++ b/lib/python/qmk/tests/test_qmk_keymap.py @@ -11,30 +11,43 @@ def test_template_json_pytest_basic(): assert templ == {'keyboard': 'handwired/pytest/basic'} -def test_template_c_pytest_has_template(): - templ = qmk.keymap.template_c('handwired/pytest/has_template') - assert templ == '#include QMK_KEYBOARD_H\nconst uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {__KEYMAP_GOES_HERE__};\n' - - -def test_template_json_pytest_has_template(): - templ = qmk.keymap.template_json('handwired/pytest/has_template') - assert templ == {'keyboard': 'handwired/pytest/has_template', "documentation": "This file is a keymap.json file for handwired/pytest/has_template"} - - -def test_generate_c_pytest_has_template(): +def test_generate_c_pytest_basic(): keymap_json = { - 'keyboard': 'handwired/pytest/has_template', + 'keyboard': 'handwired/pytest/basic', 'layout': 'LAYOUT', 'layers': [['KC_A']], 'macros': None, } templ = qmk.keymap.generate_c(keymap_json) - assert templ == '#include QMK_KEYBOARD_H\nconst uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {\t[0] = LAYOUT(KC_A)};\n' + assert templ == """#include QMK_KEYBOARD_H +#if __has_include("keymap.h") +# include "keymap.h" +#endif + + +/* THIS FILE WAS GENERATED! + * + * This file was generated by qmk json2c. You may or may not want to + * edit it directly. + */ +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +\t[0] = LAYOUT(KC_A) +}; + +#if defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + +}; +#endif // defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE) + + + +""" -def test_generate_json_pytest_has_template(): - templ = qmk.keymap.generate_json('default', 'handwired/pytest/has_template', 'LAYOUT', [['KC_A']]) - assert templ == {"keyboard": "handwired/pytest/has_template", "documentation": "This file is a keymap.json file for handwired/pytest/has_template", "keymap": "default", "layout": "LAYOUT", "layers": [["KC_A"]]} +def test_generate_json_pytest_basic(): + templ = qmk.keymap.generate_json('default', 'handwired/pytest/basic', 'LAYOUT', [['KC_A']]) + assert templ == {"keyboard": "handwired/pytest/basic", "keymap": "default", "layout": "LAYOUT", "layers": [["KC_A"]]} def test_parse_keymap_c(): |