Skip to content

Commit

Permalink
Fix linters issue
Browse files Browse the repository at this point in the history
  • Loading branch information
abikouo committed Feb 4, 2025
1 parent c89a6ef commit b714c0e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion plugins/connection/aws_ssm.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@
import string
import subprocess
import time
from typing import Optional
from typing import NoReturn
from typing import Optional
from typing import Tuple

try:
Expand Down
12 changes: 7 additions & 5 deletions tests/unit/plugins/connection/aws_ssm/test_prepare_terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def poll_mock(x, y):
(["Starting ", "session"], True),
(["Starting ", "session with Session"], True),
(["session ", "with SessionId"], True),
]
],
)
@patch("ansible_collections.community.aws.plugins.connection.aws_ssm.to_bytes")
@patch("ansible_collections.community.aws.plugins.connection.aws_ssm.to_text")
Expand Down Expand Up @@ -66,7 +66,7 @@ def test_ensure_ssm_session_has_started(m_to_text, m_to_bytes, connection_aws_ss
(["stty ", "-echo"], False),
(["stty"], True),
(["stty ", "-ech"], True),
]
],
)
@patch("ansible_collections.community.aws.plugins.connection.aws_ssm.to_bytes")
@patch("ansible_collections.community.aws.plugins.connection.aws_ssm.to_text")
Expand Down Expand Up @@ -105,11 +105,13 @@ def test_disable_prompt_command(m_to_text, m_to_bytes, m_random, connection_aws_
connection_aws_ssm.poll.side_effect = poll_mock

m_random.choice = MagicMock()
m_random.choice.side_effect = lambda x: 'a'
m_random.choice.side_effect = lambda x: "a"

end_mark = "".join(['a' for i in range(connection_aws_ssm.MARK_LENGTH)])
end_mark = "".join(["a" for i in range(connection_aws_ssm.MARK_LENGTH)])

connection_aws_ssm._stdout.read.return_value = f"\r\r\n{end_mark}\r\r\n" if not timeout_failure else "unmatching value"
connection_aws_ssm._stdout.read.return_value = (
f"\r\r\n{end_mark}\r\r\n" if not timeout_failure else "unmatching value"
)
poll_mock.results = [True]

prompt_cmd = f"PS1='' ; bind 'set enable-bracketed-paste off'; printf '\\n%s\\n' '{end_mark}'\n"
Expand Down

0 comments on commit b714c0e

Please sign in to comment.