Skip to content
This repository was archived by the owner on Aug 2, 2023. It is now read-only.
This repository was archived by the owner on Aug 2, 2023. It is now read-only.

Debugging pytests Using Subprocesses Fails #1548

@schanzel

Description

@schanzel

Environment data

  • VS Code version: 1.35.1
  • Extension version: 1.35.1
  • OS and version: macOS 10.14.5
  • Python version: 3.7.3
  • Relevant/affected Python packages and their versions: pytest 4.6.3
  • Jedi or Language Server? Jedi

Expected behaviour

Test results when running with debugger are identical to the results from a run without debugger.

Actual behaviour

Tests fail because subprocess can not be successfully executed when running tests with the debugger attached.

Steps to reproduce:

  1. Write a simple pytest (haven't tested with others) using subprocesses and it's shell argument set to True
    import subprocess
    def test_subprocess():
        result = subprocess.run(
            ' '.join(['echo', 'hello']),
            shell=True
        )
        assert result.returncode == 0
  2. Run that test using the test explorer without debugging
  3. Result is green
  4. Run the same test again with debugger
  5. Result is red because returncode is 2 (also stdout and stderr are empty)

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

none

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)

none

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions