diff options
author | skullY <skullydazed@gmail.com> | 2019-11-12 17:27:08 -0800 |
---|---|---|
committer | skullydazed <skullydazed@users.noreply.github.com> | 2019-11-12 18:41:38 -0800 |
commit | 79edb7c5942108774e667c172550a1519c5543ac (patch) | |
tree | 37fc007c4548f2cb86f51c6608b7da14e30acec0 /lib/python/qmk | |
parent | d1b6c11b7f4cc24c50d2b640a94925acf6450da6 (diff) |
Small CLI cleanups
* yapf changes
* Fix the cformat test
* Make the normpath test work when run from /
* `qmk config`: Mark `--read-only` as arg_only
Diffstat (limited to 'lib/python/qmk')
-rw-r--r-- | lib/python/qmk/cli/config.py | 2 | ||||
-rw-r--r-- | lib/python/qmk/cli/list/keyboards.py | 1 | ||||
-rw-r--r-- | lib/python/qmk/errors.py | 1 | ||||
-rw-r--r-- | lib/python/qmk/tests/attrdict.py | 1 | ||||
-rw-r--r-- | lib/python/qmk/tests/test_cli_commands.py | 2 | ||||
-rw-r--r-- | lib/python/qmk/tests/test_qmk_path.py | 2 |
6 files changed, 4 insertions, 5 deletions
diff --git a/lib/python/qmk/cli/config.py b/lib/python/qmk/cli/config.py index d6c774e651..c4ee20cba5 100644 --- a/lib/python/qmk/cli/config.py +++ b/lib/python/qmk/cli/config.py @@ -12,7 +12,7 @@ def print_config(section, key): cli.echo('%s.%s{fg_cyan}={fg_reset}%s', section, key, cli.config[section][key]) -@cli.argument('-ro', '--read-only', action='store_true', help='Operate in read-only mode.') +@cli.argument('-ro', '--read-only', arg_only=True, action='store_true', help='Operate in read-only mode.') @cli.argument('configs', nargs='*', arg_only=True, help='Configuration options to read or write.') @cli.subcommand("Read and write configuration settings.") def config(cli): diff --git a/lib/python/qmk/cli/list/keyboards.py b/lib/python/qmk/cli/list/keyboards.py index 53a7af75c6..2a29ccb146 100644 --- a/lib/python/qmk/cli/list/keyboards.py +++ b/lib/python/qmk/cli/list/keyboards.py @@ -6,6 +6,7 @@ import glob from milc import cli + @cli.subcommand("List the keyboards currently defined within QMK") def list_keyboards(cli): """List the keyboards currently defined within QMK diff --git a/lib/python/qmk/errors.py b/lib/python/qmk/errors.py index f9bf5b9af9..4a8a91556b 100644 --- a/lib/python/qmk/errors.py +++ b/lib/python/qmk/errors.py @@ -1,6 +1,5 @@ class NoSuchKeyboardError(Exception): """Raised when we can't find a keyboard/keymap directory. """ - def __init__(self, message): self.message = message diff --git a/lib/python/qmk/tests/attrdict.py b/lib/python/qmk/tests/attrdict.py index 391c75c4e1..a2584b9233 100644 --- a/lib/python/qmk/tests/attrdict.py +++ b/lib/python/qmk/tests/attrdict.py @@ -3,7 +3,6 @@ class AttrDict(dict): This should only be used to mock objects for unit testing. Please do not use this outside of qmk.tests. """ - def __init__(self, *args, **kwargs): super(AttrDict, self).__init__(*args, **kwargs) self.__dict__ = self diff --git a/lib/python/qmk/tests/test_cli_commands.py b/lib/python/qmk/tests/test_cli_commands.py index 9a9dc4b958..55b8d253f7 100644 --- a/lib/python/qmk/tests/test_cli_commands.py +++ b/lib/python/qmk/tests/test_cli_commands.py @@ -7,7 +7,7 @@ def check_subcommand(command, *args): def test_cformat(): - assert check_subcommand('cformat', 'tmk_core/common/backlight.c').returncode == 0 + assert check_subcommand('cformat', 'tmk_core/common/keyboard.c').returncode == 0 def test_compile(): diff --git a/lib/python/qmk/tests/test_qmk_path.py b/lib/python/qmk/tests/test_qmk_path.py index 94dbf3a6a6..d6961a0f65 100644 --- a/lib/python/qmk/tests/test_qmk_path.py +++ b/lib/python/qmk/tests/test_qmk_path.py @@ -10,4 +10,4 @@ def test_keymap_onekey_pytest(): def test_normpath(): path = qmk.path.normpath('lib/python') - assert path == os.environ['ORIG_CWD'] + '/lib/python' + assert path == os.path.join(os.environ['ORIG_CWD'], 'lib/python') |