8000 Move pexpect from a runtime dependency to test by ssbarnea · Pull Request #2921 · ansible/molecule · GitHub
[go: up one dir, main page]

Skip to content
< 8000 /div>

Move pexpect from a runtime dependency to test - #2921

Merged
ssbarnea merged 1 commit into
masterfrom
rm/sh
Oct 29, 2020
Merged

ssbarnea merged 1 commit into
masterfrom
rm/sh

Conversation

@ssbarnea
Copy link
Copy Markdown
Member

We do not really need pexpect as a runtime dependency as it was using only inside login. Using just subprocess.run() seems to work fine, so we can lower our dependencies.

We do not really need pexpect as a runtime dependency as it was
using only inside login. Using just subprocess.run() seems to
work fine, so we can lower our dependencies.

dimensions = (int(lines), int(columns))
cmd = "/usr/bin/env {}".format(login_cmd)
self._pt = pexpect.spawn(cmd, dimensions=dimensions)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@retr0h Can you please comment on why the pexpect implementation was added in the first place for the interactive login? I am asking because I would not want to introduce a serious regression just because I do not know the reasons behind original implementation.

I did some basic tests and using subprocess.run() appeared to be working fine for me.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible reason from the docs: "The run() function was added in Python 3.5"

If we previously supported < 3.5, then this call wouldn't have been possible.

@greg-hellings greg-hellings left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously pending input from @retr0h, but it looks good to me.


dimensions = (int(lines), int(columns))
cmd = "/usr/bin/env {}".format(login_cmd)
self._pt = pexpect.spawn(cmd, dimensions=dimensions)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible reason from the docs: "The run() function was added in Python 3.5"

If we previously supported < 3.5, then this call wouldn't have been possible.

@ssbarnea
ssbarnea merged commit c36c3b8 into master Oct 29, 2020
@ssbarnea
ssbarnea deleted the rm/sh branch October 29, 2020 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

0