Skip to content

Question about InputProcessor feed_key change to feed #321

@donnemartin

Description

@donnemartin

Hi Jonathan,

In SAWS and aws-shell, we use InputProcessor.feed_key to test the hotkeys:

https://github.com/awslabs/aws-shell/blob/master/tests/integration/test_keys.py#L32

With the newly released python-prompt-toolkit 1.0.1, it seems feed_key was changed to feed:

AttributeError: 'InputProcessor' object has no attribute 'feed_key'

After changing feed_key to feed, the following errors occur in aws-shell. It seems as though the feed call isn't doing the same thing feed_key did. Is there a better way to test this in the latest python-prompt-toolkit?

======================================= FAILURES =======================================
__________________________________ KeysTest.test_F10 ___________________________________

self = <tests.integration.test_keys.KeysTest testMethod=test_F10>

    def test_F10(self):
        self.processor.feed(KeyPress(Keys.F10, ''))
>       assert self.aws_shell.cli.is_exiting
E       AssertionError: assert <prompt_toolkit.interface.CommandLineInterface object at 0x106ec4c50>.is_exiting
E        +  where <prompt_toolkit.interface.CommandLineInterface object at 0x106ec4c50> = <awsshell.app.AWSShell object at 0x106e37390>.cli
E        +    where <awsshell.app.AWSShell object at 0x106e37390> = <tests.integration.test_keys.KeysTest testMethod=test_F10>.aws_shell

tests/integration/test_keys.py:56: AssertionError
___________________________________ KeysTest.test_F2 ___________________________________

self = <tests.integration.test_keys.KeysTest testMethod=test_F2>

    def test_F2(self):
        match_fuzzy = self.aws_shell.model_completer.match_fuzzy
        self.processor.feed(KeyPress(Keys.F2, ''))
>       assert match_fuzzy != self.aws_shell.model_completer.match_fuzzy
E       AssertionError: assert True != True
E        +  where True = <Mock id='4411315984'>.match_fuzzy
E        +    where <Mock id='4411315984'> = <awsshell.app.AWSShell object at 0x106ef5748>.model_completer
E        +      where <awsshell.app.AWSShell object at 0x106ef5748> = <tests.integration.test_keys.KeysTest testMethod=test_F2>.aws_shell

tests/integration/test_keys.py:33: AssertionError
___________________________________ KeysTest.test_F3 ___________________________________

self = <tests.integration.test_keys.KeysTest testMethod=test_F3>

    def test_F3(self):
        enable_vi_bindings = self.aws_shell.enable_vi_bindings
        with self.assertRaises(InputInterrupt):
            self.processor.feed(KeyPress(Keys.F3, ''))
>           assert enable_vi_bindings != self.aws_shell.enable_vi_bindings
E           AssertionError: assert True != True
E            +  where True = <awsshell.app.AWSShell object at 0x106f82e10>.enable_vi_bindings
E            +    where <awsshell.app.AWSShell object at 0x106f82e10> = <tests.integration.test_keys.KeysTest testMethod=test_F3>.aws_shell

tests/integration/test_keys.py:39: AssertionError
___________________________________ KeysTest.test_F4 ___________________________________

self = <tests.integration.test_keys.KeysTest testMethod=test_F4>

    def test_F4(self):
        show_completion_columns = self.aws_shell.show_completion_columns
        with self.assertRaises(InputInterrupt):
            self.processor.feed(KeyPress(Keys.F4, ''))
>           assert show_completion_columns != \
                self.aws_shell.show_completion_columns
E           AssertionError: assert True != True
E            +  where True = <awsshell.app.AWSShell object at 0x107836160>.show_completion_columns
E            +    where <awsshell.app.AWSShell object at 0x107836160> = <tests.integration.test_keys.KeysTest testMethod=test_F4>.aws_shell

tests/integration/test_keys.py:45: AssertionError
___________________________________ KeysTest.test_F5 ___________________________________

self = <tests.integration.test_keys.KeysTest testMethod=test_F5>

    def test_F5(self):
        show_help = self.aws_shell.show_help
        with self.assertRaises(InputInterrupt):
            self.processor.feed(KeyPress(Keys.F5, ''))
>           assert show_help != self.aws_shell.show_help
E           AssertionError: assert True != True
E            +  where True = <awsshell.app.AWSShell object at 0x1078acb00>.show_help
E            +    where <awsshell.app.AWSShell object at 0x1078acb00> = <tests.integration.test_keys.KeysTest testMethod=test_F5>.aws_shell

-Donne

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions