Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

console script subprocess calls are skipped #29

Open
nick-youngblut opened this issue Feb 26, 2020 · 1 comment
Open

console script subprocess calls are skipped #29

nick-youngblut opened this issue Feb 26, 2020 · 1 comment
Labels

Comments

@nick-youngblut
Copy link

nick-youngblut commented Feb 26, 2020

I am trying to test a console script that itself runs calls subprocess a few times in the script. These subprocess calls are just skipped when using pytest-console-scripts-0.2.0. The rest of the console script, but it simply bypasses the subprocess calls. I don't see anything about this in the pytest-console-scripts docs.

@kvas-it
Copy link
Owner

kvas-it commented Sep 1, 2020

I tried to reproduce this with the following test:

@pytest.mark.script_launch_mode('both')
def test_subprocess(console_script, script_runner):
    console_script.write(
        """
import subprocess
res = subprocess.run(['echo', 'foo'], stdout=subprocess.PIPE)
print(res.returncode)
print(res.stdout.decode('utf-8'))
        """
    )
    result = script_runner.run(str(console_script))
    assert result.success
    assert result.stdout == '0\nfoo\n\n'

It passes, as expected. Can you construct an example of your behavior please, then I could investigate further.

@HexDecimal HexDecimal added the bug label May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants