From 94018367278f44fcf3eab8a86525f2b257ecf4ba Mon Sep 17 00:00:00 2001 From: Ryan Date: Fri, 5 Nov 2021 08:08:52 +1100 Subject: Map `PRODUCT` define to `keyboard_name` (#14372) * Map `PRODUCT` define to `keyboard_name` * Fix tests * Fix last test --- lib/python/qmk/cli/generate/dfu_header.py | 2 +- lib/python/qmk/tests/minimal_info.json | 2 +- lib/python/qmk/tests/test_cli_commands.py | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/python/qmk') diff --git a/lib/python/qmk/cli/generate/dfu_header.py b/lib/python/qmk/cli/generate/dfu_header.py index 5a1b109f1e..7fb585fc7d 100644 --- a/lib/python/qmk/cli/generate/dfu_header.py +++ b/lib/python/qmk/cli/generate/dfu_header.py @@ -32,7 +32,7 @@ def generate_dfu_header(cli): keyboard_h_lines = ['/* This file was generated by `qmk generate-dfu-header`. Do not edit or copy.', ' */', '', '#pragma once'] keyboard_h_lines.append(f'#define MANUFACTURER {kb_info_json["manufacturer"]}') - keyboard_h_lines.append(f'#define PRODUCT {cli.config.generate_dfu_header.keyboard} Bootloader') + keyboard_h_lines.append(f'#define PRODUCT {kb_info_json["keyboard_name"]} Bootloader') # Optional if 'qmk_lufa_bootloader.esc_output' in kb_info_json: diff --git a/lib/python/qmk/tests/minimal_info.json b/lib/python/qmk/tests/minimal_info.json index 11ef12fefe..3aae4722bf 100644 --- a/lib/python/qmk/tests/minimal_info.json +++ b/lib/python/qmk/tests/minimal_info.json @@ -4,7 +4,7 @@ "layouts": { "LAYOUT": { "layout": [ - { "label": "KC_A", "x": 0, "y": 0, "matrix": [0, 0] } + { "label": "KC_A", "matrix": [0, 0], "x": 0, "y": 0 } ] } } diff --git a/lib/python/qmk/tests/test_cli_commands.py b/lib/python/qmk/tests/test_cli_commands.py index e4eaef899a..9f2c258ab4 100644 --- a/lib/python/qmk/tests/test_cli_commands.py +++ b/lib/python/qmk/tests/test_cli_commands.py @@ -151,7 +151,7 @@ def test_json2c_stdin(): def test_info(): result = check_subcommand('info', '-kb', 'handwired/pytest/basic') check_returncode(result) - assert 'Keyboard Name: handwired/pytest/basic' in result.stdout + assert 'Keyboard Name: pytest' in result.stdout assert 'Processor: atmega32u4' in result.stdout assert 'Layout:' not in result.stdout assert 'k0' not in result.stdout @@ -160,7 +160,7 @@ def test_info(): def test_info_keyboard_render(): result = check_subcommand('info', '-kb', 'handwired/pytest/basic', '-l') check_returncode(result) - assert 'Keyboard Name: handwired/pytest/basic' in result.stdout + assert 'Keyboard Name: pytest' in result.stdout assert 'Processor: atmega32u4' in result.stdout assert 'Layouts:' in result.stdout assert 'k0' in result.stdout @@ -169,7 +169,7 @@ def test_info_keyboard_render(): def test_info_keymap_render(): result = check_subcommand('info', '-kb', 'handwired/pytest/basic', '-km', 'default_json') check_returncode(result) - assert 'Keyboard Name: handwired/pytest/basic' in result.stdout + assert 'Keyboard Name: pytest' in result.stdout assert 'Processor: atmega32u4' in result.stdout if is_windows: @@ -181,7 +181,7 @@ def test_info_keymap_render(): def test_info_matrix_render(): result = check_subcommand('info', '-kb', 'handwired/pytest/basic', '-m') check_returncode(result) - assert 'Keyboard Name: handwired/pytest/basic' in result.stdout + assert 'Keyboard Name: pytest' in result.stdout assert 'Processor: atmega32u4' in result.stdout assert 'LAYOUT_ortho_1x1' in result.stdout @@ -242,7 +242,7 @@ def test_generate_config_h(): assert '# define DESCRIPTION handwired/pytest/basic' in result.stdout assert '# define DIODE_DIRECTION COL2ROW' in result.stdout assert '# define MANUFACTURER none' in result.stdout - assert '# define PRODUCT handwired/pytest/basic' 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 -- cgit v1.2.3