diff options
| author | Ryan <fauxpark@gmail.com> | 2024-08-04 01:55:02 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-03 16:55:02 +0100 |
| commit | 9f387f525cb7f9099c4a90ad42d1195c1901c2a3 (patch) | |
| tree | cb12307a24ad221609158a33684ba0a0351def68 /lib/python/qmk/tests | |
| parent | 807ba71c897cae04ed3191267545636858404438 (diff) | |
Remove `handwired/pytest/has_template` (#24232)
Diffstat (limited to 'lib/python/qmk/tests')
| -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(): | |||
| 142 | 142 | ||
| 143 | 143 | ||
| 144 | def test_json2c(): | 144 | def test_json2c(): |
| 145 | result = check_subcommand('json2c', 'keyboards/handwired/pytest/has_template/keymaps/default_json/keymap.json') | 145 | result = check_subcommand('json2c', 'keyboards/handwired/pytest/basic/keymaps/default_json/keymap.json') |
| 146 | check_returncode(result) | 146 | check_returncode(result) |
| 147 | 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' | 147 | assert result.stdout == """#include QMK_KEYBOARD_H |
| 148 | #if __has_include("keymap.h") | ||
| 149 | # include "keymap.h" | ||
| 150 | #endif | ||
| 151 | |||
| 152 | |||
| 153 | /* THIS FILE WAS GENERATED! | ||
| 154 | * | ||
| 155 | * This file was generated by qmk json2c. You may or may not want to | ||
| 156 | * edit it directly. | ||
| 157 | */ | ||
| 158 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 159 | \t[0] = LAYOUT_ortho_1x1(KC_A) | ||
| 160 | }; | ||
| 161 | |||
| 162 | #if defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE) | ||
| 163 | const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { | ||
| 164 | |||
| 165 | }; | ||
| 166 | #endif // defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE) | ||
| 167 | |||
| 168 | |||
| 169 | |||
| 170 | |||
| 171 | |||
| 172 | """ | ||
| 148 | 173 | ||
| 149 | 174 | ||
| 150 | def test_json2c_macros(): | 175 | def test_json2c_macros(): |
| @@ -156,9 +181,34 @@ def test_json2c_macros(): | |||
| 156 | 181 | ||
| 157 | 182 | ||
| 158 | def test_json2c_stdin(): | 183 | def test_json2c_stdin(): |
| 159 | result = check_subcommand_stdin('keyboards/handwired/pytest/has_template/keymaps/default_json/keymap.json', 'json2c', '-') | 184 | result = check_subcommand_stdin('keyboards/handwired/pytest/basic/keymaps/default_json/keymap.json', 'json2c', '-') |
| 160 | check_returncode(result) | 185 | check_returncode(result) |
| 161 | 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' | 186 | assert result.stdout == """#include QMK_KEYBOARD_H |
| 187 | #if __has_include("keymap.h") | ||
| 188 | # include "keymap.h" | ||
| 189 | #endif | ||
| 190 | |||
| 191 | |||
| 192 | /* THIS FILE WAS GENERATED! | ||
| 193 | * | ||
| 194 | * This file was generated by qmk json2c. You may or may not want to | ||
| 195 | * edit it directly. | ||
| 196 | */ | ||
| 197 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 198 | \t[0] = LAYOUT_ortho_1x1(KC_A) | ||
| 199 | }; | ||
| 200 | |||
| 201 | #if defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE) | ||
| 202 | const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { | ||
| 203 | |||
| 204 | }; | ||
| 205 | #endif // defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE) | ||
| 206 | |||
| 207 | |||
| 208 | |||
| 209 | |||
| 210 | |||
| 211 | """ | ||
| 162 | 212 | ||
| 163 | 213 | ||
| 164 | def test_json2c_wrong_json(): | 214 | def test_json2c_wrong_json(): |
| @@ -223,27 +273,15 @@ def test_info_matrix_render(): | |||
| 223 | 273 | ||
| 224 | 274 | ||
| 225 | def test_c2json(): | 275 | def test_c2json(): |
| 226 | result = check_subcommand("c2json", "-kb", "handwired/pytest/has_template", "-km", "default", "keyboards/handwired/pytest/has_template/keymaps/default/keymap.c") | 276 | result = check_subcommand("c2json", "-kb", "handwired/pytest/basic", "-km", "default", "keyboards/handwired/pytest/basic/keymaps/default/keymap.c") |
| 227 | check_returncode(result) | 277 | check_returncode(result) |
| 228 | 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"]]}' | 278 | assert result.stdout.strip() == '{"keyboard": "handwired/pytest/basic", "keymap": "default", "layout": "LAYOUT_ortho_1x1", "layers": [["KC_A"]]}' |
| 229 | |||
| 230 | |||
| 231 | def test_c2json_nocpp(): | ||
| 232 | result = check_subcommand("c2json", "--no-cpp", "-kb", "handwired/pytest/has_template", "-km", "default", "keyboards/handwired/pytest/has_template/keymaps/nocpp/keymap.c") | ||
| 233 | check_returncode(result) | ||
| 234 | 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"]]}' | ||
| 235 | 279 | ||
| 236 | 280 | ||
| 237 | def test_c2json_stdin(): | 281 | def test_c2json_stdin(): |
| 238 | result = check_subcommand_stdin("keyboards/handwired/pytest/has_template/keymaps/default/keymap.c", "c2json", "-kb", "handwired/pytest/has_template", "-km", "default", "-") | 282 | result = check_subcommand_stdin("keyboards/handwired/pytest/basic/keymaps/default/keymap.c", "c2json", "-kb", "handwired/pytest/basic", "-km", "default", "-") |
| 239 | check_returncode(result) | ||
| 240 | 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"]]}' | ||
| 241 | |||
| 242 | |||
| 243 | def test_c2json_nocpp_stdin(): | ||
| 244 | result = check_subcommand_stdin("keyboards/handwired/pytest/has_template/keymaps/nocpp/keymap.c", "c2json", "--no-cpp", "-kb", "handwired/pytest/has_template", "-km", "default", "-") | ||
| 245 | check_returncode(result) | 283 | check_returncode(result) |
| 246 | 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"]]}' | 284 | assert result.stdout.strip() == '{"keyboard": "handwired/pytest/basic", "keymap": "default", "layout": "LAYOUT_ortho_1x1", "layers": [["KC_A"]]}' |
| 247 | 285 | ||
| 248 | 286 | ||
| 249 | def test_clean(): | 287 | 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(): | |||
| 11 | assert templ == {'keyboard': 'handwired/pytest/basic'} | 11 | assert templ == {'keyboard': 'handwired/pytest/basic'} |
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | def test_template_c_pytest_has_template(): | 14 | def test_generate_c_pytest_basic(): |
| 15 | templ = qmk.keymap.template_c('handwired/pytest/has_template') | ||
| 16 | assert templ == '#include QMK_KEYBOARD_H\nconst uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {__KEYMAP_GOES_HERE__};\n' | ||
| 17 | |||
| 18 | |||
| 19 | def test_template_json_pytest_has_template(): | ||
| 20 | templ = qmk.keymap.template_json('handwired/pytest/has_template') | ||
| 21 | assert templ == {'keyboard': 'handwired/pytest/has_template', "documentation": "This file is a keymap.json file for handwired/pytest/has_template"} | ||
| 22 | |||
| 23 | |||
| 24 | def test_generate_c_pytest_has_template(): | ||
| 25 | keymap_json = { | 15 | keymap_json = { |
| 26 | 'keyboard': 'handwired/pytest/has_template', | 16 | 'keyboard': 'handwired/pytest/basic', |
| 27 | 'layout': 'LAYOUT', | 17 | 'layout': 'LAYOUT', |
| 28 | 'layers': [['KC_A']], | 18 | 'layers': [['KC_A']], |
| 29 | 'macros': None, | 19 | 'macros': None, |
| 30 | } | 20 | } |
| 31 | templ = qmk.keymap.generate_c(keymap_json) | 21 | templ = qmk.keymap.generate_c(keymap_json) |
| 32 | assert templ == '#include QMK_KEYBOARD_H\nconst uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {\t[0] = LAYOUT(KC_A)};\n' | 22 | assert templ == """#include QMK_KEYBOARD_H |
| 23 | #if __has_include("keymap.h") | ||
| 24 | # include "keymap.h" | ||
| 25 | #endif | ||
| 26 | |||
| 27 | |||
| 28 | /* THIS FILE WAS GENERATED! | ||
| 29 | * | ||
| 30 | * This file was generated by qmk json2c. You may or may not want to | ||
| 31 | * edit it directly. | ||
| 32 | */ | ||
| 33 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 34 | \t[0] = LAYOUT(KC_A) | ||
| 35 | }; | ||
| 36 | |||
| 37 | #if defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE) | ||
| 38 | const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { | ||
| 39 | |||
| 40 | }; | ||
| 41 | #endif // defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE) | ||
| 42 | |||
| 43 | |||
| 44 | |||
| 45 | """ | ||
| 33 | 46 | ||
| 34 | 47 | ||
| 35 | def test_generate_json_pytest_has_template(): | 48 | def test_generate_json_pytest_basic(): |
| 36 | templ = qmk.keymap.generate_json('default', 'handwired/pytest/has_template', 'LAYOUT', [['KC_A']]) | 49 | templ = qmk.keymap.generate_json('default', 'handwired/pytest/basic', 'LAYOUT', [['KC_A']]) |
| 37 | 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"]]} | 50 | assert templ == {"keyboard": "handwired/pytest/basic", "keymap": "default", "layout": "LAYOUT", "layers": [["KC_A"]]} |
| 38 | 51 | ||
| 39 | 52 | ||
| 40 | def test_parse_keymap_c(): | 53 | def test_parse_keymap_c(): |
