From ef6329af7c7be77b537fbfc5a5cc7105acc679f7 Mon Sep 17 00:00:00 2001 From: Zach White Date: Sun, 31 Jan 2021 12:46:00 -0800 Subject: Create a system to map between info.json and config.h/rules.mk (#11548) * generate rules.mk from a json mapping * generate rules.mk from a json mapping * support for config.h from json maps * improve the mapping system * document the mapping system * move data/maps to data/mappings * fix flake8 errors * fixup LED_MATRIX_DRIVER * remove product and description from the vision_division keymap level * reduce the complexity of generate-rules-mk * add tests for the generate commands * fix qmk doctor when submodules are not clean --- lib/python/qmk/tests/test_cli_commands.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'lib/python/qmk/tests') diff --git a/lib/python/qmk/tests/test_cli_commands.py b/lib/python/qmk/tests/test_cli_commands.py index f889833d0b..3efeddb85e 100644 --- a/lib/python/qmk/tests/test_cli_commands.py +++ b/lib/python/qmk/tests/test_cli_commands.py @@ -230,3 +230,32 @@ def test_generate_rgb_breathe_table(): check_returncode(result) assert 'Breathing center: 1.2' in result.stdout assert 'Breathing max: 127' in result.stdout + + +def test_generate_config_h(): + result = check_subcommand('generate-config-h', '-kb', 'handwired/pytest/basic') + check_returncode(result) + assert '# define DEVICE_VER 0x0001' in result.stdout + 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_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 + + +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 + + +def test_generate_layouts(): + result = check_subcommand('generate-layouts', '-kb', 'handwired/pytest/basic') + check_returncode(result) + assert '#define LAYOUT_custom(k0A) {' in result.stdout -- cgit v1.2.3 From 1581ea48dcd48d0d3f42cc09b388c468aedec45d Mon Sep 17 00:00:00 2001 From: Zach White Date: Sat, 27 Feb 2021 12:00:50 -0800 Subject: Fix develop (#12039) Fixes file encoding errors on Windows, and layouts not correctly merging into info.json. * force utf8 encoding * correctly merge layouts and layout aliases * show what aliases point to --- lib/python/qmk/tests/test_cli_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/python/qmk/tests') diff --git a/lib/python/qmk/tests/test_cli_commands.py b/lib/python/qmk/tests/test_cli_commands.py index 3efeddb85e..82c42a20e8 100644 --- a/lib/python/qmk/tests/test_cli_commands.py +++ b/lib/python/qmk/tests/test_cli_commands.py @@ -16,7 +16,7 @@ def check_subcommand(command, *args): def check_subcommand_stdin(file_to_read, command, *args): """Pipe content of a file to a command and return output. """ - with open(file_to_read) as my_file: + with open(file_to_read, encoding='utf-8') as my_file: cmd = ['bin/qmk', command, *args] result = run(cmd, stdin=my_file, stdout=PIPE, stderr=STDOUT, universal_newlines=True) return result -- cgit v1.2.3