Skip to content
This repository has been archived by the owner on Mar 31, 2021. It is now read-only.

Test failures #16

Closed
zhongnansu opened this issue Mar 16, 2020 · 1 comment
Closed

Test failures #16

zhongnansu opened this issue Mar 16, 2020 · 1 comment
Assignees

Comments

@zhongnansu
Copy link
Contributor

Two failures in test.

test_config.py ...                                                                                                                                                                                                                                                                                                                                            [ 10%]
test_esconnection.py .......F                                                                                                                                                                                                                                                                                                                                 [ 39%]
test_essqlcli.py .F                                                                                                                                                                                                                                                                                                                                           [ 46%]
test_formatter.py .............                                                                                                                                                                                                                                                                                                                               [ 92%]
test_main.py ..     
  1. test_esconnection.py
self = <test_esconnection.TestExecutor object at 0x112678130>

    def test_get_aes_client(self):
        aes_test_executor = ESConnection(endpoint=AES_ENDPOINT)
    
        with mock.patch.object(Elasticsearch, "__init__", return_value=None) as mock_es:
>           aes_test_executor.get_aes_client()

aes_test_executor = <escli.esconnection.ESConnection object at 0x11267c100>
mock_es    = <MagicMock name='__init__' id='4603757280'>
self       = <test_esconnection.TestExecutor object at 0x112678130>

test_esconnection.py:138: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <escli.esconnection.ESConnection object at 0x11267c100>

    def get_aes_client(self):
        service = "es"
        session = boto3.Session()
    
        credentials = session.get_credentials()
        region = session.region_name
>       self.aws_auth = AWS4Auth(credentials.access_key, credentials.secret_key, region, service)
E       AttributeError: 'NoneType' object has no attribute 'access_key'

credentials = None
region     = 'us-east-1'
self       = <escli.esconnection.ESConnection object at 0x11267c100>
service    = 'es'
session    = Session(region_name='us-east-1')

../escli/esconnection.py:62: AttributeError

self = <test_essqlcli.TestEssqlcli object at 0x1126570a0>, connection = <escli.esconnection.ESConnection object at 0x112657d00>, cli = <escli.essqlcli.ESSqlCli object at 0x11266fe80>, capsys = <_pytest.capture.CaptureFixture object at 0x11266ff40>

    @estest
    def test_run_cli(self, connection, cli, capsys):
        doc = {"a": "aws"}
        load_data(connection, doc)
    
        # the title is colored by formatter
        expected = (
            "fetched rows / total rows = 1/1" "\n+-----+\n| \x1b[38;5;47;01ma\x1b[39;00m   |\n|-----|\n| aws |\n+-----+"
        )
    
        with mock.patch.object(ESSqlCli, "echo_via_pager") as mock_pager, mock.patch.object(
            cli, "build_cli"
        ) as mock_prompt:
            inp = create_pipe_input()
            inp.send_text(QUERY_WITH_CTRL_D)
    
>           mock_prompt.return_value = PromptSession(
                input=inp, multiline=es_is_multiline(cli), style=style_factory(cli.syntax_style, cli.cli_style)
            )

  1. test_essqlcli.py
test_essqlcli.py:61: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../venv/lib/python3.8/site-packages/prompt_toolkit/shortcuts/prompt.py:458: in __init__
    self.app = self._create_application(editing_mode, erase_when_done)
../venv/lib/python3.8/site-packages/prompt_toolkit/shortcuts/prompt.py:701: in _create_application
    application: Application[_T] = Application(
../venv/lib/python3.8/site-packages/prompt_toolkit/application/application.py:266: in __init__
    self.output = output or session.output
../venv/lib/python3.8/site-packages/prompt_toolkit/application/current.py:65: in output
    self._output = create_output()
../venv/lib/python3.8/site-packages/prompt_toolkit/output/defaults.py:62: in create_output
    return Vt100_Output.from_pty(stdout, term=get_term_environment_variable())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class 'prompt_toolkit.output.vt100.Vt100_Output'>, stdout = <_io.TextIOWrapper encoding='UTF-8'>, term = 'xterm-256color'

    @classmethod
    def from_pty(cls, stdout: TextIO, term: Optional[str] = None) -> "Vt100_Output":
        """
        Create an Output class from a pseudo terminal.
        (This will take the dimensions by reading the pseudo
        terminal attributes.)
        """
        # Normally, this requires a real TTY device, but people instantiate
        # this class often during unit tests as well. For convenience, we print
        # an error message, use standard dimensions, and go on.
>       fd = stdout.fileno()
E       io.UnsupportedOperation: fileno

cls        = <class 'prompt_toolkit.output.vt100.Vt100_Output'>
stdout     = <_io.TextIOWrapper encoding='UTF-8'>
term       = 'xterm-256color'

../venv/lib/python3.8/site-packages/prompt_toolkit/output/vt100.py:449: UnsupportedOperation

@zhongnansu zhongnansu self-assigned this Mar 16, 2020
zhongnansu added a commit that referenced this issue Mar 18, 2020
@zhongnansu
Copy link
Contributor Author

fixed in #19

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant