diff options
author | xNinjaKittyx <xNinjaKittyx@users.noreply.github.com> | 2020-12-15 17:21:33 -0800 |
---|---|---|
committer | xNinjaKittyx <xNinjaKittyx@users.noreply.github.com> | 2020-12-15 18:20:13 -0800 |
commit | 9aa54a5b27468d61337528cb1e1b5b9b11a80978 (patch) | |
tree | 567693115cc101efb9254a96d96d80e9f9ccd557 /tests/test_argparse.py | |
parent | 03c65c60b39e369958b056c5c844d36d515c8a63 (diff) | |
download | cmd2-git-ci_improvements.tar.gz |
Adds pre-commit config to run various lintersci_improvements
This ads black, isort, pyupgrade, and flake8 to pre-commit-config.yaml
There are also some small changes to travis.yml and tasks.py to reduce
some repeated configurations that should be consolidated into
setup.cfg. Most other changes are automated by the linter scripts.
Diffstat (limited to 'tests/test_argparse.py')
-rw-r--r-- | tests/test_argparse.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/tests/test_argparse.py b/tests/test_argparse.py index 7059e9d3..e91b4dba 100644 --- a/tests/test_argparse.py +++ b/tests/test_argparse.py @@ -49,7 +49,7 @@ class ArgparseApp(cmd2.Cmd): if word is None: word = '' if args.piglatin: - word = '%s%say' % (word[1:], word[0]) + word = '{}{}ay'.format(word[1:], word[0]) if args.shout: word = word.upper() words.append(word) @@ -101,7 +101,7 @@ class ArgparseApp(cmd2.Cmd): if word is None: word = '' if args.piglatin: - word = '%s%say' % (word[1:], word[0]) + word = '{}{}ay'.format(word[1:], word[0]) if args.shout: word = word.upper() words.append(word) @@ -308,8 +308,9 @@ class SubcommandApp(cmd2.Cmd): helpless_subcmd_parser = cmd2.Cmd2ArgumentParser(add_help=False, description="A subcommand with no help") - @cmd2.as_subcommand_to('test_subcmd_decorator', 'helpless_subcmd', helpless_subcmd_parser, - help=helpless_subcmd_parser.description.lower()) + @cmd2.as_subcommand_to( + 'test_subcmd_decorator', 'helpless_subcmd', helpless_subcmd_parser, help=helpless_subcmd_parser.description.lower() + ) def helpless_subcmd_func(self, args: argparse.Namespace): # Make sure vars(Namespace) works. The way we originally added cmd2_hander to it resulted in a RecursionError. self.poutput(vars(args)) @@ -425,6 +426,7 @@ def test_subcmd_decorator(subcommand_app): def test_unittest_mock(): from unittest import mock + from cmd2 import CommandSetRegistrationError with mock.patch.object(ArgparseApp, 'namespace_provider'): @@ -449,12 +451,7 @@ def test_pytest_mock_invalid(mocker): app = ArgparseApp() -@pytest.mark.parametrize('spec_param', [ - {'spec': True}, - {'spec_set': True}, - {'autospec': True}, -]) +@pytest.mark.parametrize('spec_param', [{'spec': True}, {'spec_set': True}, {'autospec': True},]) def test_pytest_mock_valid(mocker, spec_param): mocker.patch.object(ArgparseApp, 'namespace_provider', **spec_param) app = ArgparseApp() - |