awslabs / aws-shell

An integrated shell for working with the AWS CLI.
Apache License 2.0
7.22k stars 779 forks source link

test_keys fails with prompt-toolkit 1.0.1 #125

Closed donnemartin closed 8 years ago

donnemartin commented 8 years ago

feed_key was separated to feed and process_keys. For more details, check out:

https://github.com/jonathanslenders/python-prompt-toolkit/issues/321

======================================= 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
donnemartin commented 8 years ago

donnemartin created branch fix-keys-test at awslabs/aws-shell

@jamesls sorry I meant to check in the fix (940c6e8eea613f9916351feeba059e715b0cbe8a ) to the fix-keys-test branch and send in a PR, not submit directly to master. I'm at the beach this week, perhaps that's having an effect on my coding :)

940c6e8eea613f9916351feeba059e715b0cbe8a fixes the build failures on prompt-toolkit 1.0.1. I also tested it on 1.0.0.

Could you please do a code review? Thanks!

jamesls commented 8 years ago

@donnemartin Looks good to me. Thanks for the fix.