diff options
| author | Joel Challis <git@zvecr.com> | 2021-01-05 00:52:31 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-05 00:52:31 +0000 |
| commit | f03b10b6c1c9a5b0e07f7f78c6060610246b4a7f (patch) | |
| tree | 7d9df975a5046b8d22b5f20694715287361f96a4 | |
| parent | 810eafad121bda333c53490e2d8a29f3a83d9c19 (diff) | |
| download | qmk_firmware-f03b10b6c1c9a5b0e07f7f78c6060610246b4a7f.tar.gz qmk_firmware-f03b10b6c1c9a5b0e07f7f78c6060610246b4a7f.zip | |
Migrate python tests away from onekey (#11367)
* Migrate python tests away from onekey
* Add stub files to stop lint complaints
* Make all the pytest keymaps compile
27 files changed, 113 insertions, 82 deletions
diff --git a/keyboards/handwired/onekey/pytest/config.h b/keyboards/handwired/onekey/pytest/config.h deleted file mode 100644 index f6bedcfe6..000000000 --- a/keyboards/handwired/onekey/pytest/config.h +++ /dev/null | |||
| @@ -1,23 +0,0 @@ | |||
| 1 | /* Copyright 2019 | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | #include "config_common.h" | ||
| 20 | |||
| 21 | #define MATRIX_COL_PINS { A3 } | ||
| 22 | #define MATRIX_ROW_PINS { A2 } | ||
| 23 | #define UNUSED_PINS | ||
diff --git a/keyboards/handwired/onekey/pytest/readme.md b/keyboards/handwired/onekey/pytest/readme.md deleted file mode 100644 index dbbd991f1..000000000 --- a/keyboards/handwired/onekey/pytest/readme.md +++ /dev/null | |||
| @@ -1,3 +0,0 @@ | |||
| 1 | # PyTest onekey | ||
| 2 | |||
| 3 | This is used by the python test framework. It's probably not useful otherwise. | ||
diff --git a/keyboards/handwired/onekey/pytest/rules.mk b/keyboards/handwired/onekey/pytest/rules.mk deleted file mode 100644 index b17a3d031..000000000 --- a/keyboards/handwired/onekey/pytest/rules.mk +++ /dev/null | |||
| @@ -1,2 +0,0 @@ | |||
| 1 | # MCU name | ||
| 2 | MCU = STM32F303 | ||
diff --git a/keyboards/handwired/onekey/pytest/.noci b/keyboards/handwired/pytest/.noci index e69de29bb..e69de29bb 100644 --- a/keyboards/handwired/onekey/pytest/.noci +++ b/keyboards/handwired/pytest/.noci | |||
diff --git a/keyboards/handwired/pytest/basic/.noci b/keyboards/handwired/pytest/basic/.noci new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/keyboards/handwired/pytest/basic/.noci | |||
diff --git a/keyboards/handwired/pytest/basic/keymaps/default/keymap.c b/keyboards/handwired/pytest/basic/keymaps/default/keymap.c new file mode 100644 index 000000000..a5782f7a1 --- /dev/null +++ b/keyboards/handwired/pytest/basic/keymaps/default/keymap.c | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | #include QMK_KEYBOARD_H | ||
| 2 | |||
| 3 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 4 | LAYOUT_ortho_1x1(KC_A) | ||
| 5 | }; | ||
diff --git a/keyboards/handwired/onekey/keymaps/default_json/keymap.json b/keyboards/handwired/pytest/basic/keymaps/default_json/keymap.json index ce4c4b474..e162e4139 100644 --- a/keyboards/handwired/onekey/keymaps/default_json/keymap.json +++ b/keyboards/handwired/pytest/basic/keymaps/default_json/keymap.json | |||
| @@ -1,9 +1,9 @@ | |||
| 1 | { | 1 | { |
| 2 | "keyboard": "handwired/onekey/pytest", | 2 | "keyboard": "handwired/pytest/basic", |
| 3 | "keymap": "default_json", | 3 | "keymap": "default_json", |
| 4 | "layout": "LAYOUT_ortho_1x1", | 4 | "layout": "LAYOUT_ortho_1x1", |
| 5 | "layers": [["KC_A"]], | 5 | "layers": [["KC_A"]], |
| 6 | "author": "qmk", | 6 | "author": "qmk", |
| 7 | "notes": "This file is a keymap.json file for handwired/onekey/pytest", | 7 | "notes": "This file is a keymap.json file for handwired/pytest/basic", |
| 8 | "version": 1 | 8 | "version": 1 |
| 9 | } | 9 | } |
diff --git a/keyboards/handwired/pytest/basic/readme.md b/keyboards/handwired/pytest/basic/readme.md new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/keyboards/handwired/pytest/basic/readme.md | |||
diff --git a/keyboards/handwired/pytest/basic/rules.mk b/keyboards/handwired/pytest/basic/rules.mk new file mode 100644 index 000000000..6b42774db --- /dev/null +++ b/keyboards/handwired/pytest/basic/rules.mk | |||
| @@ -0,0 +1 @@ | |||
| MCU = atmega32u4 | |||
diff --git a/keyboards/handwired/pytest/config.h b/keyboards/handwired/pytest/config.h new file mode 100644 index 000000000..64cf35312 --- /dev/null +++ b/keyboards/handwired/pytest/config.h | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "config_common.h" | ||
| 4 | |||
| 5 | /* USB Device descriptor parameter */ | ||
| 6 | #define VENDOR_ID 0xFEED | ||
| 7 | #define PRODUCT_ID 0x6465 | ||
| 8 | #define DEVICE_VER 0x0001 | ||
| 9 | #define MANUFACTURER none | ||
| 10 | #define PRODUCT pytest | ||
| 11 | |||
| 12 | /* key matrix size */ | ||
| 13 | #define MATRIX_ROWS 1 | ||
| 14 | #define MATRIX_COLS 1 | ||
| 15 | |||
| 16 | #define MATRIX_COL_PINS { F4 } | ||
| 17 | #define MATRIX_ROW_PINS { F5 } | ||
| 18 | #define DIODE_DIRECTION COL2ROW | ||
diff --git a/keyboards/handwired/pytest/has_community/.noci b/keyboards/handwired/pytest/has_community/.noci new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/keyboards/handwired/pytest/has_community/.noci | |||
diff --git a/keyboards/handwired/pytest/has_community/readme.md b/keyboards/handwired/pytest/has_community/readme.md new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/keyboards/handwired/pytest/has_community/readme.md | |||
diff --git a/keyboards/handwired/pytest/has_community/rules.mk b/keyboards/handwired/pytest/has_community/rules.mk new file mode 100644 index 000000000..4161649cb --- /dev/null +++ b/keyboards/handwired/pytest/has_community/rules.mk | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | MCU = atmega32u4 | ||
| 2 | |||
| 3 | LAYOUTS = ortho_1x1 | ||
diff --git a/keyboards/handwired/pytest/has_template/.noci b/keyboards/handwired/pytest/has_template/.noci new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/keyboards/handwired/pytest/has_template/.noci | |||
diff --git a/keyboards/handwired/pytest/has_template/keymaps/.noci b/keyboards/handwired/pytest/has_template/keymaps/.noci new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/keyboards/handwired/pytest/has_template/keymaps/.noci | |||
diff --git a/keyboards/handwired/pytest/has_template/keymaps/default/keymap.c b/keyboards/handwired/pytest/has_template/keymaps/default/keymap.c new file mode 100644 index 000000000..a5782f7a1 --- /dev/null +++ b/keyboards/handwired/pytest/has_template/keymaps/default/keymap.c | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | #include QMK_KEYBOARD_H | ||
| 2 | |||
| 3 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 4 | LAYOUT_ortho_1x1(KC_A) | ||
| 5 | }; | ||
diff --git a/keyboards/handwired/pytest/has_template/keymaps/default_json/keymap.json b/keyboards/handwired/pytest/has_template/keymaps/default_json/keymap.json new file mode 100644 index 000000000..cbdce6db3 --- /dev/null +++ b/keyboards/handwired/pytest/has_template/keymaps/default_json/keymap.json | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | { | ||
| 2 | "keyboard": "handwired/pytest/has_template", | ||
| 3 | "keymap": "default_json", | ||
| 4 | "layout": "LAYOUT_ortho_1x1", | ||
| 5 | "layers": [["KC_A"]], | ||
| 6 | "author": "qmk", | ||
| 7 | "notes": "This file is a keymap.json file for handwired/pytest/has_template", | ||
| 8 | "version": 1 | ||
| 9 | } | ||
diff --git a/keyboards/handwired/onekey/keymaps/pytest_nocpp/keymap.c b/keyboards/handwired/pytest/has_template/keymaps/nocpp/keymap.c index 4e06bb11e..4e06bb11e 100644 --- a/keyboards/handwired/onekey/keymaps/pytest_nocpp/keymap.c +++ b/keyboards/handwired/pytest/has_template/keymaps/nocpp/keymap.c | |||
diff --git a/keyboards/handwired/pytest/has_template/readme.md b/keyboards/handwired/pytest/has_template/readme.md new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/keyboards/handwired/pytest/has_template/readme.md | |||
diff --git a/keyboards/handwired/pytest/has_template/rules.mk b/keyboards/handwired/pytest/has_template/rules.mk new file mode 100644 index 000000000..6b42774db --- /dev/null +++ b/keyboards/handwired/pytest/has_template/rules.mk | |||
| @@ -0,0 +1 @@ | |||
| MCU = atmega32u4 | |||
diff --git a/keyboards/handwired/onekey/pytest/templates/keymap.c b/keyboards/handwired/pytest/has_template/templates/keymap.c index 6cb25d522..6cb25d522 100644 --- a/keyboards/handwired/onekey/pytest/templates/keymap.c +++ b/keyboards/handwired/pytest/has_template/templates/keymap.c | |||
diff --git a/keyboards/handwired/onekey/pytest/templates/keymap.json b/keyboards/handwired/pytest/has_template/templates/keymap.json index 35344388f..04928564e 100644 --- a/keyboards/handwired/onekey/pytest/templates/keymap.json +++ b/keyboards/handwired/pytest/has_template/templates/keymap.json | |||
| @@ -1,3 +1,3 @@ | |||
| 1 | { | 1 | { |
| 2 | "documentation": "This file is a keymap.json file for handwired/onekey/pytest" | 2 | "documentation": "This file is a keymap.json file for handwired/pytest/has_template" |
| 3 | } | 3 | } |
diff --git a/keyboards/handwired/pytest/pytest.h b/keyboards/handwired/pytest/pytest.h new file mode 100644 index 000000000..b8fe7dde5 --- /dev/null +++ b/keyboards/handwired/pytest/pytest.h | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "quantum.h" | ||
| 4 | |||
| 5 | #define LAYOUT_ortho_1x1( \ | ||
| 6 | k00 \ | ||
| 7 | ) { \ | ||
| 8 | { k00 } \ | ||
| 9 | } | ||
| 10 | |||
| 11 | #define LAYOUT LAYOUT_ortho_1x1 | ||
diff --git a/lib/python/qmk/tests/onekey_export.json b/lib/python/qmk/tests/pytest_export.json index 95f0a980f..5fb0d624f 100644 --- a/lib/python/qmk/tests/onekey_export.json +++ b/lib/python/qmk/tests/pytest_export.json | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | { | 1 | { |
| 2 | "keyboard":"handwired/onekey/pytest", | 2 | "keyboard":"handwired/pytest/basic", |
| 3 | "keymap":"pytest_unittest", | 3 | "keymap":"pytest_unittest", |
| 4 | "layout":"LAYOUT", | 4 | "layout":"LAYOUT", |
| 5 | "layers":[["KC_A"]] | 5 | "layers":[["KC_A"]] |
diff --git a/lib/python/qmk/tests/test_cli_commands.py b/lib/python/qmk/tests/test_cli_commands.py index efd9f6cf6..f889833d0 100644 --- a/lib/python/qmk/tests/test_cli_commands.py +++ b/lib/python/qmk/tests/test_cli_commands.py | |||
| @@ -38,17 +38,17 @@ def test_cformat(): | |||
| 38 | 38 | ||
| 39 | 39 | ||
| 40 | def test_compile(): | 40 | def test_compile(): |
| 41 | result = check_subcommand('compile', '-kb', 'handwired/onekey/pytest', '-km', 'default', '-n') | 41 | result = check_subcommand('compile', '-kb', 'handwired/pytest/basic', '-km', 'default', '-n') |
| 42 | check_returncode(result) | 42 | check_returncode(result) |
| 43 | 43 | ||
| 44 | 44 | ||
| 45 | def test_compile_json(): | 45 | def test_compile_json(): |
| 46 | result = check_subcommand('compile', '-kb', 'handwired/onekey/pytest', '-km', 'default_json', '-n') | 46 | result = check_subcommand('compile', '-kb', 'handwired/pytest/basic', '-km', 'default_json', '-n') |
| 47 | check_returncode(result) | 47 | check_returncode(result) |
| 48 | 48 | ||
| 49 | 49 | ||
| 50 | def test_flash(): | 50 | def test_flash(): |
| 51 | result = check_subcommand('flash', '-kb', 'handwired/onekey/pytest', '-km', 'default', '-n') | 51 | result = check_subcommand('flash', '-kb', 'handwired/pytest/basic', '-km', 'default', '-n') |
| 52 | check_returncode(result) | 52 | check_returncode(result) |
| 53 | 53 | ||
| 54 | 54 | ||
| @@ -92,20 +92,26 @@ def test_list_keyboards(): | |||
| 92 | result = check_subcommand('list-keyboards') | 92 | result = check_subcommand('list-keyboards') |
| 93 | check_returncode(result) | 93 | check_returncode(result) |
| 94 | # check to see if a known keyboard is returned | 94 | # check to see if a known keyboard is returned |
| 95 | # this will fail if handwired/onekey/pytest is removed | 95 | # this will fail if handwired/pytest/basic is removed |
| 96 | assert 'handwired/onekey/pytest' in result.stdout | 96 | assert 'handwired/pytest/basic' in result.stdout |
| 97 | 97 | ||
| 98 | 98 | ||
| 99 | def test_list_keymaps(): | 99 | def test_list_keymaps(): |
| 100 | result = check_subcommand('list-keymaps', '-kb', 'handwired/onekey/pytest') | 100 | result = check_subcommand('list-keymaps', '-kb', 'handwired/pytest/basic') |
| 101 | check_returncode(result) | 101 | check_returncode(result) |
| 102 | assert 'default' and 'test' in result.stdout | 102 | assert 'default' and 'default_json' in result.stdout |
| 103 | 103 | ||
| 104 | 104 | ||
| 105 | def test_list_keymaps_long(): | 105 | def test_list_keymaps_long(): |
| 106 | result = check_subcommand('list-keymaps', '--keyboard', 'handwired/onekey/pytest') | 106 | result = check_subcommand('list-keymaps', '--keyboard', 'handwired/pytest/basic') |
| 107 | check_returncode(result) | 107 | check_returncode(result) |
| 108 | assert 'default' and 'test' in result.stdout | 108 | assert 'default' and 'default_json' in result.stdout |
| 109 | |||
| 110 | |||
| 111 | def test_list_keymaps_community(): | ||
| 112 | result = check_subcommand('list-keymaps', '--keyboard', 'handwired/pytest/has_community') | ||
| 113 | check_returncode(result) | ||
| 114 | assert 'test' in result.stdout | ||
| 109 | 115 | ||
| 110 | 116 | ||
| 111 | def test_list_keymaps_kb_only(): | 117 | def test_list_keymaps_kb_only(): |
| @@ -133,40 +139,40 @@ def test_list_keymaps_no_keyboard_found(): | |||
| 133 | 139 | ||
| 134 | 140 | ||
| 135 | def test_json2c(): | 141 | def test_json2c(): |
| 136 | result = check_subcommand('json2c', 'keyboards/handwired/onekey/keymaps/default_json/keymap.json') | 142 | result = check_subcommand('json2c', 'keyboards/handwired/pytest/has_template/keymaps/default_json/keymap.json') |
| 137 | check_returncode(result) | 143 | check_returncode(result) |
| 138 | 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' | 144 | 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' |
| 139 | 145 | ||
| 140 | 146 | ||
| 141 | def test_json2c_stdin(): | 147 | def test_json2c_stdin(): |
| 142 | result = check_subcommand_stdin('keyboards/handwired/onekey/keymaps/default_json/keymap.json', 'json2c', '-') | 148 | result = check_subcommand_stdin('keyboards/handwired/pytest/has_template/keymaps/default_json/keymap.json', 'json2c', '-') |
| 143 | check_returncode(result) | 149 | check_returncode(result) |
| 144 | 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' | 150 | 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' |
| 145 | 151 | ||
| 146 | 152 | ||
| 147 | def test_info(): | 153 | def test_info(): |
| 148 | result = check_subcommand('info', '-kb', 'handwired/onekey/pytest') | 154 | result = check_subcommand('info', '-kb', 'handwired/pytest/basic') |
| 149 | check_returncode(result) | 155 | check_returncode(result) |
| 150 | assert 'Keyboard Name: handwired/onekey/pytest' in result.stdout | 156 | assert 'Keyboard Name: handwired/pytest/basic' in result.stdout |
| 151 | assert 'Processor: STM32F303' in result.stdout | 157 | assert 'Processor: atmega32u4' in result.stdout |
| 152 | assert 'Layout:' not in result.stdout | 158 | assert 'Layout:' not in result.stdout |
| 153 | assert 'k0' not in result.stdout | 159 | assert 'k0' not in result.stdout |
| 154 | 160 | ||
| 155 | 161 | ||
| 156 | def test_info_keyboard_render(): | 162 | def test_info_keyboard_render(): |
| 157 | result = check_subcommand('info', '-kb', 'handwired/onekey/pytest', '-l') | 163 | result = check_subcommand('info', '-kb', 'handwired/pytest/basic', '-l') |
| 158 | check_returncode(result) | 164 | check_returncode(result) |
| 159 | assert 'Keyboard Name: handwired/onekey/pytest' in result.stdout | 165 | assert 'Keyboard Name: handwired/pytest/basic' in result.stdout |
| 160 | assert 'Processor: STM32F303' in result.stdout | 166 | assert 'Processor: atmega32u4' in result.stdout |
| 161 | assert 'Layouts:' in result.stdout | 167 | assert 'Layouts:' in result.stdout |
| 162 | assert 'k0' in result.stdout | 168 | assert 'k0' in result.stdout |
| 163 | 169 | ||
| 164 | 170 | ||
| 165 | def test_info_keymap_render(): | 171 | def test_info_keymap_render(): |
| 166 | result = check_subcommand('info', '-kb', 'handwired/onekey/pytest', '-km', 'default_json') | 172 | result = check_subcommand('info', '-kb', 'handwired/pytest/basic', '-km', 'default_json') |
| 167 | check_returncode(result) | 173 | check_returncode(result) |
| 168 | assert 'Keyboard Name: handwired/onekey/pytest' in result.stdout | 174 | assert 'Keyboard Name: handwired/pytest/basic' in result.stdout |
| 169 | assert 'Processor: STM32F303' in result.stdout | 175 | assert 'Processor: atmega32u4' in result.stdout |
| 170 | 176 | ||
| 171 | if is_windows: | 177 | if is_windows: |
| 172 | assert '|A |' in result.stdout | 178 | assert '|A |' in result.stdout |
| @@ -175,10 +181,10 @@ def test_info_keymap_render(): | |||
| 175 | 181 | ||
| 176 | 182 | ||
| 177 | def test_info_matrix_render(): | 183 | def test_info_matrix_render(): |
| 178 | result = check_subcommand('info', '-kb', 'handwired/onekey/pytest', '-m') | 184 | result = check_subcommand('info', '-kb', 'handwired/pytest/basic', '-m') |
| 179 | check_returncode(result) | 185 | check_returncode(result) |
| 180 | assert 'Keyboard Name: handwired/onekey/pytest' in result.stdout | 186 | assert 'Keyboard Name: handwired/pytest/basic' in result.stdout |
| 181 | assert 'Processor: STM32F303' in result.stdout | 187 | assert 'Processor: atmega32u4' in result.stdout |
| 182 | assert 'LAYOUT_ortho_1x1' in result.stdout | 188 | assert 'LAYOUT_ortho_1x1' in result.stdout |
| 183 | 189 | ||
| 184 | if is_windows: | 190 | if is_windows: |
| @@ -190,27 +196,27 @@ def test_info_matrix_render(): | |||
| 190 | 196 | ||
| 191 | 197 | ||
| 192 | def test_c2json(): | 198 | def test_c2json(): |
| 193 | result = check_subcommand("c2json", "-kb", "handwired/onekey/pytest", "-km", "default", "keyboards/handwired/onekey/keymaps/default/keymap.c") | 199 | result = check_subcommand("c2json", "-kb", "handwired/pytest/has_template", "-km", "default", "keyboards/handwired/pytest/has_template/keymaps/default/keymap.c") |
| 194 | check_returncode(result) | 200 | check_returncode(result) |
| 195 | assert result.stdout.strip() == '{"keyboard": "handwired/onekey/pytest", "documentation": "This file is a keymap.json file for handwired/onekey/pytest", "keymap": "default", "layout": "LAYOUT_ortho_1x1", "layers": [["KC_A"]]}' | 201 | 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"]]}' |
| 196 | 202 | ||
| 197 | 203 | ||
| 198 | def test_c2json_nocpp(): | 204 | def test_c2json_nocpp(): |
| 199 | result = check_subcommand("c2json", "--no-cpp", "-kb", "handwired/onekey/pytest", "-km", "default", "keyboards/handwired/onekey/keymaps/pytest_nocpp/keymap.c") | 205 | result = check_subcommand("c2json", "--no-cpp", "-kb", "handwired/pytest/has_template", "-km", "default", "keyboards/handwired/pytest/has_template/keymaps/nocpp/keymap.c") |
| 200 | check_returncode(result) | 206 | check_returncode(result) |
| 201 | assert result.stdout.strip() == '{"keyboard": "handwired/onekey/pytest", "documentation": "This file is a keymap.json file for handwired/onekey/pytest", "keymap": "default", "layout": "LAYOUT", "layers": [["KC_ENTER"]]}' | 207 | 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"]]}' |
| 202 | 208 | ||
| 203 | 209 | ||
| 204 | def test_c2json_stdin(): | 210 | def test_c2json_stdin(): |
| 205 | result = check_subcommand_stdin("keyboards/handwired/onekey/keymaps/default/keymap.c", "c2json", "-kb", "handwired/onekey/pytest", "-km", "default", "-") | 211 | result = check_subcommand_stdin("keyboards/handwired/pytest/has_template/keymaps/default/keymap.c", "c2json", "-kb", "handwired/pytest/has_template", "-km", "default", "-") |
| 206 | check_returncode(result) | 212 | check_returncode(result) |
| 207 | assert result.stdout.strip() == '{"keyboard": "handwired/onekey/pytest", "documentation": "This file is a keymap.json file for handwired/onekey/pytest", "keymap": "default", "layout": "LAYOUT_ortho_1x1", "layers": [["KC_A"]]}' | 213 | 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"]]}' |
| 208 | 214 | ||
| 209 | 215 | ||
| 210 | def test_c2json_nocpp_stdin(): | 216 | def test_c2json_nocpp_stdin(): |
| 211 | result = check_subcommand_stdin("keyboards/handwired/onekey/keymaps/pytest_nocpp/keymap.c", "c2json", "--no-cpp", "-kb", "handwired/onekey/pytest", "-km", "default", "-") | 217 | result = check_subcommand_stdin("keyboards/handwired/pytest/has_template/keymaps/nocpp/keymap.c", "c2json", "--no-cpp", "-kb", "handwired/pytest/has_template", "-km", "default", "-") |
| 212 | check_returncode(result) | 218 | check_returncode(result) |
| 213 | assert result.stdout.strip() == '{"keyboard": "handwired/onekey/pytest", "documentation": "This file is a keymap.json file for handwired/onekey/pytest", "keymap": "default", "layout": "LAYOUT", "layers": [["KC_ENTER"]]}' | 219 | 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"]]}' |
| 214 | 220 | ||
| 215 | 221 | ||
| 216 | def test_clean(): | 222 | def test_clean(): |
diff --git a/lib/python/qmk/tests/test_qmk_keymap.py b/lib/python/qmk/tests/test_qmk_keymap.py index f1ecf2937..b9e80df67 100644 --- a/lib/python/qmk/tests/test_qmk_keymap.py +++ b/lib/python/qmk/tests/test_qmk_keymap.py | |||
| @@ -1,38 +1,38 @@ | |||
| 1 | import qmk.keymap | 1 | import qmk.keymap |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | def test_template_c_onekey_proton_c(): | 4 | def test_template_c_pytest_basic(): |
| 5 | templ = qmk.keymap.template_c('handwired/onekey/proton_c') | 5 | templ = qmk.keymap.template_c('handwired/pytest/basic') |
| 6 | assert templ == qmk.keymap.DEFAULT_KEYMAP_C | 6 | assert templ == qmk.keymap.DEFAULT_KEYMAP_C |
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | def test_template_json_onekey_proton_c(): | 9 | def test_template_json_pytest_basic(): |
| 10 | templ = qmk.keymap.template_json('handwired/onekey/proton_c') | 10 | templ = qmk.keymap.template_json('handwired/pytest/basic') |
| 11 | assert templ == {'keyboard': 'handwired/onekey/proton_c'} | 11 | assert templ == {'keyboard': 'handwired/pytest/basic'} |
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | def test_template_c_onekey_pytest(): | 14 | def test_template_c_pytest_has_template(): |
| 15 | templ = qmk.keymap.template_c('handwired/onekey/pytest') | 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' | 16 | assert templ == '#include QMK_KEYBOARD_H\nconst uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {__KEYMAP_GOES_HERE__};\n' |
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | def test_template_json_onekey_pytest(): | 19 | def test_template_json_pytest_has_template(): |
| 20 | templ = qmk.keymap.template_json('handwired/onekey/pytest') | 20 | templ = qmk.keymap.template_json('handwired/pytest/has_template') |
| 21 | assert templ == {'keyboard': 'handwired/onekey/pytest', "documentation": "This file is a keymap.json file for handwired/onekey/pytest"} | 21 | assert templ == {'keyboard': 'handwired/pytest/has_template', "documentation": "This file is a keymap.json file for handwired/pytest/has_template"} |
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | def test_generate_c_onekey_pytest(): | 24 | def test_generate_c_pytest_has_template(): |
| 25 | templ = qmk.keymap.generate_c('handwired/onekey/pytest', 'LAYOUT', [['KC_A']]) | 25 | templ = qmk.keymap.generate_c('handwired/pytest/has_template', 'LAYOUT', [['KC_A']]) |
| 26 | assert templ == '#include QMK_KEYBOARD_H\nconst uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {\t[0] = LAYOUT(KC_A)};\n' | 26 | assert templ == '#include QMK_KEYBOARD_H\nconst uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {\t[0] = LAYOUT(KC_A)};\n' |
| 27 | 27 | ||
| 28 | 28 | ||
| 29 | def test_generate_json_onekey_pytest(): | 29 | def test_generate_json_pytest_has_template(): |
| 30 | templ = qmk.keymap.generate_json('default', 'handwired/onekey/pytest', 'LAYOUT', [['KC_A']]) | 30 | templ = qmk.keymap.generate_json('default', 'handwired/pytest/has_template', 'LAYOUT', [['KC_A']]) |
| 31 | assert templ == {"keyboard": "handwired/onekey/pytest", "documentation": "This file is a keymap.json file for handwired/onekey/pytest", "keymap": "default", "layout": "LAYOUT", "layers": [["KC_A"]]} | 31 | 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"]]} |
| 32 | 32 | ||
| 33 | 33 | ||
| 34 | def test_parse_keymap_c(): | 34 | def test_parse_keymap_c(): |
| 35 | parsed_keymap_c = qmk.keymap.parse_keymap_c('keyboards/handwired/onekey/keymaps/default/keymap.c') | 35 | parsed_keymap_c = qmk.keymap.parse_keymap_c('keyboards/handwired/pytest/basic/keymaps/default/keymap.c') |
| 36 | assert parsed_keymap_c == {'layers': [{'name': '0', 'layout': 'LAYOUT_ortho_1x1', 'keycodes': ['KC_A']}]} | 36 | assert parsed_keymap_c == {'layers': [{'name': '0', 'layout': 'LAYOUT_ortho_1x1', 'keycodes': ['KC_A']}]} |
| 37 | 37 | ||
| 38 | 38 | ||
diff --git a/lib/python/qmk/tests/test_qmk_path.py b/lib/python/qmk/tests/test_qmk_path.py index 74db7b3e2..4b5132f13 100644 --- a/lib/python/qmk/tests/test_qmk_path.py +++ b/lib/python/qmk/tests/test_qmk_path.py | |||
| @@ -4,9 +4,9 @@ from pathlib import Path | |||
| 4 | import qmk.path | 4 | import qmk.path |
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | def test_keymap_onekey_pytest(): | 7 | def test_keymap_pytest_basic(): |
| 8 | path = qmk.path.keymap('handwired/onekey/pytest') | 8 | path = qmk.path.keymap('handwired/pytest/basic') |
| 9 | assert path.samefile('keyboards/handwired/onekey/keymaps') | 9 | assert path.samefile('keyboards/handwired/pytest/basic/keymaps') |
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | def test_normpath(): | 12 | def test_normpath(): |
